It’s extremely unclear to me from the Appengine documentation how to use both the app.yaml configuration settings and the webapp2 framework.
For example, the documentation suggestions this:
- url: /youraccount/.*
script: accounts.py
login: required
secure: always
However, that accounts.py is the CGI form; not compatible with the main.app way of doing things.
Here’s some permutations that I’ve tried and have failed for various reasons:
- url: /.*
script: main.app
- url: /admin/.*
secure: always
login: required
Above fails because a script is required
- url: /.*
script: main.app
- url: /admin/.*
script: main.app
secure: always
login: required
Above fails because the secure and login directives seem to be ignored.
- url: /.*
script: main.app
- url: /admin/.*
script: admin.py
secure: always
login: required
Above fails because the CGI style of handler is not compatible with threadsafe.
Any thoughts?
This:
The handlers in the
app.yamlfile are searched top-down, and the first possible match is used. So, the symptom that “thesecureandlogindirectives seem to be ignored” is because the URL is matching the first directive (- url: /.*), and not applying your other options.Basically, switch the order, with the most specific patterns first.