Make sure you have your dependencies in your requirements file. (The arrow is a bash thing, it may not work on windows. We want the output from pip freeze
into requirements.txt
).
pip freeze > ./requirements.txt
pip install django-heroku
pip freeze > ./requirements.txt
Add these lines to the end of settings.py:
import django_heroku
django_heroku.settings(locals())
in settings.py add:
STATIC_ROOT = 'static'
or similar (I didn't try to serve any static files).
Install gunicorn
to serve the app.
pip install gunicorn
pip freeze > ./requirements.txt
Create a file in the root directory called Procfile
:
web: gunicorn mysite.wsgi
Replace mysite
with the name of your main app.
Follow heroku's instructions for installing the commandline interface, then:
heroku login
heroku git:remote -a heroku_app_name
git push heroku master -u
heroku run ./manage.py migrate
heroku run ./manage.py createsuperuser
heroku logs