DjangoLDP web push notifications package
This repository has been archived on 2021-04-21. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Jean-Baptiste Pasquier e4f5077469 Merge branch 'improvement/remove-useless-urls-file' into 'master'
Removing the now useless urls.py file from the example package

See merge request startinblox/djangoldp-packages/djangoldp-example!1
2019-11-07 15:00:59 +00:00
djangoldp_example Removing the now useless urls.py file from the example package 2019-08-09 18:51:42 +02:00
.gitignore Initial commit 2019-01-11 15:15:11 +01:00
.gitlab-ci.yml Initial commit 2019-01-11 15:15:11 +01:00
README.md Initial commit 2019-01-11 15:15:11 +01:00
setup.cfg Initial commit 2019-01-11 15:15:11 +01:00
setup.py Initial commit 2019-01-11 15:15:11 +01:00

Django LDP example

Step by step quickstart

  1. Installation
  • git clone git@git.happy-dev.fr:startinblox/djangoldp-packages/djangoldp-example.git /path/to/myawesomepackage
  • git remote set-url origin the_repository_url
  • rename djangoldp_example directory to djangoldp_myawesomepackage

NB:

  • replace /path/to/myawesomepackage with the local path of your package.
  • replace the_repository_url with the git url of your package (example: git@git.happy-dev.fr:startinblox/djangoldp-packages/djangoldp-example.git).
  • replace djangoldp_myawesomepackage with your package name. Please respect the naming convention (singular word, starting by djangoldp_)
  1. Developpement environnement

In order to test and developp your package, you need to put the package src directory at the same level of a working django ldp app. By exemple, you can clone the sib app data server git clone git@git.happy-dev.fr:startinblox/applications/sib-app-data-server.git server /path/to/app

  • The classical way : ln -s /path/to/myawesomepackage/djangoldp_myawesomepackage /path/to/app/djangoldp_myawesomepackage

  • The docker way : in the volumes section, add a line in docker-compose.override.yml. Example

volumes:
  - ./:/app
  - /path/to/myawesomepackage/djangoldp_myawesomepackage:/app/djangoldp_myawesomepackage

Add your package in settings.py of the app. Now, you can test if your package is imported propefully by doing a python manage.py shell then from djangoldp_myawesomepackage.models import ExampleModel

If, no error, it's working.

  1. Customization
  • setup.cfg : please, fill the name, version, url, author_email, description
  • djangoldp_example/__init__.py: fill the name, don't touch the version number !
  • everything under the djangoldp_example is part of your package, you probably would replace "example" by your package name.
  1. Push on the repository you've created

Notes

CICD

When you're ready to publish your app :

  1. Add the sib-deploy user as a maintainer to the project (Settings > Members)

  2. Configure pipeline strategy to clone (Settings > CI/CD > Pipelines)

  3. Protect the master branch allowing only maintainers to push (Settings > Repository > Protected branches)

  4. Configure CI/CD variables to authenticate on pypi.org:

Variable Value Protection
GL_TOKEN sib-deploy-token protected
PYPI_PASSWORD pypi-password protected
PYPI_USERNAME startinblox protected
  1. Replace the "do_not_publish" by "master" in the .gitlab-ci.yml

Factories

If you dont need factory, you can remove the mock_example command, the factories files and the extras_require section in setup.cfg

Provide a factory is a good pratice in order to simplify the mocking of data on a server / in a test pipeline.