Django application that acts as an integration layer that mediates the connection between ticket sales platforms and MaaS providers.
Prerequisites:
Create a docker-compose.env.yaml
file in the project folder:
docker-compose.env.yaml.example
as a base, it does not need any changes for getting the project running.DEBUG
, controls debug mode on/offAPPLY_MIGRATIONS
, applies migrations on startupCREATE_ADMIN_USER
, creates an admin user with credentials kuva-admin
:(password, see below)
(kuva-admin@hel.ninja)ADMIN_USER_PASSWORD
, the admin user's password. If this is not given, a random password is generated
and written into stdout when an admin user is created automatically.Run docker-compose up
Optional steps
Run migrations:
docker exec maritime-maas-backend python manage.py migrate
Create superuser:
docker exec -it maritime-maas-backend python manage.py add_admin_user
Load groups fixtures (later users can belong to respective group to access user specific data)
python manage.py loaddata utils/fixtures/groups.json
Prerequisites:
pip install -r requirements.txt
pip install -r requirements-dev.txt
(development requirements)To setup a database compatible with default database settings:
Create user and database
sudo -u postgres createuser -P -R -S maritime_maas # use password `maritime_maas`
sudo -u postgres createdb -O maritime_maas maritime_maas
Allow user to create test database
sudo -u postgres psql -c "ALTER USER maritime_maas CREATEDB;"
.env
file: touch .env
DEBUG
environment variable to 1
.python manage.py migrate
python manage.py add_admin_user
python manage.py runserver 0:8000
The project is now running at localhost:8000
Install pip-tools
:
pip install pip-tools
Add new packages to requirements.in
or requirements-dev.in
Update .txt
file for the changed requirements file:
pip-compile requirements.in
pip-compile requirements-dev.in
If you want to update dependencies to their newest versions, run:
pip-compile --upgrade requirements.in
To install Python requirements run:
pip-sync requirements.txt
This project uses
black
,
flake8
and
isort
for code formatting and quality checking. Project follows the basic
black config, without any modifications.
Basic black
commands:
black
do its magic: black .
black
would change: black --check .
pre-commit
can be used to install and
run all the formatting tools as git hooks automatically before a
commit.
DEBUG
environment variable to 1
.pytest
.