DjangoLDP reference guide¶
The DjangoLDP commands¶
$ djangoldp --help Usage: djangoldp [OPTIONS] COMMAND [ARGS]... DjangoLDP CLI Options: --version Show the version and exit. --help Show this message and exit. Commands: configure Configure the project. initserver Start a DjangoLDP server. install Install project dependencies. runserver Run the Django embeded webserver. startpackage Start a DjangoLDP package.
The djangoldp server is built ontop of django framework. The django core commands are also available. Check python manage.py –help and the official Django documentation.
The Initserver command¶
This command initiate a new server folder from a template. It has the minimal option to work out of the box.
The Configure command¶
This is a command meant to tell the server the settings have changed and it must run some maintenance operations and data integrity check, such as the model migration of the LDP packages.
It has options to create new administrator users during the configuration process.
The Install command¶
This command parses the dependencies section of the configuration file and install all python distribution required by the project. It is a wrapper around the requirements.txt file.
The runserver command¶
This command loads the configuration and starts the LDP server. It is a wrapper around the django-admin runserver command.
The startpackage command¶
This a helper command working the same way the django startpackage does command. It creates a folder with a DjangoLPD package template.
The DjangoLDP configuration file¶
The server comes with a default settings.yml you can customize.
It contains 3 main sections:
dependencies: contains a list of dependencies to install with pip during the install phase
ldppackages: contains a list of djangoldp packages to activate
server: contains all the configuration required by djangoldp server
You need to restart the server after a change in configuration.
The Dependencies section¶
This is not mandatory as you can install all your dependencies manually. But it is convienent to have all in one file when exchanging server configurations.
The format for dependencies is the one accepted by pip. For example:
dependencies: - git+https://git.startinblox.com/djangoldp-packages/djangoldp-account.git
As for any python project when you declare a dependency you have to make sure it is installed. You can use the wrapper command djangoldp install for this.
The LDP packages section¶
When you want to use a LDP package you need to reference it in the configuration. For example:
ldppackages: - djangoldp_account
The name referenced there must be the name of the python module, the one your would use with the import statement.
Some packages may require some configuration to work properly. It is a good practice to run the djangoldp configure command after adding or upgrading a LDP package.
Here you have :
If the description of the available packages is unclear, open an issue to ask for more description.
The Server section¶
This section contains all parameters to the server itself. All this section is loaded as a Django configuration object to initialize the server.
The extra config module¶
The DjangoLDP server also load a settings.py module when it exists in along with the settings.yml.
The DjangoLDP packages capabilities¶
Among other things, the package has a special file allowing a package to load settings when the djangoldp server starts. The djangoldp_settings.py file can reference custom variables and load extra middlewares (they are added to the ones loaded by the djangoldp server itself).
# cat mypkg/mypkg/djangoldp_settings.py MIDDLEWARE =  MYPACKAGE_VAR = 'MY_DEFAULT_VAR'
As any other packages, local packages needs to be referenced in the project settings.yml:
ldppackages: - mypkg