Full Documentation here
- python 3.8 or higher
- pip
- Laravel Valet (if using a proxy over HTTP)
Get the latest version of ohtk-api
git clone https://github.com/onehealthtoolkit/ohtk-api.git
cd ~/ohtk-api
It is recommended that you install the required packages via a virtual environment (such as venv):
python -m venv pickavirtualenvname
source pickavirtualenvname/bin/activate
Install dependencies
pip install -r requirements.txt
You can use the Postgres MacOS app for an easy-to-use interface.
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'database name',
'USER': 'username',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '',
}
}
python ./manage.py migrate
python ./manage.py createsuperuser
./manage.py dumpdata --format=yaml accounts> accounts/fixtures/accounts.yaml
./manage.py loaddata --format=yaml accounts
python ./manage.py runserver
Start Proxy (using Laravel Valet)
valet proxy opensur http://127.0.0.1:8000 --secure
Navigate to https://opensur.test/admin/ or http://opensur.test/graphql/
Remove a proxy using the unproxy command:
valet unproxy opensur
./manage.py test accounts.tests.test_admin_authority_user_crud.AdminAuthorityUserTests.test_update_with_error
./manage.py test reports.tests.test_admin_category_crud.AdminCategoryTests.test_simple_query
./manage.py test cases.tests.test_admin_state_definition_crud.AdminStateDefinitionTests.test_update_with_error
By this point you should be ready to install the OHTK Management System
OHTK API uses Django Tenants
By default, if there are no any record config in tenants_client and tenants_domain table then every incoming request will resolve to public database schema.
- create a record in tenants_client
- create mapping from subdomain name to tenants_client in tenants_domain
┌─────────────────┐ ┌─────────────────┐
│ │ │ │
│ tenants_client │ ╱│ tenants_domain │
│ │──────┼──│ │
│ │ ╲│ │
└─────────────────┘ └─────────────────┘
│ │
└────┐ └─┐
│ │
.─────────. .─────────.
(schema_name) ( name )
`─────────' `─────────'