I love Docker as a packaging system – almost everything I push to production nowadays is as a Docker image.
Occasionally in the
#django IRC channel, the topic of “how to Docker-ise your Django service” comes up.
Dockerfile I use, taken from My Django Project Template:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
- It’s fairly minimal; it installs dependencies, calls
collectstatic, and runs. Nothing else. Everything else is the job of the platform I deploy to
- It uses
gunicornas a WSGI HTTP server, because it does exactly what I need and not much more – HTTP in one end, WSGI in the other.
uwsgihas so many command-line options I don’t actually know how to run it, and looks like it’s designed more as an all-in-one server platform with Emperor mode and its own stats server etc. etc. which is much more heavyweight than I want
- It does very little about media and staticfiles, leaving them to be handled by (usually) AWS S3 and Whitenoise, respectively
Hope this helps!