Try :

response.static_version_urls = True

in your model.

I think it is not documented in the book, but there is a bug report about
it.

On Mon, Aug 22, 2016 at 6:46 AM T.R.Rajkumar <t.r.rajkuma...@gmail.com>
wrote:

> I hope the question is not clear. The purpose is to reduce band with by
> making the browser store the static css, js files and use them in further
> calls to the page. When version number is changed the browser will again
> fetch the new static files and store them. This is in the book by the
> caption static asset management.
> I do as recommended in the book but I am not able to make the browser
> store the file.
> I hope this is clear. Pl.help.
>
>
> On Wednesday, August 17, 2016 at 5:11:59 PM UTC+5:30, T.R.Rajkumar wrote:
>>
>> I have in view home.html this
>> {{
>>             response.files.insert(0,URL('static','css/bootstrap.min.css'))
>>             response.include_files()
>> }}
>>
>> In model I have
>> response.static_version = '1.2.3'
>>
>> In Apache 2.4 in httpd-vhosts.conf I have
>>
>> <VirtualHost *:9090>
>>     ServerAdmin webmas...@dummy-host.example.com
>>     DocumentRoot "D:/web2py/applications"
>>     ServerName localhost:9090
>>     ServerAlias www.dummy-host.example.com
>>     #WSGIProcessGroup web2py
>>     <Directory "D:/web2py">
>>         Options Indexes Includes FollowSymLinks
>>         AllowOverride AuthConfig Limit FileInfo
>>     Require all granted
>>
>>     </Directory>
>>
>>
>>     ErrorLog "logs/error.log"
>>     CustomLog "logs/access.log" common
>>     WSGIScriptAlias / "D:/web2py/wsgihandler.py"
>>     AliasMatch ^/([^/]+)/static/css/(?:_[\d]+.[\d]+.[\d]+/)?(.*)
>> "D:/web2py/applications/$1/static/css/$2"
>> </VirtualHost>
>>
>> When I request the page I get this in firefox.
>>
>> In firefox dev tools I see this
>> GET
>> http://172.16.166.102:9090/web_ts2_site/
>> *static/_1.2.3/css/bootstrap.min.css* [HTTP/1.1 304 NOT MODIFIED 16ms]
>> Headers
>> Response
>> Cookies
>> ConnectionKeep-AliveDateWed, 17 Aug 2016 11:18:37 GMTKeep-Alivetimeout=5,
>> max=99ServerApache/2.4.18 (Win32) OpenSSL/1.0.2e mod_wsgi/4.4.12
>> Python/2.7.5
>> Accepttext/css,*/*;q=0.1Accept-Encodinggzip,
>> deflateAccept-Languageen-US,en;q=0.5*Cache-Controlmax-age=0*Connectionkeep-aliveCookie_ga=GA1.1.712052505.1470996245;
>> session_id_web_ts2_site=172.16.166.102-c261edeb-458c-4871-be0e-526d0ce3daaf;
>> session_id_admin=172.16.166.102-b49178fd-8596-4dc6-a3d4-723be9c23f67;
>> _gat_awxoapTracker=1Host172.16.166.102:9090If-Modified-SinceWed, 28 Jan
>> 2015 06:06:55 GMTRefererhttp://
>> 172.16.166.102:9090/ts2User-AgentMozilla/5.0 (Windows NT 5.1; rv:48.0)
>> Gecko/20100101 Firefox/48.0
>>
>> As I see the cache-Controlmax-age = 0
>> Also the versioning is applied after static but before css folder as in
>> the above url.
>> Should the version be necessarily before the file name?
>> What should I do to set the max-age 315360000 as given in the book.
>> Pl. help.
>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to