Presentation and supporting materials for my Intro to Flask Workshop
Created and presented by Jeremie Bornais
View slides here.
- Another helpful tutorial can be found here.
- Learn how to host your Flask app on Google Cloud for free here,
- Documentation for Flask, Flask-SQLAlchemy
- A recording of this workshop can be found here.
- Make sure you have Python and pip installed
- Clone this git repository
git clone https://github.com/jere-mie/flask-workshop
- Run
pip install -r requirements.txt
in your terminal, powershell, or command prompt. (Note, you might need to usepip3
instead ofpip
) - Copy the sample
.env
file and edit it as you see fitcp example.env .env
- Run
python3 app.py
(note, you may need to usepy
orpython
instead ofpython3
) - Head to http://127.0.0.1:5000/ to preview the web app!
This is the main Flask app, containing all of the routes and backend logic.
This contains the secret key and port of the Flask app. Note that one is not provided in this repository. This is because you should always add your .env
file to your .gitignore
, as you don't want others to know your secret key or other sensitive info. Note that if you want to know how to format your .env
file, check out the example.env
file.
This file contains all of the files and folders you do not want added to the git repository. Generally you include things like .env
, site.db
(SQLite database), venv
folder, and __pycache__
folder.
This folder contains all static files you want to use in your Flask app. This would include css files, images, javascript files, etc.
This folder contains all of your HTML templates. Usually you use a layout.html for things like metadata and a navbar, and then you create other templates that extend this template.