A minimal Django project set up to run in Docker. Built as a reference for containerizing a Django app from scratch: a Dockerfile for the image, docker-compose.yml to run it, and a bare Django project (config) with one app (pages) serving a homepage.
- Python 3.13
- Django 6.0
- SQLite (default Django dev database)
- Docker & Docker Compose
config/ # Django project settings, root URLconf, WSGI/ASGI entry points
pages/ # Django app — serves the homepage view
Dockerfile # Image definition
docker-compose.yml
requirements.txt
manage.py
git clone https://github.com/sahebi-code/docker-sample.git
cd docker-sample
docker compose up --buildThe app will be available at http://localhost:8000.
Note: the
commandindocker-compose.ymlcurrently readspython/code/manage.py runserver 0.0.0.0:8000— missing spaces will causedocker compose upto fail. It should read:command: python manage.py runserver 0.0.0.0:8000The
version: '5.0.1'key can also be removed — modern Docker Compose ignores it, and it isn't a valid Compose file version.
git clone https://github.com/sahebi-code/docker-sample.git
cd docker-sample
python -m venv venv
source venv/bin/activate # venv\Scripts\activate on Windows
pip install -r requirements.txt
python manage.py runserverVisit http://localhost:8000.
pagesapp with a single view returning a "Hello, world" response at/- Django admin enabled at
/admin/ - SQLite as the configured database (
db.sqlite3)
This is a starting point rather than a full application — no custom models, auth, or API endpoints yet.
docker-compose.ymlhas a malformedcommand(see note above)db.sqlite3and.idea/are committed to the repo; both should be removed and added to.gitignoreDEBUG = Trueand a hardcodedSECRET_KEYare left at Django's default scaffolded values inconfig/settings.py— fine for local use, not for deployment
No license file is currently included.