This repository contains the code for a project with separate directories for the backend and frontend components. The backend is built using Flask, a Python web framework, while the frontend is developed using React Js.
- Clone the repository:
$ git clone https://github.com/AMuriuki/wildlife_sightings_tracker
- Navigate to the backend directory
$ cd wildlife_sightings_tracker/backend
- Create a virtual environment
$ python3 -m venv venv
- Activate the virtual environment:
- For Windows:
$ venv\Scripts\activate
- For macOS/Linux:
$ source venv/bin/activate
- Install the required Python packages
$ pip install -r requirements.txt
- Run DB migrations
$ flask db upgrade #(uses sqlite as default DB)
- Seed DB with dummy data
$ flask dummy load-data
- Run the development server
$ flask run
The backend server should now be running on http://localhost:5000
, copy and paste the url on your browser to view the API's documentation.
Open a different terminal and follow these steps:
- Navigate to the frontend directory:
$ cd wildlife_sightings_tracker/frontend
-
Install Node.js and npm if not already installed
-
create and populate the
.env
file.
$ echo "REACT_APP_BASE_API_URL=http://localhost:5000" > .env
- Install the project dependencies:
$ npm install
- Start the development server:
$ npm start
Once both the backend and frontend servers are running, you can interact with the application by accessing http://localhost:3000 in your web browser. The frontend communicates with the backend through API endpoints provided by the Flask server.