1๐
1) Create a file called Procfile (no extension) in your project root with the following inside:
web: gunicorn APP_NAME.wsgi
(replace APP_NAME with your appโs name).
2) Pip install gunicorn
and dj-database-url
3) In your virtual env terminal, run pip freeze > requirements.txt
in your project root (do this every time you pip install
any new packages).
4) In your production settings file, add the following to make your database work on heroku:
import dj_database_url
DATABASES['default'] = dj_database_url.config()
Note: This will cause errors in your local environment, so make sure you have a prod.py
settings file as well (ask if you need an explanation).
5) Add heroku to your git settings via git remote add heroku git@heroku.com:HEROKU_APP_NAME.git
(replace HEROKU_APP_NAME with your Heroku app name).
6) Once you do git add --all
, git commit -m "SOME MESSAGE HERE"
and git push
, you can do git push heroku master
.