Skip to content

Repository files navigation

Docker Sample — Django + Docker

Docker Python Django

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.

Stack

  • Python 3.13
  • Django 6.0
  • SQLite (default Django dev database)
  • Docker & Docker Compose

Project layout

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

Run with Docker

git clone https://github.com/sahebi-code/docker-sample.git
cd docker-sample
docker compose up --build

The app will be available at http://localhost:8000.

Note: the command in docker-compose.yml currently reads python/code/manage.py runserver 0.0.0.0:8000 — missing spaces will cause docker compose up to fail. It should read:

command: python manage.py runserver 0.0.0.0:8000

The version: '5.0.1' key can also be removed — modern Docker Compose ignores it, and it isn't a valid Compose file version.

Run without Docker

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 runserver

Visit http://localhost:8000.

What's here

  • pages app 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.

Known issues

  • docker-compose.yml has a malformed command (see note above)
  • db.sqlite3 and .idea/ are committed to the repo; both should be removed and added to .gitignore
  • DEBUG = True and a hardcoded SECRET_KEY are left at Django's default scaffolded values in config/settings.py — fine for local use, not for deployment

License

No license file is currently included.

About

Minimal Django project containerized with Docker and Docker Compose — a reference setup for running Django in a container.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages