Simple Django app for hydro systems management.
Contains features such as user authorization and authentication, CRUD operations for hydro systems, sensors and measurements.
Views are tested in test_views dirs. App is also packed into docker network.
Each user can manage one's systems (add them, update info, delete, read details). After creating system, one can add sensors to it.
After setting up sensors use "new-measurement" endpoint to add values read by them to PostgreSQL db.
Api documentation is available at http://localhost:8000/api/docs/
Follow README to set up and use the app properly.
License: MIT
- To isolate the dependencies of this project, it's recommended to use a virtual environment.
python -m venv .venv
.venv/Scripts/activate
git clone https://github.com/saworz/hydro
cd hydro
pip install -r requirements.txt
pip install -r requirements_dev.txt
createdb --username=postgres hydro
export DATABASE_URL=postgres://postgres:hydro@127.0.0.1:5432/hydro
python manage.py migrate
python manage.py runserver
cd hydro
docker-compose up
- First you need to setup csrf global var. Tokens are passed as cookies automatically.
- And now you can log in.
- To avoid setting up user, systems, sensors, measurements manually you can run this command and enjoy some dummy data.
python manage.py populatedb
- Now you can investigate the data in database or using GET endpoints described in api schema (step 3.5).
Let's say you just finished building new system that contains only 1 ph sensor and 1 temperature sensor and you want to save its measurements.
pytest