This is a cookiecutter template for a typical Django project following modern packaging conventions. It utilizes popular libraries alongside Make and Poetry to fully automate all development and deployment tasks. Check out the live demo: jacebrowning/template-django-demo
pytest
, pytest-describe
, and pytest-expecter
Makefile
for automating common development tasks:
poetry
mypy
) and linters (pylint
)If you are instead looking for a Python library template, check out jacebrowning/template-python.
Install cookiecutter
and generate a project:
$ pip install cookiecutter
$ cookiecutter gh:jacebrowning/template-django -f
Cookiecutter will ask you for some basic info (your name, project name, first app name, etc.) and generate a base Django project for you. Once created, run the code formatter to updates files based on your chosen names:
$ cd <github_repo>
$ make format
This template builds projects intended to be deployed on Heroku:
$ heroku buildpacks:clear
$ heroku buildpacks:add https://github.com/moneymeets/python-poetry-buildpack.git
$ heroku buildpacks:add heroku/python
You'll also need to set the following environment variables in all environments:
Name Value PurposeDISABLE_COLLECTSTATIC
true
Disable automatic static files collection since bin/post_compile
already does that HEROKU_APP_NAME
[staging-]<domain>
Infer the domain name for staging and production DJANGO_SETTINGS_MODULE
config.settings.[staging]
Specify which Django settings to use for the application SECRET_KEY
<generated>
Securely encrypt passwords in the database DATABASE_URL
postgres://USER:PASSWORD@HOST:PORT/NAME
Specify the database URL for the application to use, following the schema used by dj_database_url BUGSNAG_API_KEY
<secret>
Optional API key to enable the Bugsnag integration MAX_REQUESTS[_JITTER]
<int>
Optional values to help deal with memory leaks
Run the update tool, which is generated inside each project:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4