Python Heroku Deployment
Steps to create a postgres database and deply a Python app to Heroku
Install guinicorn locally
pipenv install gunicorn
# or
pip install gunicornInstall Heroku CLI
Login via CLI
heroku loginCreate app
heroku create appnameCreate database
heroku addons:create heroku-postgresql:hobby-dev --app appnameGet URI
heroku config --app appname
# Add to your appCreate Procfile
touch Procfile
# Add this
web: gunicorn app:appCreate requirements.txt
pip freeze > requirements.txtCreate runtime.txt
touch runtime.txt
# Add this
python-3.7.2Deploy with Git
git init
git add . && git commit -m 'Deploy'
heroku git:remote -a appname
git push heroku masterAdd table to remote database
heroku run python>>> from app import db
>>> db.create_all()
>>> exit()Visit app
heroku openBacklinks
Knowledge Base
- [[python-deploy-to-heroku]]