Flask
Video Tutorial
freeCodeCamp.org: Learn Flask for Python - Full Tutorial
For the source code view: https://github.com/stephensamonte/FlaskIntroduction
Hosting application
https://www.heroku.com/ is a service for hosting applications on their servers rather than your own.
- Create an account
- Install Heroku CLI: https://devcenter.heroku.com/articles/heroku-cli
- Run
$ heroku login
and sign into your account - Install dependency:
$ pip3 install gunicorn
- freeze your requirements:
$ pip3 freeze requirements.txt
-
Create Procfile so heroku knows what to do with the files in the directory:
$ touch Procfile
- in Procfile add
web: gunicorn app:app
(gunicorn
creates a web server, then we tell it to make a web server for the file namedapp
, then we tell is what to call it:app
)
-
initialize empty git repository:
$ git init
,$ git add .
(Adds everything in directory)$ git commit -m "initial commit
-
Create heroku app:
$ heroku create flaskdemo
(Name must be lower case, can’t use dashes or numbers) - View where application is being pushed to:
$ git remote -v
- Push everything to heroku:
$ git push heroku master
Journal
- 2020.09.01 Created File