Django application for resource reservation
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Attic/hvara_import Attic: Refactor hvara_import to allow importing it Sep 6, 2018
caterings Add support for sending HTML mails Aug 29, 2018
comments comments: Rename test because conflicting name Sep 5, 2018
deploy WIP Feature/travis build docker (#273) May 31, 2018
locale/fi/LC_MESSAGES Add resource specific extra content for reservation requested notific… Aug 29, 2018
notifications Add support for sending HTML mails Aug 29, 2018
reports Typo fix Nov 29, 2017
resources Add to resources/importer Sep 6, 2018
respa Add and configure django-sanitized-dump May 29, 2018
respa_exchange Add helper function to get reservation data from Exchange Feb 19, 2018
sanitizers sting -> string (confused me) Sep 6, 2018
scripts anonymize_dumpdata: Refactor to allow importing Sep 6, 2018
users Support for Django 2.0 Dec 5, 2017
.coveragerc Add basic `respa_exchange_download` management command May 10, 2017
.editorconfig Add .editorconfig May 31, 2018
.flake8.ini Add HoundCI config Jun 8, 2017
.gitignore WIP Feature/travis build docker (#273) May 31, 2018
.hound.yml Add HoundCI config Jun 8, 2017
.sanitizerconfig sanitizerconfig: Sanitize comments and catering orders May 31, 2018
.travis.yml Travis: Run pytest with --doctest-modules argument Sep 6, 2018
Dockerfile Dockerfile: Fix names of installed apt packages Aug 28, 2018
LICENSE Update copyright years in LICENSE Mar 28, 2017 Merge pull request #301 from City-of-Helsinki/sanitizer Sep 6, 2018
dev-requirements.txt Use py.test for testing; refactor eligible tests to use it Oct 21, 2015 Initial commit May 29, 2015 Merge pull request #301 from City-of-Helsinki/sanitizer Sep 6, 2018
requirements.txt Merge pull request #301 from City-of-Helsinki/sanitizer Sep 6, 2018
setup.cfg setup.cfg: Configure pytest to exclude deploy directory Sep 6, 2018 Add skeleton to allow `pip install -e respa` Apr 14, 2016
swagger.yaml Implement period to resource available between filter Mar 14, 2018

Stories in Ready Build Status codecov

respa – Resource reservation and management service


Prepare virtualenv

 virtualenv -p /usr/bin/python3 ~/.virtualenvs/
 workon respa

Install required packages

Install all required packages with pip command:

 pip install -r requirements.txt

Create the database

sudo -u postgres createuser -L -R -S respa
sudo -u postgres psql -d template1 -c "create extension hstore;"
sudo -u postgres createdb -Orespa respa
sudo -u postgres psql respa -c "CREATE EXTENSION postgis;"

Run Django migrations and import data

python migrate
python createsuperuser  # etc...
python geo_import --municipalities finland
python geo_import --divisions helsinki
python resources_import --all tprek
python resources_import --all kirjastot


  • RESPA_IMAGE_BASE_URL: Base URL used when building image URLs in email notifications. Example value: ''.

  • TODO document rest of relevant settings.

Ready to roll!

Setting up PostGIS/GEOS/GDAL on Windows (x64) / Python 3

Production considerations

Respa Exchange sync

Respa supports synchronizing reservations with Exchange resource mailboxes (calendars). You can run the sync either manually through respa_exchange_download, or you can set up a listener daemon with respa_exchange_listen_notifications.

If you're using UWSGI, you can set up the listener as an attached daemon:

  attach-daemon2: cmd=/home/respa/,pidfile=/home/respa/,reloadsignal=15,touch=/home/respa/service_state/touch_to_reload

The helper script activates a virtualenv and starts the listener daemon:


. $HOME/venv/bin/activate

cd $HOME/respa
./ respa_exchange_listen_notifications --log-file=$HOME/logs/exchange_sync.log --pid-file=$HOME/ --daemonize

Creating sanitized database dump

This project uses Django Sanitized Dump for database sanitation. Issue the following management command on the server to create a sanitized database dump:

./ create_sanitized_dump > sanitized_db.sql

Running tests

Respa uses the pytest test framework.

To run the test suite,

$ py.test .

should be enough.

$ py.test --cov-report html .

to generate a HTML coverage report.


This project uses two files for requirements. The workflow is as follows.

requirements.txt is not edited manually, but is generated with pip-compile.

requirements.txt always contains fully tested, pinned versions of the requirements. contains the primary, unpinned requirements of the project without their dependencies.

In production, deployments should always use requirements.txt and the versions pinned therein. In development, new virtualenvs and development environments should also be initialised using requirements.txt. pip-sync will synchronize the active virtualenv to match exactly the packages in requirements.txt.

In development and testing, to update to the latest versions of requirements, use the command pip-compile. You can use to monitor the pinned versions for updates.

To remove a dependency, remove it from, run pip-compile and then pip-sync. If everything works as expected, commit the changes.