DjangoLDP
A Django package that extends Django REST Framework to serve models following the W3C Linked Data Platform convention, with support for RDF serialization and ActivityPub federation.
Getting Started
Check the official documentation.
Settings
OIDC_ACCESS_CONTROL_ALLOW_HEADERS: overrides the access control headers allowed in theAccess-Control-Allow-HeadersCORS header of responses. Defaults toauthorization, Content-Type, if-match, accept, DPoPANONYMOUS_USER_NAMEa setting inherited from dependency Django-GuardianDJANGOLDP_PERMISSIONS: overrides the list of all permissions on all resourcesSERIALIZER_CACHE: toggles the use of a built-in cache in the serialization of containers/resourcesMAX_RECORDS_SERIALIZER_CACHE: sets the maximum number of serializer cache records, at which point the cache will be cleared (reset). Defaults to 10,000SEND_BACKLINKS: enables the searching and sending of Activities to distant resources linked by users to this serverMAX_ACTIVITY_RESCHEDULES,DEFAULT_BACKOFF_FACTOR,DEFAULT_ACTIVITY_DELAY,DEFAULT_REQUEST_TIMEOUTtweaks the behaviour of the ActivityQueueServiceSTORE_ACTIVITIES: sets whether to store activities sent and backlinks received, or to treat them as transient (value should be"VERBOSE","ERROR"orNone). Defaults to"ERROR"MAX_RECORDS_ACTIVITY_CACHE: sets the maximum number of serializer cache records, at which point the cache will be cleared (reset). If set to 0 disables the cache. Defaults to 10,000ENABLE_SWAGGER_DOCUMENTATION: enables the automatic OpenAPI-based API schema and documentation generation, made available athttp://yourserver/docs/is the flag is set to True. Default to FalseDISABLE_LOCAL_OBJECT_FILTER: disabled the LocalObjectBackendFilter which is processing-time costly and only need activation in federated architecture, so we preferred to add a way to disable it as a workaround for in-progress performances improvements. Default to False
Synopsis
This module is an add-on for Django REST Framework that serves a django model respecting the Linked Data Platform convention.
It aims at enabling people with little development skills to serve their own data, to be used with a LDP application.
Check technical documentation
Contribute to DjangoLDP
Testing
Packaged with DjangoLDP is a tests module, containing unit tests
You can extend these tests and add your own test cases by following the examples in the code. You can then run your tests with:
python -m unittest djangoldp.tests.runner
Check your datas integrity
Because of the way the DjangoLDP's federation work, you can reach some integrity issue within your datas.
You can check them with:
./manage.py check_integrity
You can ignore some servers:
./manage.py check_integrity --ignore "https://server/,https://another-server/"
Add you own commands to the check_integrity from your own package
Create a check_integrity.py file within your app folder containing:
def add_arguments(parser):
parser.add_argument(
"--my-own-argument",
default=False,
nargs="?",
const=True,
help="Some help text",
)
def check_integrity(options):
if(options["my_own_argument"]):
print("You ran a check_integrity with --my-own-argument!")
else:
print("Run me with `./manage.py check_integrity --my-own-argument`")
You can see a sample on the check_integrity.py file of DjangoLDP.
What's New in v5.0.0
Major Changes
- Django 5 LTS - Upgraded to Django 5.2 LTS
- Turtle Serialization - Full RDF Turtle parser and renderer (guide)
- ETag Support - Conditional requests with
If-Match,If-None-Match,If-Modified-Since - Link Headers - W3C LDP-compliant pagination and type headers
- OPTIONS Method - Full implementation with
Allow,Accept-Post,Accept-Patch - Prefer Headers - RFC 7240 support (
return=minimal,return=representation)
Quick Examples
# Request Turtle format
curl -H "Accept: text/turtle" http://localhost:8000/users/
# Conditional update (prevents conflicts)
curl -X PUT -H "If-Match: W/\"abc123\"" -d '{"name":"updated"}' http://localhost:8000/users/1/
# Minimal response (faster)
curl -X POST -H "Prefer: return=minimal" -d '{"name":"new"}' http://localhost:8000/users/
Documentation
| Document | Description |
|---|---|
| Turtle Serialization | How to use RDF Turtle format |
| HTTP Headers | Complete headers reference |
| v5.0.0 Changelog | Full list of changes |
| LDP Compliance | W3C specification compliance |
| Architecture | Codebase architecture |
License
Licence MIT
Release files for djangoldp 5.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| djangoldp-5.1.0.tar.gz | 137.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| djangoldp-5.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 321.6 kB
Release files / djangoldp-5.1.0.tar.gz
| Download URL | djangoldp-5.1.0.tar.gz |
|---|---|
| Size | 137.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ad766d6f14f00d434618de0e87bb87555f73800076f0dfde52bae87bdaeb570
|
|
BLAKE2b-256 checksum How to use checksums |
11a607d99364da0b7fabdaef233bf14e2cdea382a482bbd369599a026b032e66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.13 readme-renderer/46.0 requests/2.34.2 requests-toolbelt/1.0.0 urllib3/2.7.0 tqdm/4.70.1 importlib-metadata/9.0.1 keyring/25.7.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.16
|
Release files / djangoldp-5.1.0-py2.py3-none-any.whl
| Download URL | djangoldp-5.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 184.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b167b540716a60ad570ab5905b652d81c967ef6b784e8619e6cff31be927861e
|
|
BLAKE2b-256 checksum How to use checksums |
0ddf1116d38a8910337e210a66544539f55d676ae9bf74d55c44db50be8843db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.13 readme-renderer/46.0 requests/2.34.2 requests-toolbelt/1.0.0 urllib3/2.7.0 tqdm/4.70.1 importlib-metadata/9.0.1 keyring/25.7.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.16
|