Not working here, I have an image called image.png in /static
without autoroutes I can access with http://127.0.0.1:8080/blouweb/static/image.png with autotoutes I can't access with http://127.0.0.1:8080/static/image.png 2010/11/29 mdipierro <[email protected]> > http://.../static/filename? > does it not work? > > On Nov 29, 5:25 am, rochacbruno <[email protected]> wrote: > > HI, I am trying to use autoroutes for the first time, what I want is my > site running in127.0.0.1:8080/index instead > of127.0.0.1:8080/app/default/index > > > > I tried the autoroutes and routes.conf explained in another thread here > but i didn't figure out how to make the access to static files. > > > > I am using web2py 1.89.5 all functions as /index and /user are 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 too, and I cannot access > in old way /app/static/image.png > > > > Something is missing in routes_out? > > > > 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 --- > > > > How to access static files? > > > > -- > > > > Bruno Rochahttp://about.me/rochacbruno/bio > > > > Enviado via iPhone -- Bruno Rocha http://about.me/rochacbruno/bio

