-
Notifications
You must be signed in to change notification settings - Fork 0
Python Django + PostgreSQL
You could use this example app as a base for your new project or as a guide to Dockerize your existing Django app.
The example app is minimal but it wires up a number of things you might use in a real world Django app, but at the same time it's not loaded up with a million personal opinions.
This app is using Django 5.1.6 and Python 3.13.2. The screenshot doesn't get updated every time I bump the versions:
Most guides get dockerising your Django project wrong in three ways:
This command is not intended is not intended ot be used in production. You lose out on a lot of performance. To solve this use Gunicorn.
Many guides leave you with a broken product, where the CSS isn't loading in.
Django admin doesn't work most of the time with CSS and other static asses not loading.
Django is an opinionated framework and I've added a few extra opinions. Here's a few (but not all) note worthy additions and changes.
- Packages and extensions:
- gunicorn for an app server in both development and production.
- whitenoise for serving static files.
- django-debug-toolbar for displaying info about a request.
Install the packages.
pipenv install gunicorn whitenoiseInstall development dependencies.
pipenv install django-debug-toolbar --devSee the documentation for White Noise
pipenv pip freeze > requirements.txtA list of resources that I found helpful.