Django server to keep track of the state of batteries. Made by @dublUayaychtee , @kenwoodfox .
Use pipenv
to manage python deps and versions
pipenv install
pipenv shell
It can be handy to place a .env
at the root of this repo for connection details
DATABASE_URL=postgres://battery_user:[email protected]:5432/battery_db
DEBUG=true
SECRET_KEY="fortestingonly"
Spawn a development django server
python manage.py migrate
python manage.py runserver
# Optional, do once
python3 manage.py createsuperuser
In one terminal, start the dev
requirements.
make dev
In another terminal, build and run a local copy of the server
make run
Alternatively, run the local django with the docker url string
export DATABASE_URL=postgres://battery_user:[email protected]:5432/battery_db
python manage.py migrate
python manage.py runserver
There are a few custom maintenance tasks outlined in log/management/commands
.
Useful command will walk you though adding a system-generated record to retroactively include an older battery.
# Local
pipenv run python manage.py addretrobattery
# On prod
docker exec -it <id> ./manage.py addretrobattery