Ensure that you have Python installed. If you do not, see here to download it.
-
Clone this repository
Using HTTPS:
git clone https://github.com/HackAtUCI/api-workshop-starter-code.git
or SSH (you would need to set up an SSH key. See here for more information, otherwise use HTTPS):
git clone [email protected]:HackAtUCI/api-workshop-starter-code.git
-
Create a virtual environment
This isolates the libraries you install in this environment from the libraries on your actual machine, preventing conflicts between libraries.
python3 -m venv .venv
-
Activate virtual environment
VS Code may prompt to automatically select the newly created virtual environment. Otherwise, for Mac/Linux, run
source .venv/bin/activate
and for Windows, run
.\.venv\scripts\activate
-
Install dependencies
pip install -r requirements.txt
This will install all of the packages that you need for the python files to work.
Run this command:
flask run
and a server will run at http://127.0.0.1:5000 (or http://localhost:5000).
Note: changing any Python code will not update the server that is running. You must stop the server and re-run flask run
to see any changes.
However, if you run
flask run --debug
Flask will automatically reload itself if you change the Python code. This also enables an interactive debugger.