Skip to main content

Clone GitHub Repo

Below are the instructions for cloning the project, if you wish to construct the project from strach you can skip this step.

Proceed to the Devii GitHub page, then find the repository devii_python_tutorial, click on the repository name to open the project and clone or fork the project.

Clone Project

When landing on the Devii Python-flask tuorial page click on the green Code button then click on the copy button (above the red arrow)

Git Hub Clone Button

If you are using Visual Studio Code simply open a new window and either click on the Clone Git Repository or open the Command Palette and enter Git: Clone then paste the URL address you copied and select/save in your preferred directory, once the project is cloned you can either open in your current window or open a new window.

Once you have the repo cloned open the auth.py file in the get_access_token function replace the generic data in the data dictionary with your own.

def get_access_token():
"""this is to get the access token for the application"""

# Create a dictionary to store the form data
data = {
"login": "--login--",
"password": "--password--",
"tenantid": "--tenantid--",
}

You can retrieve your devii tenantid from the dashboard card in the portal.

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

Run the following command to create a virtual environment named "venv" (OS agnostic):

python3 -m venv venv

If running Windows run this command to activate your venv:

venv\Scripts\activate

if running MacOS or Linux run this command to activate your venv:

source venv/bin/activate

then run

pip install -r requirements.txt

finally to run the project

Windows:

python app.py

Linux:

flask run

The app should be running on your local server http://127.0.0.1:5000