Get started with the DjangoLDP server¶
What is behind the DjangoLDP server ?¶
As a reminder and as specified in Startin’Blox presentation, Startin’Blox is data source agnostic, i.e. it adapts to data sources that are compatible with the Linked Data Platform conventions.
DjangoLDP server, used in production, is the most operational solution today. However, it is currently still in development, so there is no guarantee that it is complete. Also, work in progress on compatibility of Startin’Blox with Virtual Assembly’s SemApps and Inrupt’s Community server.
Go to Server Architecture to know more about it.
And check the References guide to know all the details.
The DjangoLDP server requires:
postgresql database (for production)
If you’re working on many project in Python, we advice you to use a virtual environement.
From a fresh environment, get the last version of DjangoLDP:
python -m pip install djangoldp
Initiate a new server¶
Create a server workdir:
djangoldp initserver sibserver cd sibserver
All the command must be issued from this working directory.
Add a package to your settings.yml file, let’s start with djangoldp_account:
dependencies - djangoldp-account ldppackages: - djangoldp_account
The server section should work out of the box. Check the reference guide for details on the settings file.
Install the dependencies you just added:
This downloads the djangoldp-account distribution from pypi.org.
Configure your backend to support the new package:
djangoldp configure --with-dummy-admin
This will also create a local admin user (not suited for production use).
Then launch the server:
Then go to http://localhost:8000/admin/ to acces to your Django administration with the admin user and admin password.
You should be able to get you api at http://localhost:8000/abc/ where abc is the model of data you want to get.
Start your own DjangoLDP package¶
A bug in with the local package loading breaks the Django migrations directory recognition. To workaround it, you need to start or move your DjangoLDP package outside the server workdir and make a symlink inside the working directory.
Start a new package in the server workdir parent directory:
djangoldp startpackage mypkg
From the server workdir create a symlink to the package python module:
cd sibserver ln -s ../mypkg/mypkg mypkg
Then reference your new package in the ldppackages section:
ldppackages: - mypkg
Don’t forget to run the configure command if your package load django migrations.