im trying to fallback to the static folder when a controller is not found, 
for example:
a route like:
<img src="/img/mypicture.png">

img is not a defined controller so i would like to redirect this route to 
"/static/img/mypicture.png", how do i do that?

I have tried:

BASE = ''  # optonal prefix for incoming URLs
fixed_routes = [
     # do not reroute admin unless you want to disable it
    (BASE + '/admin', '/admin/default/index')
    , (BASE + '/admin/$anything', '/admin/$anything')
    # do not reroute appadmin unless you want to disable it
    , (BASE + '/%s/appadmin' % default_application, '/%s/appadmin/index' % 
default_application)
    , (BASE + '/%s/appadmin/$anything' % default_application, 
'/%s/appadmin/$anything' % default_application)
]

# for some reason using the variable $app raises a server error. 
IndexError: unknown group name: 'app'
routes_in = fixed_routes + [
    ('/', '/%s/default/index' % default_application)
    , ('/$c', '/%s/$c/index' % default_application)
    , ('/$c/$anything', '/%s/$c/index/$anything' % default_application)
    , ('/$anything', '%s/static/$anything' % default_application)
]

routes_out = [(x[1], x[0]) for x in routes_in]

but does not look like $c cares about the string is a controller or not so 
'/$anything' rerouting to the static folder never triggers.

Shall i try routes on error? Any tips on how to do that?
What kind of response is sent when a static file is not found?

Thanks in advance.

-- 
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