URL function in admin app adds "/_2.17.1/" to path variable

54 views
Skip to first unread message

Jörg Schneider

unread,
Aug 29, 2018, 10:08:32 AM8/29/18
to web2py-users

After downloading 2.17.1 from Github I get wrong static URLs in the admin application:

response.files.insert(0,URL('static','js/jquery.js')) in web2py_ajax.js resolves the URL to <script src="/admin/static/_2.17.1/js/jquery.js" which results in 404-errors for all static files for the admin application.
There is no routes.py in the root folder and other installed applications work properly

fiubarc

unread,
Aug 29, 2018, 10:37:48 AM8/29/18
to web2py-users
Hello, look at db.py ... probably you have uncommented these lines:

# response.static_version = myconf.get('app.version')
# response.static_version_urls = True

http://www.web2py.com/books/default/chapter/29/04/the-core#Static-asset-management

Jörg Schneider

unread,
Aug 29, 2018, 10:47:14 AM8/29/18
to web2py-users
You made my day!!! It were this lines in 0.py

Hahaha, RTFM! I'm always finding new things in this book even I thought I've seen all chapters... 

Anthony

unread,
Aug 29, 2018, 11:37:53 AM8/29/18
to web2py-users
The admin app uses the built-in static versioning functionality, as described here: http://web2py.com/books/default/chapter/29/04/the-core#Static-asset-management. You may need to configure your web server properly to handle those URLs, as described in the above link.

Anthony

xgp.l...@gmail.com

unread,
Feb 18, 2019, 5:58:33 PM2/18/19
to web2py-users
Hi,

Sorry for my ignorance. How do you do that?
Ive been trying without sucess using rewrite module.



Cheers,

Dave S

unread,
Feb 18, 2019, 7:20:00 PM2/18/19
to web2py-users


On Monday, February 18, 2019 at 2:58:33 PM UTC-8, xgp.l...@gmail.com wrote:
Hi,

Sorry for my ignorance. How do you do that?
Ive been trying without sucess using rewrite module.



Cheers,



Which webserver are you using?  Is it the Rocket webserver that ships with Web2Py, or Apache, or NginX, or IIS?

Are you trying to use routes.py?   You may not need to.  From the book reference that Anthony pointed to, it apears that you can deal with everything in your models (e.g., db.py).  The book also has examples for Apache and NginX.  I don't see anything in routes.py itself as an example for rewriting, so the support for the model-based handling must be in the response code itself.

/dps


 

xgp.l...@gmail.com

unread,
Feb 19, 2019, 11:44:36 AM2/19/19
to web...@googlegroups.com
Hi,

Im using lighttpd. Default deploy example from manual doesnt allow css files to load becasue of the version control of static files i understand, correct me if im wrong.

Finally ive got it working using this:

    $HTTP["url"] =~ "^/admin/" {
         url.rewrite-once = (
               "^(/.+?/static)/(.*)/$" => "/applications$1/$2",
               "(^|/.*)$" => "/handler_web2py.fcgi$1",
         )

Dont know if that is correct but it works.



Cheers,
Reply all
Reply to author
Forward
0 new messages