Lab 8: Introduction to
Web Applications
Web Applications
Table of Contents
Now, we'll take the repl from Step 4, the one where we added a navbar using Bootstrap, and we'll deploy it to Heroku.
At the end of Part 4, you put a link to your Repl in the README.md file of your lab08-name1-name2 repo.
Now , go back to that README.md, click on the link to the repl for Part 4, and fork it.
We'll use this forked copy for Part 6.
Add a link to this repl in the README.md under a heading # Part 6
To deploy this app to Heroku, you'll follow the same steps as in Part 5, staring with Step 4.
Here's a summary:
Install the Heroku CLI into your repl, by typing heroku -v in the Shell window.
Login to Heroku using heroku login -i
Choose an app name for Heroku: we suggest a name such as:
lab08-name1-name2
spis2022-lab08-xy (where xy are the initials of the first names of the pair partners)
spis2022-lab08-xyz (where xyz are the initials of the first names of the three members of the trio)
In the shell window, type this (where app-name is the name you chose above)
git init
heroku create app-name
Install gunicorn by typing this in the Shell window:
python3 -m poetry add gunicorn
Add a Procfile with these contents:
web: gunicorn main:app --log-file=-
Add an app.json file with these contents:
{
"buildpacks": [
{ "url": "https://github.com/moneymeets/python-poetry-buildpack.git"},
{ "url": "heroku/python" }
]
}
In pyproject.toml, change the Locate these two lines:
[tool.poetry.dependencies]
python = ">=3.8.0,<3.9"
Change them to this:
[tool.poetry.dependencies]
python = "3.10.6"
Make a commit (Making commits to repo via repl.it)
Type git remote -v to make sure there's a remote hooked up to the repl; you should see one called heroku
(if not, there aretroubleshooting instructions in Part 5)
Type git push heroku main to deploy your application.
Open the URL shown in a browser to test your deployment.
If not, see the details in Part 5 for hints on how to debug.
In your lab08-name1-name2 repo, in the README.md, add a heading
# Part 6
And under that, put a link to your repl for the Hello World app that you deployed to Heroku, along with the URL of the deployed app on Heroku.
And you are finished with lab08!
Granted: there is a lot of tedious work getting started with building a web app.
However, once you've gotten past these stages, there are so many very cool things you can build.
And the cool part about building a web app is that you can share it with anyone in the world, and show off your work!