Skip to content Skip to sidebar Skip to footer

Google App Engine App.yaml Configuration For /user/.* Regex

I'm trying to make a login and profile page. Here is the app.yaml file which works fine for '/' and '/(anything)'. Instead of '/(anything)' I would like to have the path as '/user/

Solution 1:

Try something like:

- url: /(.+)/(.*\.js)
  mime_type: text/javascript
  static_files: static/\2upload: static/(.*\.js)

This will match /anything/file.js as well as /anything/anything/file.js, as well as /junk/static/hellothere/this/matches/everything/file.js, because (.+) also matches all the slashes. If you don't want it to match both, then you need to handle the slashes in the regex (separate handling for characters and slashes):

- url: /([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/(.*\.js)
  mime_type: text/javascript
  static_files: static/\3upload: static/(.*\.js)

This matches /any-thing/any_th-ing/file.js. If you want to get more specific, you can use:

- url: /user/([A-Za-z0-9-_]+)/(.*\.js)
  mime_type: text/javascript
  static_files: static/\2upload: static/(.*\.js)

to match `/user/anything/file.js', or:

- url: /([A-Za-z0-9-_]+)/static/(.*\.js)
  mime_type: text/javascript
  static_files: static/\2upload: static/(.*\.js)

to match /anything/static/file.js

Post a Comment for "Google App Engine App.yaml Configuration For /user/.* Regex"