Reputation: 1812
I am trying to migrate my app and everything worked fine until I changed in app.yaml
from threadsafe: false to threadsafe: true.
The error I was receiving was:
threadsafe cannot be enabled with CGI handler: a/b/xyz.app
After some googling I found:
Only scripts in the top-level directory work as handlers, so if you have any in subdirectories, they'll need to be moved, and the script reference changed accordingly:
- url: /whatever
# This doesn't work ...
# script: lib/some_library/handler.app
# ... this does work
script: handler.app
Is there any workaround for this(if above research is valid), as I don't want to change my project hirarchy?
Upvotes: 3
Views: 341
Reputation: 2459
You can have your handlers anywhere as long as it's a valid python import path.
My app.yaml is full of entries like
- url: /_ah/queue/deferred
script: google.appengine.ext.deferred.application
login: admin
The folders need __init__.py
in them to make them work as modules, but you can usually replace any /
with .
Alternatively do as Daniel suggest, and note that you'll probably have to mangle the sys.path
first to include lib
dir and then import handler.
Upvotes: 4
Reputation: 599470
Put a main file in the top-level directory and import all your handlers there, then reference them via that file
Upvotes: 2