Skip to main content

Creating the Project from Scratch

Create project directory

Create a directory for your project, call it Devii_Python_Tutorial; if you are using VS Code open a new window (Ctrl+Shift+N) then open a terminal (Ctrl+`). If you are not using VS Code, on Windows, you can use Command Prompt or PowerShell, while on Linux or macOS, you can use the terminal, then navigate to where you would like to create the project directory

cd path/to/parent/directory

Create a new directory for your project:

mkdir project_name

Navigate to the directory you just created:

cd project_name

To open this directory in VS Code, use:

code -r .

Create Python Virtual Environment

Next, create a python virtual environment, this will isolate project dependencies and avoid conflicts with other projects.

MacOS and Linux

Run the following command to create a virtual environment named "venv":

python3 -m venv venv

Run this command to activate your venv:

source venv/bin/activate

Windows

Run the following command to create a virtual environment named "venv":

python -m venv venv

Run this command to activate your venv:

venv\Scripts\activate

Create Requirements File

A requirements file will be used to install all the dependencies (modules or packages) for this project. If using VS Code, open the Explorer on the left side of the screen and create a new file using the new file icon and name the file 'requirements.txt'

VS Code New File

inside this file add:

flask
requests
jinja2
pyjwt

Run the command to install dependencies:

pip install -r requirements.txt

Next you will need to create the Authorization module, auth.py