0

I am trying to deploy a relatively simple flask app to 'app engine'.

However, after deploying and then running 'gcloud app browse', i am getting the following internal server error (stack trace sample):


File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked: ModuleNotFoundError: No module named 'main'

        at _find_and_load (<frozen importlib._bootstrap>:983)
        at _gcd_import (<frozen importlib._bootstrap>:1006)
        at import_module (/opt/python3.7/lib/python3.7/importlib/__init__.py:127)
        at import_app (/env/lib/python3.7/site-packages/gunicorn/util.py:358)
        at load_wsgiapp (/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py:39)
        at load (/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py:49)
        at wsgi (/env/lib/python3.7/site-packages/gunicorn/app/base.py:67)
        at load_wsgi (/env/lib/python3.7/site-packages/gunicorn/workers/base.py:144)
        at init_process (/env/lib/python3.7/site-packages/gunicorn/workers/base.py:119)
        at init_process (/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py:92)
        at spawn_worker (/env/lib/python3.7/site-packages/gunicorn/arbiter.py:583)

The error seems to be emanating from the gunicorn library.

I am deploying to the standard environment and my app.yaml file is simply:

runtime: python37

Any ideas why this might be happening?

davidism
  • 121,510
  • 29
  • 395
  • 339
pablowilks2
  • 299
  • 5
  • 15
  • As @gaefan said, check for the existence of the main.py file. Also, this [SO thread](https://stackoverflow.com/a/52395801/12163274) may be helpful – Jose V May 15 '20 at 07:30

1 Answers1

2

App engine expects to see a file called main.py alongside your app.yaml file. It seems that this file isn't present.

See Google's samples to guide you: https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/standard_python37/hello_world

new name
  • 15,861
  • 19
  • 68
  • 114