Reputation: 113
I have a project with a Django backend and an Angular frontend. I've deployed them as two services into Google App Engine Standard and the deploy is successful.
However, when I try to access the backend url this-backend.appspot.com
, i get
/bin/sh: 1: exec: gunicorn: not found
I have gunicorn in my requirements file:
gunicorn==19.9.0
I also have defined the entrypoint:
runtime: python37
service: default
entrypoint: gunicorn -b :$PORT thisapp.wsgi
handlers:
- url: /static
static_dir: static
- url: /.*
secure: always
redirect_http_response_code: 301
script: auto
But still get the same error.
I looked into all the same issues on the Stackoverflow, and they were either because of the requirements or the entrypoint which I've defined both of them.
Even when I go to the Stackdriver I can see the gunicorn folders inside the app engine:/
:
gunicorn
gunicorn-19.9.0.dist-info
This is the backend cloudbuild.yaml
file:
steps:
- name: 'python:3.7'
entrypoint: python3
args: ['-m', 'pip', 'install', '-t', '.', '-r', 'requirements.txt']
- name: 'python:3.7'
entrypoint: python3
args: ['./manage.py', 'collectstatic', '--noinput']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', '--version=prod']
I'd really appreciate it if anyone has any solutions or recommendations as I've looked into almost all the same issues on the Internet.
Thanks,
James
Upvotes: 3
Views: 1759
Reputation: 9810
App Engine by default looks for a main.py
file at the root of the app directory with a WSGI-compatible object called app.
The doc here suggests that you may include gunicorn
in your requirements.txt
file if you specify the entrypoint in your app.yaml
file, however the version you want to install seems to conflict with the default one.
To work around this, I'd suggest you to remove both the gunicorn dependency in the requirements.txt file and the entrypoint in your app.yaml and create a main.py file like this:
from thisapp.wsgi import application
app = application
This way it'll fall back to the default behavior explained above and should work fine. It is also implemented this way in the official sample code.
Upvotes: 4