- First create virtual environemt for the api using this command:
"python3 -m venv .venv"(can change .venv to any other preferd name for the virtual environment, but don't forget to change .gitignore to ignore the virtual environment), depending on your python installation you, maybe previous command won't create .venv. In that case run this command:"python -m venv .venv" - Using bash, activate virtual environment for the api using this command:
". .{nameOfTheEnvironment}/bin/activate"or if you are using python version 3.11 activation script has been moved to .{nameOfTheEnvironment}/Scrpits so use this command:". .{nameOfTheEnvironment}/Scripts/activate". Now everything you do is in virtual environment and no extra libraries are downloaded to your global python libraries. - Using the requirements.txt (list of all dependencies used for the project) install them in the virtual environment with this command:
"python -m pip install -r requirements.txt" - To run the api for testing run this command:
"python manage.py runserver" - If there are problems with migrations run
"python manage.py migrate"this should fix problems related to realocaing code or running it on another machine, if there are any - Create a superuser by running
./createUser.sh. This creates a superuser with username: admin and password: admin123 for loging into the /admin page. (If you are on linux give execution premission to the script withchmod +x ./createUser.sh) - To visit the admin page for more visual representation of data in general and stored data in sqlite go to /admin, and login with username: admin, password: admin123
For now we only have an API. Need to implement back-end for notifying user about water level reaching defined treshold.