This folder contains the backend components, responsible for handling API requests, managing system state, and interacting with other parts of the project like the Arduino, mobile app, and web app.
The server is built using Flask and is responsible for:
- Handling system control requests (e.g., turn on/off system, manual pump control).
- Serving system status (e.g., pump status, water level, water quality).
- Handling device communication and status tracking.
- Enabling cross-origin resource sharing (CORS) for communication with the frontend (web and mobile).
-
Install dependencies:
Make sure you have
pip
installed. Then, install the required Python libraries by running the following command:pip install -r requirements.txt
-
Configuration:
- Replace the
SERVER
(line-7) variable in theHttpServer.py
file with your server's IP address. - The server will by default run on port
5000
, but you can change the port if necessary.
- Replace the
The server requires the following Python packages:
- Flask
- flask_cors
To start the server, run the following command:
python HttpServer.py
The server will start listening for incoming requests on the specified IP address and port.