This repository contains the code for Metax API service.
Copyright (c) 2018-2020 Ministry of Education and Culture, Finland
Licensed under GNU GPLv2 License
The recommended way to run the development setup is to use Docker-swarm setup. You can also set up the development environment with standalone Docker-containers setup or local install documented below.
Install Poetry for your OS. Navigate to the repository root and run command poetry install
. this will create and activate new Python virtualenv, installing all necessary Python packages to it.
You can generate traditional requirements.txt file with poetry export --dev -E simplexquery -E docs -E swagger --without-hashes -o requirements.txt
NOTICE: Please remember to generate the requirements.txt file after any additions, updates or removals using the command above.
Developer dependencies can be added with command poetry add -D <package>
Application dependencies can be added with command poetry add <package>
Dependencies can be updated using poetry update
. Please notice that this will update all packages and their dependencies, respecting the dependency constraints defined in pyproject.toml
Dependencies can be removed with poetry remove (-D) <package>
copy src/metax_api/settings/.env.template
as src/metax_api/settings/.env
and fill required variables, you can find examples in ENV_VARS.md
mkdir -p /var/log/metax-api/errors
Activate your python 3.8 virtualenv, install requirements with pip install -r requirements.txt
cd
into src
folder and run following command:
python manage.py first_time_setup
start the development server with:
python manage.py runserver 8008
Metax api is available from your browser at http://localhost:8008. To use https refer the ssl-setup.
run the tests with command DJANGO_ENV=unittests python manage.py test --parallel --failfast --keepdb -v 0
Collect data: docker exec -it -e DJANGO_ENV=unittests $(docker ps -q -f name="metax-web*") coverage run manage.py test --parallel
Combine it: docker exec -it $(docker ps -q -f name="metax-web*") coverage combine
Report: docker exec -it $(docker ps -q -f name="metax-web*") coverage report
cli-report:docker exec -it $(docker ps -q -f name="metax-web*") coverage report
Run all tests with command DJANGO_ENV=unittests python manage.py test --parallel --failfast