On Nov 28, 2010, at 1:45 PM, Emceha wrote: > > So far I use > > - url: /static > static_dir: applications/init/static/ > > for my only application :) in GAE and this seems to solve the problem
That makes sense; good to know. > > Thanks > > On Nov 28, 10:21 pm, Jonathan Lundell <[email protected]> wrote: >> On Nov 28, 2010, at 1:15 PM, Emceha wrote: >> >> >> >>> So to get rid of /init/default/ (in my case I need rewrite.py + >>> modified app.yaml like >> >>> - url: /static/(?P<b>.+) instead of >>> - url: /(?P<a>.+?)/static/(?P<b>.+) >> >>> Am I thinking right? >> >> I don't know enough about what you can do in app.yaml to comment. Hopefully >> Massimo or someone else can. >> >> Just keep in mind that if GAE sees a URL that it recognizes as static (in >> its terms), it will try to serve the file directly, and web2py will not run >> (which means no rewriting). >> >> So if you tell GAE that /static/... is a GAE static file, you must have the >> actual file there, because the URL will not be rewritten by web2py. >> >> >> >> >> >> >> >> >> >>> On Nov 28, 10:06 pm, Jonathan Lundell <[email protected]> wrote: >>>> 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

