- a free Heroku account.
- Python3.6.
- pipenv installed locally. If not, install by
pip install pipenv
. - Postgresql installed locally. If not, install by
brew install postgresql
.
Install Heroku CLI from Getting Started on Heroku with Python | Heroku Dev Center.
Authenticate your Heroku account:
heroku login
Clone sample project and move to the directory of the app:
git clone https://github.com/heroku/python-getting-started.git
cd python-getting-started
heroku create
You can confirm that a git remote heroku
is created by
git remote
# heroku
# origin
Deploy code by
git push heroku master
Ensure that at least one instance is running:
heroku ps:scale web=1
Visit the app by
heroku open
You can view logs by
heroku logs --tail
You can check how many diynos are running by
heroku ps
Scale the number of web dynos to zero:
heroku ps:scale web=0
You will get an error message when you open the web page.
Scale it up again:
heroku ps:scale web=1