Why the manage.py file is not executed in the App Engine Flexible dockerfile?

Viewed 88

So the dockerfile that App Engine uses to generate a container for a Django app is as following:

FROM gcr.io/google-appengine/python@sha256:c6480acd38ca4605e0b83f5196ab6fe8a8b59a0288a7b8216c42dbc45b5de8f6

LABEL python_version=python3.7

RUN virtualenv --no-download /env -p python3.7

ENV VIRTUAL_ENV /env

ENV PATH /env/bin:$PATH

ADD requirements.txt /app/

RUN pip install -r requirements.txt

ADD . /app/

CMD exec gunicorn -b :$PORT myteam.wsgi

My question is then why don't we see the command :

python manage.py runserver

And instead we see : gunicorn -b :$PORT myteam.wsgi

Does it imply that the gunicorn command runs the server ?

1 Answers

App Engine deployments often handle heavy traffic from users across the world. When you run python manage.py runserver in a django application, you are serving the application on the local machine for development purposes.

In theory you could use this as the container command in your App Engine app, but this is not its intended purpose and never recommended:

Now’s a good time to note: don’t use this server in anything resembling a production environment. It’s intended only for use while developing...

App Engine deployments demand a more robust web server software, and for Python applications that would involve using a WSGI server (such as Gunicorn) to serve the application.

Since Django can be easily integrated with Gunicorn, all you need is the command you see in the App Engine sample Dockerfile.

Related