-
Python 3.7 - Follow instructions to install the latest version of python for your platform in the python docs
-
Virtual Environment - We recommend working within a virtual environment whenever using Python for projects. This keeps your dependencies for each project separate and organized. Instructions for setting up a virual environment for your platform can be found in the python docs
-
PIP Dependencies - Once your virtual environment is setup and running, install the required dependencies by navigating to the
/backend
directory and running:
pip install -r requirements.txt
-
Flask is a lightweight backend microservices framework. Flask is required to handle requests and responses.
-
SQLAlchemy is the Python SQL toolkit and ORM we'll use to handle the lightweight SQL database.
-
Flask-CORS is the extension we'll use to handle cross-origin requests from our frontend server.
With Postgres running, create a trivia
database:
createdb trivia
Populate the database using the trivia.psql
file provided. From the backend
folder in terminal run:
psql trivia < trivia.psql
From within the ./backend
directory first ensure you are working using your created virtual environment.
To run the server, execute:
export FLASK_APP=flaskapp
export FLASK_ENV=development
flask run --reload
The --reload
flag will detect file changes and restart the server automatically.
To run the frontend, use the instructions inside ./frontend
.
npm install
npm start
This will run the frontend and you will be able to interact with the backend server.
Note that you need node version 14, you can use NVM to switch between node versions.