PREREQUISITES: Python 3.7+
- Open terminal (cmd for Windows or bash for macOS) and navigate to desired root directory
- If you haven't ever run the server before, from desired root directory, create virtual environment by running the command below.
py -m venv env
env\Scripts\activate
- Install Dependencies
pip install flask
pip install pyJWT
pip install requests
pip install pycryptodome
- Set environment variable for the FLASK_APP to be the flask server we made:
set FLASK_APP=server.py
or for macOS
export FLASK_APP=server.py (mac)
- Now, setup is done. Run the server by executing the command below. Make sure server.py is in your root directroy
flask run --port 5001
- Open a new terminal window and create a new virtual environment
py -m venv env
env\Scripts\activate
- Install Dependencies
pip install flask
pip install pyJWT
pip install requests
pip install pycryptodome
- Set environment variable for the FLASK_APP to be the flask server we made:
set FLASK_APP=issuer.py
or for macOS
export FLASK_APP=issuer.py (mac)
- Now, setup is done. Run the server by executing the command below. Make sure issuer.py is in your root directroy
flask run --port 5000
PREREQUISITES: Make sure the client is running (get to step 5 above)
- Open a new terminal window and create a new virtual environment(you should have a total of 3 windows now)
- Activate the same virtual environment by running the command from step 3 above.
py -m venv env
env\Scripts\activate
- Install Dependencies
pip install flask
pip install pyJWT
pip install requests
pip install pycryptodome
- Now simply run the client program by executing command below. Make sure you have the client.py in the root directory. You should see "Response: here is your data" if successful
py client.py
- Deactivate the virtual environment by running the same command as in step 6 above.
Bam! You made connection to the server from the client. You can also test this in your browser by typing the url listed after running the server (should be "http://127.0.0.1:5001/" and you will see the response)
Setting up server
- In Windows, download from Azure Student the free SQL Server 2019 Developer and also a Microsoft SQL Server Management studio using the default settings.
- Open the Management studio, login, click "new query" on top of window then paste in the query in our root folder then click "execute".
- Databases all set up.
Assuming the Server is all set up and pyodbc isn't installedinstall pyodbc to this environment by running the command below.
pip install pyodbc
- Open up Sql Server Management Studio, sign-in with windows authentication.
- Find out name of device to be used with our middleware. If Windows, start -> search "about your pc" -> Device name. Enter your device name as a string to initiate the class DatabaseConn.
- Look at documentation inside the class.