Sign up for a free Heroku account
After you install the CLI, run the
heroku login command. You’ll be prompted to enter any key to go to your web browser to complete login. The CLI will then log you in automatically.
Fork & clone this repository on github. Then navigate into the folder you just cloned with
cd flying-dog-beers and explore the files with
ls -l. The repo includes the following four essential files; these have already been prepared for you.
You can run the app locally, just to confirm that it’s working properly, with the command
python app.py. If you haven’t already done so, you’ll want to install Plotly Dash with the package manager of your choice, like
pip install dash or
conda install dash. Remember, every time you make a change you’ll want to save & run, just to check your work.
It can also be a good idea to use a virtual environment like venv or conda env, especially for more complex projects involving a lot of dependencies. But it’s not strictly necessary for this tutorial.
Checkout your git remote using
git remote -v. You should see the remote repository called
origin listed something like this:
origin email@example.com:austinlasseter/flying-dog-beers.git (fetch)origin firstname.lastname@example.org:austinlasseter/flying-dog-beers.git (push)
Initialize Heroku and add files to the Heroku git repository (this is different from Github) as follows:
heroku create some-name-here
git add .
git commit -m 'some commit message here'
git push heroku master
When you run
git push heroku master for the first time, all of the libraries will install (so the commit take a minute).
Once git is done pushing to Heroku, you can check your remote repositories using the same command as before:
git remote -v. You should now see both
origin (that’s Github) and
heroku listed as remotes, something like this:
heroku https://git.heroku.com/polar-everglades-19622.git (fetch)heroku https://git.heroku.com/polar-everglades-19622.git (push)origin email@example.com:austinlasseter/flying-dog-beers.git (fetch)origin firstname.lastname@example.org:austinlasseter/flying-dog-beers.git (push)
You can now view the finished app on the web with the command
heroku open. Here’s a link to my version of the finished app; yours should look similar.
Every time you make additional changes to the files, you’ll need to push those changes to Heroku with
git push heroku master. However, you’ll also want to push those same changes to github with
git push origin master.