Flask

Flask Official Website

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.

  1. Create an account
  2. Install Heroku CLI: https://devcenter.heroku.com/articles/heroku-cli
  3. Run $ heroku login and sign into your account
  4. Install dependency: $ pip3 install gunicorn
  5. freeze your requirements: $ pip3 freeze requirements.txt
  6. 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 named app, then we tell is what to call it :app)
  7. initialize empty git repository:

    • $ git init,
    • $ git add . (Adds everything in directory)
    • $ git commit -m "initial commit
  8. Create heroku app: $ heroku create flaskdemo (Name must be lower case, can’t use dashes or numbers)

  9. View where application is being pushed to: $ git remote -v
  10. Push everything to heroku: $ git push heroku master

    Journal