Portal.Config

Configuration

class portal.config.config.BaseConfig

Base configuration - override in subclasses

class portal.config.config.DefaultConfig

Default configuration

class portal.config.config.TestConfig

Testing configuration - used by unit tests

portal.config.config.best_sql_url()

Return compliant sql url from available environment variables

portal.config.config.testing_sql_url()

Return compliant sql url from available environment variables

If tests are being run with pytest-xdist workers, a pre-existing database will be required for each worker, suffixed with the worker index.

SitePersistence Module

class portal.config.site_persistence.ModelDetails(cls, sequence_name, lookup_field)
cls

Alias for field number 0

lookup_field

Alias for field number 2

sequence_name

Alias for field number 1

class portal.config.site_persistence.SitePersistence(target_dir)

Manage import and export of dynamic site data

export(staging_exclusion=False)

Generate JSON files defining dynamic site objects

Parameters:staging_exclusion – set only if persisting exclusions to retain on staging when pulling over production data

Export dynamic data, such as Organizations and Access Strategies for import into other sites. This does NOT export values expected to live in the site config file or the static set generated by the seed managment command.

To import the data, use the seed command as defined in manage.py

import_(keep_unmentioned, staging_exclusion=False)

If persistence file is found, import the data

Parameters:
  • keep_unmentioned – if True, unmentioned data, such as an organization or intervention in the current database but not in the persistence file, will be left in place. if False, any unmentioned data will be purged as part of the import process.
  • staging_exclusion – set only if persisting exclusions to retain on staging when pulling over production data