main.py
--start--
            rewrite.select(environ)
                print '_'*40,'routes_in','_'*40
                print rewrite.thread.routes.routes_in
                print '_'*40,'routes_out','_'*40
                print rewrite.thread.routes.routes_out
                print '_'*40,'PATH_INFO','_'*40
                print environ['PATH_INFO']
---end---

executing web2py and accesing http://127.0.0.1:8000/static/img/logo.png that
returns
invalid request

rochacbruno-2:web2py brunomac$ python web2py.py -a 1234
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.89.5 (2010-11-21 22:12:54)
Database drivers available: SQLite3
Starting hardcron...
please visit:
http://127.0.0.1:8000
use "kill -SIGTERM 15282" to shutdown the web2py server
________________________________________ routes_in
________________________________________
[(<_sre.SRE_Pattern object at 0x1011ed770>, '/blouweb/static/robots.txt'),
(<_sre.SRE_Pattern object at 0x1011f5a60>, '/blouweb/static/favicon.ico'),
(<_sre.SRE_Pattern object at 0x101509df0>, '/admin\\g<anything>'),
(<_sre.SRE_Pattern object at 0x1011effe0>, '/blouweb/default'),
(<_sre.SRE_Pattern object at 0x101513080>, 'blouweb/static/\\g<anything>'),
(<_sre.SRE_Pattern object at 0x101514900>,
'blouweb/appadmin/\\g<anything>'), (<_sre.SRE_Pattern object at
0x1015125a0>, '/blouweb/default/\\g<anything>')]
________________________________________ routes_out
________________________________________
[(<_sre.SRE_Pattern object at 0x1015126d0>, '/static/\\g<anything>'),
(<_sre.SRE_Pattern object at 0x1011efd70>, '/appadmin/\\g<anything>'),
(<_sre.SRE_Pattern object at 0x101514790>, '/\\g<anything>')]
________________________________________ PATH_INFO
________________________________________
/static/img/logo.png




2010/11/29 mdipierro <[email protected]>

> I am going to need some help with debugging. In main.py, after
> rewrite.select(environ)
>
> can you log the values of
> 1) rewrite.thread.routes.routes_in
> 2) rewrite.thread.routes.routes_out
> 3) environ['PATH_INFO']
>
> when you call /static/image.png?
>
> massimo
>
> On Nov 29, 8:19 am, Bruno Rocha <[email protected]> wrote:
> > Not working here,
> >
> > I have an image called image.png in /static
> >
> > without autoroutes I can access withhttp://
> 127.0.0.1:8080/blouweb/static/image.png
> >
> > with autotoutes I can't access withhttp://
> 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 Rochahttp://about.me/rochacbruno/bio
>



-- 

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

Reply via email to