Even though it works locally, when I deploy it to GAE, the following error message is displayed. .. ..
Error: Server Error The server encountered an error and could not complete your request. Please try again in 30 seconds.
When I looked at the situation with the following command to check the error log, it seemed that the module could not be found well. I fell into the trap of what'main' was here.
c:\Users\test>gcloud app logs tail -s default
…
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'main'
I solved it just by adding the following document in app.yaml.
app.yaml
runtime: python37
entrypoint: gunicorn -b :8080 [Project name].wsgi ←←← here! !! !!
handlers:
# This configures Google App Engine to serve the files in the app's static
# directory.
- url: /static
static_dir: static/
# This handler routes all requests not caught above to your main app. It is
# required when static routes are defined, but can be omitted (along with
# the entire handlers section) when there are no static files defined.
- url: /.*
script: auto
I don't know what to do because there is no description in the GAE django tutorial I finally arrived after learning how to put out logs. I hope this error resolution helps someone.
○ Running Django on App Engine standard environment (GAE django tutorial) https://cloud.google.com/python/django/appengine?hl=ja ○Python 3 Django on App Engine Standard: App Fails to Start (Solution caught in search) https://stackoverflow.com/questions/52416588/python-3-django-on-app-engine-standard-app-fails-to-start ○ Python 3 runtime environment (About the setting of app.yaml) https://cloud.google.com/appengine/docs/standard/python3/runtime
Recommended Posts