In this blog I am going take you through a basic tutorial on how to create your first flask app from scratch.
Prerequisites
- PIP (Python Package Manager): https://pip.pypa.io/en/stable/
Step 1
- Install virtual enviorments, virtual enviorments allow you to isolate libaries and scripts that are installed for individual projects.
pip3 install virtualenv
*use this command in your terminal
Step 2
Create and activate your virtual enviorment
MacOS:
python3 -m venv env
source env/bin/activate
Windows:
py -m venv env
./env/Scripts/activate
- use this command in your terminal
Step 3
Install Flask using pip, flask is a lightweight python web framework that we will be using for this web application
pip3 install flask
- use this command in your terminal
Step 4
Create a ‘flaskapp.py’ file and define a url endpoint