According to the documentation, the Python 2.7 GAE runtime no longer restricts access to bytecode:
The Python 2.7 runtime no longer restricts access to Python bytecode. Libraries that generate or manipulate bytecode (e.g. the
jinja2templating library) can do so in this runtime.You can upload and use
.pyc, but not in combination with.pyfiles. You can upload zip files containing.pyor.pycfiles (or a combination).
How do I take avantage of this?
Part of my app.yaml skip-files directive has this line:
skip_files:
- ^(.*/)?.*\.py[o]
- ^(.*/)?.*\.py
Then I uploaded my app to Google App Engine. When I tested it, I get an ImportError (in the logs):
Traceback (most recent call last):
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 187, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 225, in _LoadHandler
handler = __import__(path[0])
ImportError: No module named main
I'm using the threadsafe: true option, so my main handler looks like this:
handlers:
- url: /.*
script: main.app
How come Google App Engine cannot detect my main.pyc file? Are there any necessary special file tree configurations?