Skip to content

b-ggs/django-template

Repository files navigation

django-template

A template project with:

  • Python 3.12
  • Django 4.2 LTS
  • Postgres 16

Features

  • Development inside Docker
  • Django settings such as SECRET_KEY and ALLOWED_HOSTS are configured with environment variables out of the box
  • Can be easily deployed to Heroku or Dokku
  • Static files are served with Whitenoise
  • Errors can be sent to Sentry or GlitchTip

Making it your own

Click on the "Use this template" button on GitHub and create a new repository.

Clone your new repository.

Ensure that you have GNU or BSD Make installed.

Run the rename Makefile target to replace all instances of django_template and django-template with your project's name in snake_case and kebab-case, respectively.

make rename PROJECT_NAME=my_project_name_with_underscores

Running the project locally

Ensure that you have the following installed:

  • GNU or BSD Make
  • Docker
  • Docker Compose

Build your development environment.

make build

Run your development environment.

make start

Open an interactive shell into the Docker container that contains the Django project.

make sh

Several bash aliases exist in the Django Docker container such as:

  • dj: python3 manage.py
  • djrun: python3 manage.py runserver 0:8000
  • djtest: python3 manage.py test --settings=django_template.settings.test -v=2
  • djtestkeepdb: python3 manage.py test --settings=django_template.settings.test -v=2 --keepdb

Run all outstanding migrations.

# Inside the Django Docker container
dj migrate

Spin up the development server.

# Inside the Django Docker container
djrun

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

Check out the Makefile for other useful commands.

Deploying to a managed or self-hosted service

About

🔧 starter django 4.2 template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •