3

I am trying to create sample Django app with MySQL as database, its working fine in local when same app I try to deploy on GCP gives 500 error. I have created sql server in GCP and sued same settings

Its failing to find gunicorn but I have specified all this in requirments.txt.

2019-01-19 07:42:57 default[20190119t130429]  "GET /admin HTTP/1.1" 500
2019-01-19 07:42:58 default[20190119t130429]  /bin/sh: 1: exec: gunicorn: not found
2019-01-23 17:41:21 default[20190119t130429]  "GET /admin HTTP/1.1" 500
2019-01-23 17:41:22 default[20190119t130429]  /bin/sh: 1: exec: gunicorn: not found
2019-01-23 18:36:00 default[20190123t235752]  "GET /admin HTTP/1.1" 500
2019-01-23 18:36:00 default[20190123t235752]  /bin/sh: 1: exec: gunicorn: not found
2019-01-23 18:36:01 default[20190123t235752]  "GET /favicon.ico HTTP/1.1" 500
2019-01-23 18:36:02 default[20190123t235752]  /bin/sh: 1: exec: gunicorn: not found
2019-01-23 18:36:20 default[20190123t235752]  "GET /admin HTTP/1.1" 500
2019-01-23 18:36:20 default[20190123t235752]  /bin/sh: 1: exec: gunicorn: not found
2019-01-23 18:36:21 default[20190123t235752]  "GET /favicon.ico HTTP/1.1" 500
2019-01-23 18:36:21 default[20190123t235752]  /bin/sh: 1: exec: gunicorn: not found
**app.yaml**

runtime: python37
entrypoint: gunicorn -b :$PORT sqlreco.wsgi
#threadsafe: yes

handlers:
- url: /images
  static_dir: static/images
  http_headers:
    Access-Control-Allow-Origin: '*'

runtime_config:
 python_version: 3


**requirnaments.txt**

Django==2.1.5
djangorestframework==3.9.1
mysql==0.0.2
mysqlclient==1.4.1
pytz==2018.9
gunicorn==19.8.1

1 Answer 1

1

Based on this error:

ModuleNotFoundError: No module named 'main'

It looks like you don't have a main.py file for your application. If you're not specifying a custom entrypoint, you need to have this file with a variable named app which corresponds to your application.

For Django, you can probably just do something like this in main.py:

from mysite.wsgi import application as app

Where mysite is the name of the directory that your Django app lives in.

Sign up to request clarification or add additional context in comments.

4 Comments

The has done already that error was old one I have updated the log in question removing the older logs
Can you include your app.yaml and your requirements.txt in the question?
added the app.yaml and requirements.txt
Is your file literally called requirnaments.txt? There's a typo there, it might explain why gunicorn is not getting installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.