HI, I am trying to use autoroutes for the firsttime, what I want is my site
running in 127.0.0.1:8080/index instead of 127.0.0.1/app/default/index.

I tried the autoroutes and routes.conf explained here but i did't figure out
how to make the access to static files to work.

I am using web2py 1.89.5 all functions as /index is working well, *but my
static files are unreachable.*

127.0.0.1:8080/index works ok, but show no images that I included with <img
src=URL('static','image.png')>

127.0.0.1:8080/static/image.png does not works

*My routes.conf is*
*
*
----START CODE ----
127.0.0.1 /blouweb/default
---END CODE ----

*My routes.py is*

---START CODE---

try: config=open('routes.conf','r').read()
except: config=''

def auto_in(apps):
    routes=[
        ('/robots.txt','/blouweb/static/robots.txt'),
        ('/favicon.ico','/blouweb/static/favicon.ico'),
        ('/admin$anything','/admin$anything'),
        ]
    for a,b in [x.strip().split() for x in apps.split('\n') if x.strip() and
not x.strip().startswith('#')]:
        if not b.startswith('/'): b='/'+b
        if b.endswith('/'): b=b[:-1]
        app = b.split('/')[1]
        routes+=[
            ('.*:https?://(.*\.)?%s:$method /' % a,'%s' % b),
            ('.*:https?://(.*\.)?%s:$method /static/$anything' %
a,'%s/static/$anything' % app),
            ('.*:https?://(.*\.)?%s:$method /appadmin/$anything' %
a,'%s/appadmin/$anything' % app),
            ('.*:https?://(.*\.)?%s:$method /$anything' % a,'%s/$anything' %
b),
            ]
    return routes

def auto_out(apps):
    routes=[]
    for a,b in [x.strip().split() for x in apps.split('\n') if x.strip() and
not x.strip().startswith('#')]:
        if not b.startswith('/'): b='/'+b
        if b.endswith('/'): b=b[:-1]
        app = b.split('/')[1]
        routes+=[
            ('%s/static/$anything' % app,'/static/$anything'),
            ('%s/appadmin/$anything' % app, '/appadmin/$anything'),
            ('%s/$anything' % b, '/$anything'),
            ]
    return routes

routes_in=auto_in(config)
routes_out=auto_out(config)
---END CODE ---



-- 

Bruno Rocha
http://about.me/rochacbruno/bio

Reply via email to