Score:0

Google App Engine deploying django ModuleNotFoundError: No module named 'app.wsgi.application'; 'app.wsgi' is not a package

ru flag

I have encounter this error '502 Bad Gateway nginx' when running a django app on google app engine. When I check the logs I got this

Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker worker.init_process() File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process self.load_wsgi() File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi self.wsgi = self.app.wsgi() File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load return self.load_wsgiapp() File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp return util.import_app(self.app_uri) File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app mod = importlib.import_module(module) File "/opt/python3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 981, in _find_and_load_unlocked ModuleNotFoundError: No module named 'app.wsgi.application'; 'app.wsgi' is not a package

Here is my app.yaml

runtime: python39
entrypoint: gunicorn -b :$PORT --chdir app/ app.wsgi:application

handlers:
  - url: /static
    static_dir: static/
  - url: /.*
    script: auto

docker-compose-deploy.yml

version: '3.9'

services:
  gcloud:
    image: google/cloud-sdk:341.0.0-slim
    volumes:
      - gcp-creds:/creds
      - .:/app
    working_dir: /app
    environment:
      - CLOUDSDK_CONFIG=/creds

volumes:
  gcp-creds:

requirements.txt

Django>=3.2.3,<3.3
gunicorn>=20.1.0,<20.2
google-cloud-secret-manager>=2.4.0,<2.5
google-cloud-ndb>=1.8,<1.9

No error when deploy everything went smooth. Any idea will be appreciated.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.