GAE + python + Django addictive story

Background

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. image.png

Check the log

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'

result

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

Finally

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.

Reference URL

○ 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

GAE + python + Django addictive story
Python Django Tutorial (5)
Python Django Tutorial (2)
Python Django Tutorial (7)
Python Django Tutorial (1)
Python Django tutorial tutorial
Python Django Tutorial (3)
Python Django Tutorial (4)
Django 1.11 started with Python3.6
Python Django tutorial summary
Django python web framework
python small story collection
Try Debian + Python 3.4 + django1.7 ...
[Personal notes] Python, Django
Python Django CSS reflected
Do Django with CodeStar (Python3.6.8, Django2.2.9)
Introduction to Python Django (2) Win
Do Django with CodeStar (Python3.8, Django2.1.15)
Python3 + Django ~ Mac ~ with Apache
Create ToDo List [Python Django]
Getting Started with Python Django (1)
Getting Started with Python Django (4)
Getting Started with Python Django (3)
Stumble story with Python array
Install Python 3.7 and Django 3.0 (CentOS)
Getting Started with Python Django (6)
Python Django Tutorial Cheat Sheet
Getting Started with Python Django (5)
The story of Python and the story of NaN
8 Frequently Used Commands in Python Django
Create new application use python, django
python + django + scikit-learn + mecab (1) on heroku
python + django + scikit-learn + mecab (2) on heroku
Install Python framework django using pip
Strange and horrifying Python error story
Introduction to Python Django (2) Mac Edition
Story of power approximation by Python