- Docker Compose V2
git clone --recurse-submodules git@github.com:CyberCRI/projects-backend.git
cd projects-backend
if you want to set your environnement variables (Mostly third-parties secrets):
cp .env.example .env
You can ask the other devs for the secret values to fill the .env
file.
docker compose up
The backend and Celery restart multiple times because they keep crashing while Keycloak is not up. After a short moment, your backend will be up and ready.
You can now access:
The stack need to be running. Get a shell access to the backend container
make bash
# inside the container
python manage.py migrate
# inside the container
python manage.py collectstatic
# inside the container
python manage.py compilemessages
A default superadmin is created in keycloak. To import it in Projects, you need to login at least once in the swagger or in Django admin using these credentials:
- username:
admin
oradmin@localhost.com
- password:
admin
You can also use these credentials (use the admin
username, not the email) to connect to the Keycloak admin panel
Run all the tests:
# inside the container
make test
Run just one test file or test directory:
# inside the container
# ex:path_to_file=apps.accounts.tests.views.test_people_group
python manage.py test <path_to_file> --settings=projects.settings.test
You can check locally that the CI will validate your pull request by running the following commands in your backend container. Your pull request cannot be merged if it doesn't meet these requirements. You can run these tests locally before asking to merge your PR, or you can let the CI run them for you remotely.
- Respect format rules:
# inside the container
make format
This will automatically update your files
- Respect lint rules:
# inside the container
make lint
This will return errors that you need to fix manually. If there are some, fix them then repeat step 1.
- Keep translations up to date:
# inside the container
make makemessages
This will detect changes in translated messages. Even if you didn't add, remove or modify any translated message. This might update some files because of line changes on translations caused by your changes.
If there are new messages, be sure to add the translation after running this command.
- Create migrations if needed:
# inside the container
python manage.py makemigrations
- Be sure that all tests pass
# inside the container
make test
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.