A lightweight Django template ready for Heroku
Loosely inspired by the beloved django-cookiecutter, ponee is a lightweight Django template without too many assumptions.
- Custom user
- 12-Factor based setting via django-environ
- Requirements for production and development
- Django REST framework
- Django CORS headers
- Security settings
- Heroku support with django-heroku
- Testing and coverage
Ponee uses PostgreSQL for development.
Prepare a virtual environment in a folder of choice and install Django:
mkdir mynewproject && cd $_
python3 -m venv venv
source venv/bin/activate
pip install django
Then install the template:
django-admin startproject \
--template https://github.com/valentinogagliardi/ponee/archive/master.zip \
--name=Procfile \
--extension=py,example yournewproject .
Install the dependencies:
pip install -r ./requirements/dev.txt
Copy the example env to .env
and adjust the variables as needed:
cp .env.example .env
Before starting off make the migrations for the custom User:
python manage.py makemigrations
python manage.py migrate
and your good to run the development server!
Before starting off you should have a Git repo in your project folder:
git init
Login on Heroku with the Heroku CLI:
heroku login
Create a new app (you can change its name later):
heroku apps:create --region eu
Copy .env.prod.example
to .env.prod
and adjust the variables as needed. Now run:
python configure_prod_envs.py
The script reads all the env variables from .env.prod
and runs heroku config:set
for each.
Finally make a commit and push the code:
git add .
git commit -m "First commit"
git push heroku master
Running tests:
python manage.py test
Running tests with coverage:
coverage run --omit='*/venv/*' manage.py test
coverage report