|
| 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