Pelican frontend has a Django backend that provides an API to the data in Pelican backend, and a Vue frontend that reports results to users.
Set up the git pre-commit hook:
pre-commit install
Install development dependencies:
pip install pip-tools
pip-sync requirements_dev.txt
Run database migrations:
python backend/manage.py migrate
See OCP's approach to Django settings. New variables are:
PELICAN_BACKEND_DATABASE_URL
: The connection string for Pelican backend's databaseCORS_ALLOWED_ORIGINS
: The origins that are authorized to make cross-site HTTP requestsTOKEN_PATH
: The path to a Googlecredentials.json
fileRABBIT_URL
: The connection string for RabbitMQRABBIT_EXCHANGE_NAME
: The name of the RabbitMQ exchange. Follow the patternpelican_{service}_{environment}
likepelican_data_registry_production
DEFAULT_BASE_TEMPLATE
: The Google Docs ID for the base templateDEFAULT_FIELD_TEMPLATE
: The Google Docs ID for the field-level templateDEFAULT_RESOURCE_TEMPLATE
: The Google Docs ID for the resource-level templateDEFAULT_DATASET_TEMPLATE
: The Google Docs ID for the dataset-level templateDEFAULT_ERROR_TEMPLATE
: The Google Docs ID for the error template
Pelican backend's database is treated as a legacy database, with managed = False
in all model's Meta
class, and with a DATABASE_ROUTERS
setting that routes queries to its database.
To update backend/dqt/models.py
following changes to Pelican backend's database schema:
- Run
python backend/manage.py inspectdb > backend/dqt/models.py
- Replace comments at top of file
- Replace
models.DO_NOTHING
withon_delete=models.CASCADE
Dataset
: Add methodsDatasetFilter.dataset_id_original
: Rename todataset_original
, addrelated_name="dataset_filter_parent"
DatasetFilter.dataset_id_filtered
: Rename todataset_filtered
, addrelated_name="dataset_filter_child"
ProgressMonitorDataset.dataset
: Addrelated_name="progress"
ProgressMonitorItem.item
: Rename todata_item
Report.type
: ChangeTextField
toCharField
, addmax_length=255
, and remove# This field type is a guess.
All commands must be run from the frontend/
directory.
Install dependencies:
npm install
Start a development server:
npm run serve
Prepare a production build:
npm run build
Run tests:
npm run test
Run linters:
npm run lint