Presentation and supporting materials for my WinHacks 2024 Intro to Flask Workshop
Created and presented by Jeremie Bornais
View slides here.
Another helpful tutorial 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 flask flask-sqlalchemy
in your terminal, powershell, or command prompt. (Note, you might need to usepip3
instead ofpip
) - Copy the sample config file and edit it as you see fit
cp example_config.json config.json
- Run
python3 app.py
(note, you may need to usepy
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 of the Flask app. Note that one is not provided in this repository. This is because you should always add your secrets.json to your .gitignore, as you don't want others to know your secret key. Note that if you want to know how to format your secrets.json, check out the secrets_example.json file.
This file contains all of the files and folders you do not want added to the git repository. Generally you include things like config.json, 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