For Flask:
Setting up Flask on python env (VsCode)
- ⇧⌘P Python: Create Environment
- ⇧⌘P Terminal: Create New Terminal
- Note for windows:
- Terminal: Select Default Profile to set "Command Prompt" as your default instead.
- In the terminal run:
python3 -m pip install flask
- Make sure there is a .(venv) prefix in the terminal
- If not run
source .venv/bin/activate
(MacOS) - Or
.venv\Scripts\Activate.ps1
(Windows)
For npm/react/flask api packages:
pip install nodeenv
nodeenv -p
npm install react react-dom
pip install python-dotenv
pip install Flask-Cors
npm install react-awesome-reveal @emotion/react --save
pip install requests
Make sure you are using the virtual environment for both terminals (there should be a .venv prefix in the terminal)
- Open two seperate terminals (one to run the back end and one for the front end)
- On the first one run
npm run dev
to start the React application. - On the second one run
npm run start-api
ornpm run start-api-windows
if on windows.
Now both the front and back end should be connected.
Note: Whenever a change is done to any of the API endpoints the flask server must be restarted.
Ctrl+C
to stop then refer back to step 3 to reinitialize the Flask API