Note: The master branch contains a template for Django 2.1. If you wish to use a previous version, please check out the appropriate branch:
- django-2.0 branch
- django-1.10 branch
- django-1.9 branch
- django-1.8 branch
- django-1.7 branch
- django-1.6 branch
This Django project template sets up a new project with the following features:
- PostgreSQL for database connections (using
pyscopg2-binary
). - Sensible time zone and defaults for Brisbane, Australia.
django-environ
for settings with site-specific settings picked up in a.env
file- Enables the django-debug-toolbar app for development
- Flat project structure (no sub-directory called
project_name
). - Serves static and media files when using the development server.
- Password validation is enabled for Django's auth system.
Note: This will install the latest stable version of Django. If this is undesirable, manually download requirements.txt and edit accordingly.
-
Create a new virtualenv and activate it.
-
Install the requirements:
$ pip install -r https://raw.github.com/sjkingo/django-project-template/master/requirements.txt
-
Create a new project using the template:
$ export PROJECT_NAME=foo $ django-admin.py startproject --template https://github.com/sjkingo/django-project-template/archive/master.zip $PROJECT_NAME
-
Run the following to clean up the template directory and update
requirements.txt
:$ cd $PROJECT_NAME $ pip freeze > requirements.txt $ rm -f README.md $ chmod +x manage.py
-
Create a
$PROJECT_NAME/.env
file in with the following:DEBUG=True SECRET_KEY=<secret_key_here> DATABASE_URL=psql://<user>[:<pass>]@[<host>]/<db>
It is based on the project_template
shipped with stable/2.1
.