I am currently using modules, a relatively new concept in appengine for subdomain routing. It all works fine,except that static resources like stylesheets and images only seem to load at the "default" module and not the "admin" module i am using.
The default module's yaml file , app.yaml is:-
application: check4se
version: v1
runtime: python27
api_version: 1
threadsafe: true
automatic_scaling:
max_idle_instances: 20
handlers:
- url: /stylesheets
static_dir: stylesheets
expiration: "1s"
- url: /images
static_dir: images
expiration: "1s"
- url: /js
static_dir: js
- url: .*
script: Main2.app
libraries:
- name: jinja2
version: latest
My admin.yaml for the module admin is as follows:-
application: check4se
module: admin
version: v1
runtime: python27
api_version: 1
threadsafe: false
automatic_scaling:
min_idle_instances: 2
handlers:
- url: .*
script: admin.app
- url: /_ah/login_required
script: do_openid_login.py
I am using dispatch.yaml to route all static resources to my default module:-
application: check4se
dispatch:
- url: "admin.check4se.appspot.com/*"
module: admin
- url: "*/images"
module: default
- url: "*/stylesheets"
module: default
- url: "*/js"
module: default
What's the issue and workaround.
I think the .* handler in the admin.yaml is matching the /_ah/login_required path, so the /_ah/login_required path never matches and never calls do_openid_login.py.
Instead, put the /_ah/login_required handler before the .* handler.
application: check4se
module: admin
version: v1
runtime: python27
api_version: 1
threadsafe: false
automatic_scaling:
min_idle_instances: 2
handlers:
- url: /_ah/login_required
script: do_openid_login.py
- url: .*
script: admin.app
Additionally, you might be having a similar problem with the dispatch.yaml
You may want to put the static resource paths first or else anything on the admin domain will go to the admin resource and no the default resource.
application: check4se
dispatch:
- url: "*/images"
module: default
- url: "*/stylesheets"
module: default
- url: "*/js"
module: default
- url: "admin.check4se.appspot.com/*"
module: admin