This repository is for Django project boilerplate. It contains development and production ready environment.
This template offers nice and easy to use Django project.
It has separate settings for deployment and production environments. It contains important additions for developers like django debug toolbar
or whitenoise
.
It is easy to run and deploy thanks to docker
and docker-compose
It uses PostgreSQL database in production and SQLite in development out of the box.
For deployment it uses gunicorn
WSGI Server in Docker
- Python 3.8
- Pipenv
- Docker + docker compose -> For fast development and deployment
Note: Core settings like INSTALLED_APPS etc. are inside
core/settings/shared.py
Clone or download .zip file of this repository. Then You need to install and activate virtual environment:
- Run
pipenv install --dev
- Then
pipenv shell
Default settings for this project are development settings. Those can be edited in file core/settings/development.py
To run Django project with those settings run: python manage.py runserver
Production (Running Django with production settings, to deploy this application look at Running with docker)
Note: WSGI and ASGI applications will use this settings, to change it edit
asgi.py
orwsgi.py
and changeDJANGO_SETTINGS_MODULE
Production settings are using environment variables, to edit this behaviour edit the file core/settings/development.py
To run Django project with those settings run: python manage.py runserver --settings=core.settings.production
Firstly change environment variables inside application.env
and database.env
Run and build docker container docker-compose up -d --build
Now you will have Django application on port 8000. Open browser and type: localhost:8000
- Whitenoise - Serving static files
- Django Debug Toolbar - Toolbar for debug purposes