Powered by Cookiecutter is a template for jumpstarting a production-ready Django project.
- For Django 1.11 and Python 3.6.
- Pipenv is used for dependency and virtualenv management.
- 12-factor based settings via django-environ.
- Secure by default. SSL is the way to go.
- Registration via django-allauth.
- Comes with custom user model ready to go.
- Whitenoise is used for serving static files.
- Sentry can be added for error logging.
- pytest is supported via pytest-django and with some extra candy provided by pytest-sugar
- jQuery 3, Font Awesome 4.7, Bootstrap 4 and intercooler.js are included by the default template.
- SASS support is provided by libsass and django-libsass.
- MIT License is the default license.
$ pip install cookiecutter
$ cookiecutter https://github.com/oliverandrich/cookiecutter-django-template
$ cd your_new_project
$ pipenv install --three --dev
$ pipenv shell
You will be prompted for some values. Provide them, then a Django project is created for you. Enjoy!
Yes, I love to group my apps inside the project folder inside a folder named apps
.
$ tree -a project_name/
project_name/
├── .coveragerc
├── .env
├── .gitignore
├── LICENSE
├── Pipfile
├── Pipfile.lock
├── README.md
├── manage.py
├── project_name
│ ├── __init__.py
│ ├── apps
│ │ ├── __init__.py
│ │ └── users
│ │ ├── __init__.py
│ │ ├── adapters.py
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── migrations
│ │ │ ├── 0001_initial.py
│ │ │ ├── __init__.py
│ │ ├── models.py
| | ├── templates
| | │ └── .gitkeep
│ │ ├── tests.py
│ │ └── views.py
│ ├── settings.py
│ ├── static
│ │ ├── .gitkeep
│ │ ├── css
│ │ │ ├── .gitkeep
│ │ │ └── project.scss
│ │ ├── images
│ │ │ └── .gitkeep
│ │ └── js
│ │ ├── .gitkeep
│ │ └── project.js
│ ├── templates
│ │ ├── .gitkeep
│ │ ├── 403_csrf.html
│ │ ├── 404.html
│ │ ├── 500.html
│ │ ├── base.html
│ │ └── index.html
│ ├── urls.py
│ └── wsgi.py
└── pytest.ini
The project can be fully configured using the following environment variables. Either via a .env file or environment variables in your shell.
- DJANGO_DEBUG (Default: False)
- DJANGO_SECRET_KEY (Default: None)
- DJANGO_ALLOWED_HOSTS (Default: localhost)
- DJANGO_LANGUAGE_CODE (Default: en-us)
- DJANGO_TIME_ZONE (Default: UTC)
- DATABASE_URL (Default: mysql://root@localhost/{{cookiecutter.project_slug}})
- DJANGO_STATIC_HOST (Default: '')
- DJANGO_LOG_LEVEL (Default: INFO)
- RAVEN_DSN (Default: '')
- DJANGO_ACCOUNT_ALLOW_REGISTRATION (Default: True)
DJANGO_DEBUG and DJANGO_SECRET_KEY are set to reasonable defaults by a cookiecutter post_gen_project hook. They are stored in a .env file in the fresh project directory. Besides creating the .env file, the post_gen_project hook also initializes the git repository.
This template is licensed under the MIT License. See the LICENSE file.