Skip to content

Latest commit

 

History

History
103 lines (69 loc) · 3.27 KB

README.md

File metadata and controls

103 lines (69 loc) · 3.27 KB

Pelican frontend

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.

Getting started

Set up the git pre-commit hook:

pre-commit install

Developer documentation

Django

Getting started

Install development dependencies:

pip install pip-tools
pip-sync requirements_dev.txt

Run database migrations:

python backend/manage.py migrate

Environment variables

See OCP's approach to Django settings. New variables are:

  • PELICAN_BACKEND_DATABASE_URL: The connection string for Pelican backend's database
  • CORS_ALLOWED_ORIGINS: The origins that are authorized to make cross-site HTTP requests
  • TOKEN_PATH: The path to a Google credentials.json file
  • RABBIT_URL: The connection string for RabbitMQ
  • RABBIT_EXCHANGE_NAME: The name of the RabbitMQ exchange. Follow the pattern pelican_{service}_{environment} like pelican_data_registry_production
  • DEFAULT_BASE_TEMPLATE: The Google Docs ID for the base template
  • DEFAULT_FIELD_TEMPLATE: The Google Docs ID for the field-level template
  • DEFAULT_RESOURCE_TEMPLATE: The Google Docs ID for the resource-level template
  • DEFAULT_DATASET_TEMPLATE: The Google Docs ID for the dataset-level template
  • DEFAULT_ERROR_TEMPLATE: The Google Docs ID for the error template

Develop

Pelican backend integration

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 with on_delete=models.CASCADE
  • Dataset: Add methods
  • DatasetFilter.dataset_id_original: Rename to dataset_original, add related_name="dataset_filter_parent"
  • DatasetFilter.dataset_id_filtered: Rename to dataset_filtered, add related_name="dataset_filter_child"
  • ProgressMonitorDataset.dataset: Add related_name="progress"
  • ProgressMonitorItem.item: Rename to data_item
  • Report.type: Change TextField to CharField, add max_length=255, and remove # This field type is a guess.

Vue

All commands must be run from the frontend/ directory.

Getting started

Install dependencies:

npm install

Develop

Start a development server:

npm run serve

Prepare a production build:

npm run build

Test

Run tests:

npm run test

Run linters:

npm run lint