How to develop SIB server packages¶
LDP packages represent capabilites the server could support. Each may have it’s own configuration depending of what mission it fulfills. There is no limit of what a LDP package can do. Here we are going to see how to developp your own package.
Generate your package template¶
First we retrieve the template of the package with this command :
sib startpackage djangoldp_mypack
All your package should respect this semantic. For example djangoldp_skills.
Make a first model¶
Go to your models.py file, and make a simple first model :
from django.db import models from djangoldp.models import Model from django.conf import settings class Todo(Model): name = models.CharField(max_length=255) deadline = models.DateTimeField() author_user = models.ForeignKey(settings.AUTH_USER_MODEL) class Meta: auto_author = 'author_user' serializer_fields = ['name']
A section about models is coming soon.
Add your package¶
Tell your sever, you’ve add a new package in the packages.yml:
ldppackages: djangoldp_mypack: djangoldp_mypack
Initiate your server¶
Go at the root of your developpement server at the level where reside your manage.py file.
Then initiate your server running this command:
sib install sibserver
Make the migration¶
At the root of your project, run the following commands :
python manage.py makemigrations python manage.py migrate