Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacebrowning/template-django
My template for new Django projects.
https://github.com/jacebrowning/template-django
cookiecutter django django-rest-framework hacktoberfest heroku poetry python
Last synced: 2 months ago
JSON representation
My template for new Django projects.
- Host: GitHub
- URL: https://github.com/jacebrowning/template-django
- Owner: jacebrowning
- License: unlicense
- Created: 2017-02-15T20:29:12.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T21:37:05.000Z (9 months ago)
- Last Synced: 2024-05-01T21:13:13.763Z (8 months ago)
- Topics: cookiecutter, django, django-rest-framework, hacktoberfest, heroku, poetry, python
- Language: Python
- Homepage:
- Size: 755 KB
- Stars: 10
- Watchers: 3
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README
# Jace's Django Template
This is a [cookiecutter](https://github.com/audreyr/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](https://github.com/jacebrowning/template-django-demo)
[![Build Status](https://img.shields.io/travis/com/jacebrowning/template-django.svg)](https://app.travis-ci.com/github/jacebrowning/template-django)
## Features* Settings broken out into local, staging, and production
* API using [Django REST Framework](http://www.django-rest-framework.org/)
* Unit and integration testing using `pytest`, `pytest-describe`, and `pytest-expecter`
* End-to-end testing using [Splinter](https://splinter.readthedocs.io/)
* `Makefile` for automating common development tasks:
- Installing dependencies into a virtual environment using `poetry`
- Generate superuser and other fixtures to seed the database
- Running tests against the backend and frontend
- Running type checks (`mypy`) and linters (`pylint`)
* Continuous Integration via [CircleCI](https://circleci.com/docs/2.0/)
* Continuous Delivery via [Heroku](https://www.heroku.com/flow)If you are instead looking for a [Python library](https://caremad.io/posts/2013/07/setup-vs-requirement/) template, check out [jacebrowning/template-python](https://github.com/jacebrowning/template-python).
## Usage
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
$ make format
```## Deploying
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 | Purpose |
| --- | --- | --- |
| `DISABLE_COLLECTSTATIC` | `true` | Disable automatic static files collection since `bin/post_compile` already does that |
| `HEROKU_APP_NAME` | `[staging-]` | 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` | `` | 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](https://github.com/kennethreitz/dj-database-url#url-schema) |
| `BUGSNAG_API_KEY` | `` | Optional API key to enable the Bugsnag integration |
| `MAX_REQUESTS[_JITTER]` | `` | Optional values to help deal with [memory leaks](https://docs.gunicorn.org/en/stable/settings.html?highlight=memory%20leaks#max-requests) |## Updates
Run the update tool, which is generated inside each project:
```
$ bin/update
```