Dockerizing Django Polling Application


Github link for this project
I recently tried dockerizing a Django project and wanted to share some of the challenges I faced along the way. If you’re starting out with Docker and Django, maybe this will help you feel less alone!
1. Not knowing the Django commands
One of the problem I faced was not knowing which django commands are to be placed inside the docker container. Even though I have experience of creating small Django application but to know what to put inside a container was a bit of new challenge and experience.
2. No idea about Gunicorn and wsgi
While following a certain Dockerfile I came across the command CMD ["gunicorn", "portfolio.wsgi:application", "--bind", "0.0.0.0:8000"] which was new to me so I had to read and figure out about it I and got to know that it is a production grade server.
3. Application Unaccessible
Due to always practicing django on local server I had no Idea that you have to Allow the host to access application. Which is a simple task you just have to update the Allowed_host field present in the django projects settings.py .
Honestly, I spent more time figuring out Docker than actually coding my app at first3. There’s a learning curve, but it gets easier with practice!
Subscribe to my newsletter
Read articles from Subrat Yadav directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
