What is inserting '_2.7.3' into my static url's?

271 views
Skip to first unread message

Johann Spies

unread,
Oct 31, 2013, 8:22:16 AM10/31/13
to web...@googlegroups.com
Investing why admin on the server does not use CSS (at least for the initial view and the 'design' view) I found (using Firebug) that the references to the static files look like this:

<script type="text/javascript" src="/admin/static/_2.7.3/js/jquery.js">
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /admin/static/_2.7.3/js/jquery.js was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Debian) Server at crest2.sun.ac.za Port 443</address>
</body></html>

I can not find what is causing this.  I suspect this happened with the upgrade to Web2py version 2.7.3.  At the moment the version is: Version 2.7.4-stable+timestamp.2013.10.21.21.29.21

I have rsynced the installation on the server to my local computer and there it does not happen when I run web2py from that rsynced version. 

The server uses Apache2.

How do I correct this?  The files in admin/views does not contain that string. So something is inserting '_2.7.3'  whenever a static url is formed.

Regards
Johann


--
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

Kiran Subbaraman

unread,
Oct 31, 2013, 9:08:09 AM10/31/13
to web...@googlegroups.com
Am not sure what is causing the issue. But reading this bit of the documentation may give you a clue: http://web2py.com/books/default/chapter/29/04/the-core#Static-asset-management
________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/
--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Richard Vézina

unread,
Oct 31, 2013, 10:41:11 AM10/31/13
to web2py-users
This should be something forget in web2py code I guess, or the activate response.static_version

But I think it has been forget, since response.static_version should be from your app.

Anyway to workaround this you have to configure appache, read the doc form the link post by Kiran above.

:)

Richard

Niphlod

unread,
Oct 31, 2013, 1:00:03 PM10/31/13
to web...@googlegroups.com
it's not a forgotten piece of code....it's there for a reason.

1) tell people about response.static_version
2) avoid any errors related to stale browser cache for the admin app files, that is getting more a javascript app than a python one

BTW, response.static_version is in web2py since Oct 2012, so a revised static alias in the setup (if needed) it's only going to keep people's setups updated with the current web2py setup scripts.

Richard Vézina

unread,
Oct 31, 2013, 1:13:15 PM10/31/13
to web2py-users
Doh!

:)

Richard

Johann Spies

unread,
Nov 4, 2013, 7:53:46 AM11/4/13
to web...@googlegroups.com
On 31 October 2013 19:00, Niphlod <nip...@gmail.com> wrote:
it's not a forgotten piece of code....it's there for a reason.

What is the version referring to in admin/0.py/?  It if it supposed to be the current web2py version then it is a piece of forgotten code because in Web2py 2.7.4. it 0.py has 2.7.3 in line 48.

I have modified that file to response.static_version = '2.7.4'
but the problem still stays the same:

e.g. /admin/static/_2.7.4/js/calendar.js

And the documentation says that it is not necessary to create a different directory for the current version.

So either I am understanding nothing of this, or this is a mistake in the documentation or the documentation is not clear.

Anyhow it is frustrating.

I am going to comment that line.

What other way is there of solving this problem?

Regards
Johann

Richard Vézina

unread,
Nov 4, 2013, 9:27:41 AM11/4/13
to web2py-users
web2py/VERSION ??

But as I said you could need to change your apache config...

This is the example for nginx from the book :

# file /etc/nginx/sites-available/web2py
server {
        listen          80;
        server_name     $hostname;
        #to enable correct use of response.static_version
        #location ~* /(\w+)/static(?:/_[\d]+.[\d]+.[\d]+)?/(.*)$ {
        #    alias /home/www-data/web2py/applications/$1/static/$2;
        #    expires max;
        #}


The only thing important is the regex :

/(\w+)/static(?:/_[\d]+.[\d]+.[\d]+)?/(.*)$


You can adapt for apache.

But I am not sure the issue is coming from there.

Richard


--

LightDot

unread,
Nov 4, 2013, 11:10:42 AM11/4/13
to web...@googlegroups.com
The number doesn't really matter. It's supposed to stay the same until a static file's content changes, then it should be changed in order to prevent the browser cache to display the wrong file contents.

So it can be 2.7.3 or 19283773.39393.3939393, doesn't matter.

How are you using apache? With mod_wsgi? How exactly? That's what you'll need to adjust if the admin doesn't work for you with response.static_version enabled.

Regards

Johann Spies

unread,
Nov 5, 2013, 1:55:24 AM11/5/13
to web...@googlegroups.com
Thanks Richard and LightDot for helping me to understand this.

I misinterpreted the documentation including the part about the apache configuration.  It is now working as it should.

Reply all
Reply to author
Forward
0 new messages