On Nov 28, 2010, at 12:50 PM, mdipierro wrote:
> 
> with the app.yaml file that comes with web2py, static files are served
> by appegnine, not by web2py, therefore routes_out should not rewrite /
> <app>/static/...

Exactly. 

Files that are marked as static in GAE are served directly by GAE. Web2py is 
never invoked, and no rewriting takes place. If you rewrite the URLs, then GAE 
doesn't recognize the file as static, and gives it to web2py, which rewrites 
it. But GAE doesn't allow Python apps to access files that are marked as 
static, hence the blocked-access messages (I don't know why that is; presumably 
they're actually stored elsewhere, or something like that).

If you really, really need to rewrite those URLs, you could tell GAE (via 
app.yaml) that the static directory is not static. That would be less 
efficient, since web2py would have to run for each of those files (though if 
they're cached, that might not be all that bad).


> 
> On Nov 28, 2:30 pm, Emceha <[email protected]> wrote:
>> On Nov 28, 8:42 pm, Jonathan Lundell <[email protected]> wrote:
>> 
>>> On Nov 28, 2010, at 11:08 AM, Emceha wrote:
>>> Have you looked at the logger output? Since GAE apparently always logs at 
>>> DEBUG level, you should
>>> see logs of all URL rewrites arising from your routes.py, as 
>>> 'web2py.rewrite' log entries. At the
>>> very least you should check to see that the rewritten paths match the full 
>>> path with no rewriting.
>> 
>> The only errors from dev_appserver.py I see is that $link got blocked.
>> It also looks like the link it complains about was already rewritten
>> by route.py - let me show you working (when I use web2py.py as local
>> dev server) routes.py
>> 
>> routes_in=[
>> ('/pliki/$anything', '/init/static/pliki/$anything'),
>> ('/static/$anything', '/init/static/$anything'),
>> ('/admin/$anything', '/admin/$anything'),
>> ('/appadmin/$anything','/init/appadmin/$anything'),
>> ('/$anything', '/init/default/$anything')
>> ]
>> 
>> routes_out=[
>> ('/init/static/pliki/$anything', '/pliki/$anything'),
>> ('/init/static/$anything', '/static/$anything'),
>> ('/admin/$anything', '/admin/$anything'),
>> ('/init/appadmin/$anything','/appadmin/$anything'),
>> ('/init/default/$anything', '/$anything')
>> ]
>> 
>> So now: my template requests:
>> 
>> http://.../static/css/style.css
>> 
>> In dev_appserver logs I see
>> 
>>  .....  Blocking access to static file /init/static/css/
>> style.css ....
>> 
>> So as mentioned above rewrite somehow worked but was blocked? Maybe
>> request is not consistent with physical location of requested file? No
>> idea.
>> 
>>> (By "old" and "new" above, do you mean without and with rewriting, 
>>> respectively?)
>> 
>> Yep
>> 
>> I'm happy to helo to solve this annoying issue :) - I can even create
>> new clean app so more people can test it.
>> 
>> Marcin


Reply via email to