Skip to content

Commit c164ed3

Browse files
committed
docs(interface): add docs about usage of django apps and interfaces
This commit adds some documentation about * using the caluma django apps inside an existing django project * supported interfaces. Related to #940 Closes #941
1 parent 6c5ea8e commit c164ed3

File tree

3 files changed

+394
-0
lines changed

3 files changed

+394
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Caluma Service is the core part of the Caluma project providing a
1919

2020
### Installation
2121

22+
NOTE: We recommend using Caluma as a dedicated service. However, it is possible to integrate
23+
Caluma into a django project. You can read about this [here](docs/django-apps.md).
24+
2225
**Requirements**
2326
* docker
2427
* docker-compose
@@ -74,5 +77,6 @@ For further information on our license choice, you can read up on the [correspon
7477
* [Validation](docs/validation.md) - Validation of user input
7578
* [Extending Caluma](docs/extending.md) - Extensions: Data visibility and
7679
permissions
80+
* [Using Caluma as django apps](docs/django-apps.md)
7781
* [Maintainer's Handbook](docs/maintainers.md) - HOWTO for various maintainer's
7882
tasks

docs/django-apps.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Using Caluma as django apps
2+
3+
## Disclaimer
4+
5+
It is highly recommended to use Caluma as a dedicated service. However, there are usecases, where
6+
it might make sense to integrate Caluma into another django project.
7+
8+
If you just want to get Caluma up and running, please see the documentation about [setting up
9+
the Caluma service](configuration.md).
10+
11+
Please beware that Caluma only works with PostgreSQL, and requires the `psqlextra`
12+
backend to use the advanced features (such as JSON fields etc).
13+
14+
## Installation
15+
16+
Caluma is on PyPI, so you can just
17+
18+
```shell
19+
pip install caluma
20+
```
21+
22+
23+
## Configuration
24+
25+
### Installed apps
26+
27+
Add the Caluma apps you want to use to your `INSTALLED_APPS`.
28+
29+
Some notes about Caluma-internal dependencies:
30+
31+
* `caluma_workflow` needs `caluma_form` to work correctly (as cases and work items point to documents)
32+
* `caluma_core` should always be installed when using Caluma (though, technically,
33+
it would work without it, as core doesn't contain any models
34+
* `caluma_user` should always be added (same caveat as with core)
35+
36+
```python
37+
INSTALLED_APPS = [
38+
# ...
39+
# Caluma and it's dependencies:
40+
"caluma.caluma_core.apps.DefaultConfig",
41+
"caluma.caluma_user.apps.DefaultConfig",
42+
"caluma.caluma_form.apps.DefaultConfig",
43+
"caluma.caluma_workflow.apps.DefaultConfig",
44+
"caluma.caluma_data_source.apps.DefaultConfig",
45+
"graphene_django",
46+
"localized_fields",
47+
"psqlextra", # Caluma needs a PostgreSQL database using the psqlextra backend
48+
"simple_history",
49+
# ...
50+
]
51+
```
52+
53+
### Settings
54+
55+
Import the Caluma settings at the top of your `DJANGO_SETTINGS_MODULE`:
56+
57+
```python
58+
from caluma.settings.caluma import * # noqa
59+
```
60+
61+
This will only load Caluma specific settings and no django specific ones (db, cache, etc.).
62+
63+
Then you can configure caluma normally [using environment variables](configuration.md).
64+
65+
66+
### Database
67+
68+
Caluma needs a PostgreSQL database using the `psqlextra` backend to use the advanced
69+
features (such as JSON fields etc).
70+
71+
This is mandatory, that's why we tell you thrice.
72+
73+
### Debug middleware
74+
75+
It's recommended to add following lines to your settings file (after importing the caluma settings):
76+
77+
```python
78+
# GraphQL
79+
if DEBUG:
80+
GRAPHENE["MIDDLEWARE"].append("graphene_django.debug.DjangoDebugMiddleware")
81+
```
82+
83+
84+
## Supported interfaces
85+
86+
See [interfaces](interfaces.md) for information about the officially supported API.
87+

0 commit comments

Comments
 (0)