Marzia, Could you please provide an example of how one might use a regular expression with static_dir url pattern?
The one I provided seemed like a pretty simple one (simple prefix, no groupings), but it doesn't work, so obviously I'm missing something here. What does work? Thank you. On Jan 6, 10:54 am, Marzia Niccolai <[email protected]> wrote: > Hi, > > This is due to the fact that the url parameter for static_dir works > differently than that for static_files. The static_dir regex is prefix only > with no groups: > > From static_dir description: > url > > A URL prefix. This value uses regular expression syntax (and so regexp > special characters must be escaped), but it should not contain groupings. > All URLs that begin with this prefix are handled by this handler, using the > portion of the URL after the prefix as part of the file path. > > And the description for static_files: > > url > > The URL pattern, as a regular expression. The expression can contain > groupings that can be referred to in the file path to the script with > regular expression back-references. > > For example, /item-(.*?)/category-(.*) would match the URL > /item-127/category-fruit, and use 127 and fruit as the first and second > groupings. > -Marzia > > On Tue, Jan 6, 2009 at 12:16 AM, boson <[email protected]> wrote: > > > GAE docs [1] on configuring for serving static files say the "url" > > param used with static_dir "uses regular expression syntax". I can't > > seem to get this to work. > > > I wanted to let the URLs "/stuff/v1/thing.gif", "/stuff/v2/thing.gif", > > etc. all refer to a file "thing.gif" in my app's "/static/stuff" > > directory. Tried like this: > > > - url: /stuff/.*/ > > static_dir: static/stuff > > > But I only get 404s. (Nothing earlier in app.yaml is interfering > > either). > > > I ended up converting it to this, which works: > > > - url: /stuff/(.*)/(.*) > > static_files: static/stuff/\2 > > upload: static/stuff/(.*) > > > So it works, but the syntax is much more cumbersome. Is regex > > supposed to work with static_dir, and if so what am I doing wrong (or > > is this a bug)? Thanks. > > > I should say that I have only tested on this dev_appserver (Mac OS X) > > so far -- haven't verified this problem in production. > > > [1] > >http://code.google.com/appengine/docs/configuringanapp.html#Static_Fi... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
