Story on how to use Docker and Docker Compose and deploy a Django app to Heroku
This story setup a basic Django project using Docker and Docker Compose and then deploy said application to Heroku.
I'm working on an Ubuntu 20.04, Django 3.1.3.
This will not be a complete from zero to hero tutorial, rather I'll assume that you know enough basic Django and Docker to be able to apply the shown yourself.
Setup Django in Docker
Create requirements file
In a fresh directory, lets call it "lazinda", create a file named
requirements.txt and add just one line:
We are telling PIP that we want from 3.2.8 until 3.3; This way, we will include any security patches that might come out but not any updates that changes the API.
Create a file called just
which will hold our definition of our Docker image. Add the following to the Dockerfile:
FROM python:3.10-alpine3.14 LABEL maintainer="myself" ENV PYTHONUNBUFFERED 1 COPY ./requirements.txt /requirements.txt COPY ./app /app