A To Do list application created using flask-sqlalchemy and bootstrap
See a live version deployed on heroku here
Clone the project
git clone https://github.com/vaylon-fernandes/flask_weather_app.git
Go to the project directory
cd flask_to_do_list
Create a virtual enviroment. Read more
venv <environment name>
apt-get install python3-venv
On Linux:
source venv/bin/activate
On Windows:
venv\Scripts\activate
pip install -r requirements.txt
- Firstly Generate a
Secret Key
. This is required by the Flask Sessions. Do read the section on How to generate good secret keys in the flask documentation under sessions here - Next export the secret key to Enviroment Variables using one of the following commands based on your terminal Bash command
export SECRET_KEY=<your secret key>
CMD command
set SECRET_KEY=<your secret key>
Powershell command
$env:SECRET_KEY=<your secret key>
The enviroment variables are then read using the os.environ object
To run the app, first export the FLASK_APP
variable, using one of the following commands based on your terminal
Bash command
export FLASK_APP=main
CMD command
set FLASK_APP=main
Powershell command
$env:FLASK_APP = "hello"
flask run
This creates a simple server, go to http://127.0.0.1:5000/
in your browser to view the site
To run the server in Debug mode, export the FLAK_ENV
variable befor running flask run
Bash command
export FLASK_ENV=development
CMD command
set FLASK_ENV=development
Powershell command
$env:FLASK_ENV="development"
Run command
flask run
Read more here: https://flask.palletsprojects.com/en/2.0.x/quickstart/#debug-mode
- There's a good explanation of this given in this repo
- Another good read on the topic is on the Real Python website
- Freecodecamp video - https://youtu.be/Z1RJmh_OqeA
- Tech With Tim youtube video - https://youtu.be/dam0GPOAvVI
- Flask Docs - https://flask.palletsprojects.com/en/2.0.x/
- Flask SQLAlchemy - https://flask-sqlalchemy.palletsprojects.com/en/2.x/
- Flask login docs - https://flask-login.readthedocs.io/en/latest/