Skip to content

oliverandrich/django-project-starter

Repository files navigation

django-project-starter

Django startproject template for Django projects with batteries included and nice tooling.

I took the inspiration from Jeff Triplett's django-startproject and created my own starter for a fresh django project. It includes the batteries I use regularly. 🤷‍♂️

The template is also inspired by Carlton Gibson's Post The Single Folder Django Project Layout. It uses the single folder layout as a start as I always run in the same situation Carlton describes in his post. If you have to split the project into several apps, you can always call python manage.py startapp later on.

Out of the box SQLite is configured, but you can easily activate MySQL or Postgres support.

Features

Development tools

  • django-stubs
  • django-browser-reload
  • model-bakery & faker for smarter testing fixtures
  • pre-commit setup inspired by Boost your Django DX
  • sane ruff configuration
  • uv for dependency management
  • just for project management and maintenance

Install

# Pull the template from Codeberg...
$ uv run --with=django django-admin startproject \
    --extension=ini,py,toml,sh \
    --template=https://github.com/oliverandrich/django-project-starter/archive/main.zip \
    example_project

# Setup the project
$ just boostrap

# Start dev server
$ just runserver

Usage

# Upgrade/install all dependencies defined in pyproject.toml
just upgrade

# Run database migrations
just migrate

# Create database migrations
just makemigrations

# Start debugserver
just runserver
# or
just debugserver

# Start the interactive django shell
just shell

# Start manage.py for all cases not covered by other commands
just manage ...

# Run pre-commit rules on all files
just lint

# Run test suite
just test

# run test suite with code coverage analysis
just coverage

Environemt Variables for Docker and your .env file

Or when run as a 12-Factor application.

Environment Variable Default Location
ALLOWED_HOSTS [] settings.py
CACHE_URL "locmem://" settings.py
CSRF_TRUSTED_ORIGINS [] settings.py
DATABASE_URL "sqlite:///db.sqlite3" settings.py
DEBUG False settings.py
EMAIL_URL "console:" settings.py
INTERNAL_IPS [] settings.py
LANGUAGE_CODE "EN" settings.py
SECRET_KEY settings.py
TAILWIND_CLI_PATH "~/.local/bin" settings.py
TIME_ZONE "UTC" settings.py
GRANIAN_WORKERS 1 entrypoint.sh
GRANIAN_THREADS 1 entrypoint.sh
GRANIAN_* see https://github.com/emmett-framework/granian entrypoint.sh

Docker and docker-compose

The docker/Dockerfile uses a multi stage process to embrace caching for building the container images.

License

This software is licensed under MIT license.

About

Django startproject template for Django projects with batteries included and nice tooling.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published