Installation

Warning

This page has been automatically generated as has not yet been reviewed by the authors of capice-data-backend!

To install the capice-data-backend package, we recommend that you install it from PyPi via

pip install capice-data-backend

Or install it directly from the source code repository on Gitlab via:

pip install git+https://git.rwth-aachen.de/nfdi4earth/pilotsincubatorlab/pilots/capice/capice-data-backend.git

The latter should however only be done if you want to access the development versions.

Installation for development

Please head over to our contributing guide <contributing>{.interpreted-text role=”ref”} for installation instruction for development in case you want to contribute back to this repository.

To setup and test the DASF functionality of this package locally, you need to run a DASF message broker. Everything for this is contained in the django folder of the source code.

Manual DASF setup

Setup the message broker

To manually setup a message broker and connect a backend module, run:

# create a virtual environment for development (note, on windows, you need
# to run these venv-install commands from the Makefile manually, or use the WSL)
make venv-install
source venv/bin/activate

# setup and run the django message broker
cd django
python manage.py migrate
python manage.py dasf_topic -n capice-data --anonymous
python manage.py runserver

This will create a local file at django/db.sqlite3 with the database and spawn a server that listens to http://localhost:8000.

Connect a backend module

To connect a backend module to the message broker, run

python -m capice_data.backend --websocket-url ws://localhost:8000/ws --topic capice-data listen

Make Request via the autogenerated API

To make a request via the auto-generated api module, set the corresponding environment variables for the websocket url and the topic, and call a function from the api module. Like this for instance:

DE_BACKEND_WEBSOCKET_URL=ws://0.0.0.0:8000/ws \
  DE_BACKEND_TOPIC=capice-data \
  python -c "from capice_data.api import version_info; print(version_info())"