- If you don't have git installed, follow this Tutorial and come back here.
- Make a copy of your project or use a seperate git branch.
- Make sure your virtual environment is activated.
- Add your dependencies to requirements.txt by typing in the terminal,
- Check
requirements.txt
in this repo for required dependencies.
pip freeze > requirements.txt
- Create a
Procfile
and paste the following
web: gunicorn myproject.wsgi
- Add this in settings.py
# Import django-heroku
import django_heroku
# Add the following line at bottom
django_heroku.settings(locals())
Add Static root
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
-
Run the following commands in the terminal
heroku login
heroku git:clone -a appname
git add .
git commit -am "first commit"
git push heroku master
heroku open
heroku run python manage.py migrate
- Modify the following in
settings.py
DEBUG = False
ALLOWED_HOSTS = ['your_app_name.herokuapp.com', 'localhost', '127.0.0.1']
- If you make edits, then run the following commands,
git add .
git commit -am "edit"
git push heroku master