Course: The Ultimate Django Series: Part 3
TLDR: Why does Mosh’s docker implementation use python manage.py runserver
instead of gunicorn project.wsgi
to serve the app?
Section: Preparing for Production (2nd to last)
Lecture: 9- Serving the Application with Gunicorn
This lecture explains how gunicorn is a more light weight server than manage.py and is better for production
Section: Deployment (last)
Lecture: 13- Dockerizing the App
This lecture provides 4 files related to serving on docker with brief overview
- Dockerfile
- docker-compose.yml
- docker-entrypoint.sh
- wait-for-it.sh
My understanding is running docker-compose up
will bring up several services as specified in the docker-compose.yml including the Django app. It builds the Django app with the instructions in the Dockerfile. Then it uses the wait-for-it.sh shell script to ensure the database is ready before calling docker-entrypoint.sh. The docker-entrypoint.sh file is straightforward migrating the data base and then running a server… with python manage.py runserver 0.0.0.0:8000
.
It seems natural to me to assume we are talking about deploying to production since that’s what the section is about so…
My question is why not use gunicorn here?