A Cookiecutter template we use for Django projects at transcode.
What makes this cookiecutter template special?
- Fully tested cookiecutter template (Python 2, 3 and PyPy)
- The Django project can be build as a Python package, which simplifies distribution and installation
- Comes with a simple, modern Django app template
- Up-to-date requirements
- Configured to work with PostgreSQL, including easy creation of user and database
- All Django settings can be easily configured for different environments like
dev
orprod
using environment variables - Django third-party packages like django-braces, django-crispy-forms, django-debug-toolbar, django-devserver, django-model-utils and django-template-debug are already installed
- IPython for a powerfull Python and Django shell
- A set of basic Django HTML templates is included
- Includes a
Makefile
which helps with all the every-day tasks - pdb++ and Werkzeug for better debugging
- An extensive collection of lint tools for Python code, documentation and packaging
- Prepared for testing with pytest-django, including libraries like faker, factory_boy, fauxfactory and freezegun as well as a few useful pytest fixtures
- Measuring of test coverage for Python code and Django templates
- A set of tox environments to test the project with different Python versions and all lint tools
- pg-activity and Glances to monitor your development machine
- bumpversion makes it easy to increment the version number in several files at once with a single command
- Includes configurations for different email backends (SMTP, Mailgun)
- Prepared for reporting to a Sentry server
- Comes with a project documentation built with Sphinx using the alabaster theme, including pages for installation, settings, releases, deployment and contributing
- Django 1.8
- Initializr 4.0 HTML5 template
- django-braces
- django-crispy-forms
- django-grappelli
- django-model-utils
- psycopg2
- Sphinx
- bumpversion
- django-debug-toolbar
- django-devserver
- django-template-debug
- Glances
- IPython
- pdb++
- pg_activity
- coverage
- django-coverage-plugin
- factory_boy
- faker
- fauxfactory
- freezegun
- pytest
- pytest-django
- pytest-factoryboy
- pytest-faker
- tox
- tox-pyenv
First you have to install Cookiecutter:
$ pip install cookiecutter
After that change to the directory where you want to create a your new Django project in. Then set up the project using this cookiecutter template like so:
$ cookiecutter gh:transcode-de/cookiecutter-django-project
You have to answer a few questions to configure the project. The defaults are good for transcode projects - surely you want to override them for yours.
Change into your newly created project directory and execute the following commands to get started.
You should create a new virtualenv for the project:
$ mkvirtualenv -a `pwd` my-project
Install the packages for development:
$ make develop
Then create the new PostgreSQL user and database:
$ make create-db-user $ make create-db
The next step is to create the Django app(s) you want for the project. Just run
the startapp
task to create new Django app(s):
$ make startapp
Now create the database tables:
$ make migrate
And create a new Django superuser:
$ envdir envs/dev/ python manage.py createsuperuser
Finally start the development webserver:
$ make runserver
To see the other targets available in the Makefile
simply run:
$ make
Detailed installation instructions can be found in your new project under
docs/installation.rst
.
This project is licensed under the New BSD License. See LICENSE
for the
full license.