Last active
July 28, 2019 05:19
-
-
Save CleverProgrammer/1344d65e4bce640d2e17096c4390f7a4 to your computer and use it in GitHub Desktop.
How to Host a Django App on Heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install gunicorn | |
pip install django-heroku | |
pip freeze > requirements.txt | |
# login to your heroku | |
heroku login | |
# create new app if one doesn't yet exist | |
heroku create | |
# create a new postgres database for your app | |
heroku addons:create heroku-postgresql:hobby-dev | |
# migrate your database to the heroku app | |
heroku run python manage.py migrate | |
# before you do this, make sure to add your SECRET_KEY to your env variables in your heroku app settings | |
git add . | |
git commit -m "Ready to heroku this sucker in the face." | |
git push heroku master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: gunicorn project_name.wsgi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import django_heroku | |
# All the way at the bottom of the file | |
# ... | |
django_heroku.settings(locals()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated:
I did deploy a bunch of projects on heroku. I think this is the real approach.