Configurable common laundry room reservation app (WIP).
- Python >= 3.6, possibly even newer
- Access to a Postgres server (can use a different server with slight modifications)
- Postgres client
npmoryarn- Major dependencies:
- Django
- React
First edit config.json, verifyPasscode.py.edit and .env.edit (see Configuration), then:
./exportconfig.sh
# Optional block
python3 -m venv env
source env/bin/activate
pip3 install -r requirements.txt
python3 backend/manage.py migrate
python3 backend/manage.py runserverBecause the project is not yet at the point where an actual deployment would be feasible, open a different shell and:
cd frontend
yarn install
yarn startSECRET_KEY: secret key used by DjangoDEBUG: should beoff, can beonfor developmentDATABASE_URL: Postgres URL containing all credentials required to access database
Implement a Python function that verifies whether submitted passcode is valid.
dayCount: Number of days to be displayed at oncemaxReservations: Currently unusedfirstSlot: Time of morning when laundry room is first openlastSlot: Time of night (24-hour clock) when last slot should startownerDelimiter: Field delimiter for theownerstring in the database and displaysdisplayOwnerAtAllTimes: Controls whether owner of the slot should be displayed at all times or only upon hover (no mobile support for 'hovering' yet)timezone: Time zone. Using tz names is the best option, e.g. 'Europe/Helsinki'machines<Array>: Array consisting of objects with the following keysfullName: Full display name of the reservable object in question, no length considerations, e.g. 'Washing machine 1'shorthand: This should be a short form representation offullNamefor preserving grid display, e.g. 'W1'
apartments: An object/dict containing key-value pairs:- key : Identifier for a collection of apartments, e.g. stairwell or building, e.g. 'A' or '13 B' or 'High Street 4'
- value <Array>: Identifier for a unique apartment within the collection, e.g. '1' or 'B 5'
django-admin startproject $mysite cd $mysite python manage.py startapp $myapp # 1. Create views in $myapp/views.py # 2. Add urlpatterns to $myapp/urls.py # 3. Include in $mysite/urls.py
python manage.py migrateFirst edit
$mysite/settings.pyINSTALLED_APPSto include a path to$myapp.apps.$AppConfig. (Adding__str__methods is really helpful, possibly required(?).)python manage.py makemigrations $myapp python manage.py sqlmigrate $myapp $0001 python manage.py migrate
from $myapp.models import $ModelName x = $ModelName( a='123', b=123 ) x.save() $ModelName.objects.all() <QuerySet [<$ModelName: $ModelName object (1)>]>