tardis.default_settings package¶
Submodules¶
tardis.default_settings.admins module¶
-
tardis.default_settings.admins.
ADMINS
= []¶ A list of all the people who get code error notifications. When DEBUG=False and AdminEmailHandler is configured in LOGGING (done by default), Django emails these people the details of exceptions raised in the request/response cycle.
Each item in the list should be a tuple of (Full name, email address). Example:
[(‘John’, ‘john@example.com’), (‘Mary’, ‘mary@example.com’)]
tardis.default_settings.analytics module¶
tardis.default_settings.apps module¶
-
tardis.default_settings.apps.
USER_MENU_MODIFIERS
= ['tardis.apps.sftp.user_menu_modifiers.add_ssh_keys_menu_item', 'tardis.apps.openid_migration.user_menu_modifiers.add_migrate_account_menu_item']¶ A list of methods which can modify the user menu defined in tardis.tardis_portal.context_processors.user_menu_processor The modifications will be applied in order, so it is possible for one app to overwrite changes made by another app whose modifier method is earlier in the list.
Each modifier method should take a django.http.HttpRequest object and a list of user menu items, and return a modified list of user menu items.
An example from the SFTP app is below:
USER_MENU_MODIFIERS.extend([ 'tardis.apps.sftp.user_menu_modifiers.add_ssh_keys_menu_item' ])
tardis.default_settings.apps_default_settings module¶
tardis.default_settings.auth module¶
-
tardis.default_settings.auth.
AUTOGENERATE_API_KEY
= False¶ Generate a tastypie API key with user post_save (tardis/tardis_portal/models/hooks.py)
-
tardis.default_settings.auth.
REGISTRATION_OPEN
= True¶ Enable/disable the self-registration link and form in the UI. Note - this does not actually disable the URL endpoints for registration. You must also remove the registration app from INSTALLED_APPS to disable registration.
tardis.default_settings.caches module¶
-
tardis.default_settings.caches.
CACHES
= {'celery-locks': {'BACKEND': 'django.core.cache.backends.db.DatabaseCache', 'LOCATION': 'celery_lock_cache'}, 'default': {'BACKEND': 'django.core.cache.backends.db.DatabaseCache', 'LOCATION': 'default_cache'}}¶ change the CACHES setting to memcached if you prefer. Requires additional dependencies.
tardis.default_settings.celery_settings module¶
tardis.default_settings.custom_views module¶
-
tardis.default_settings.custom_views.
DATASET_VIEWS
= []¶ Dataset view overrides (‘contextual views’) are specified as tuples mapping a Schema namespace to a class-based view (or view function). See: https://mytardis.readthedocs.io/en/develop/apps/contextual_views.html#dataset-and-experiment-views
e.g.:
DATASET_VIEWS = [ ('http://example.org/schemas/dataset/my_awesome_schema', 'tardis.apps.my_awesome_app.views.CustomDatasetViewSubclass'), ]
-
tardis.default_settings.custom_views.
EXPERIMENT_VIEWS
= []¶ Experiment view overrides (‘contextual views’) are specified as tuples mapping a Schema namespace to a class-based view (or view function). See: https://mytardis.readthedocs.io/en/develop/apps/contextual_views.html#dataset-and-experiment-views
e.g.:
EXPERIMENT_VIEWS = [ ('http://example.org/schemas/expt/my_awesome_schema', 'tardis.apps.my_awesome_app.views.CustomExptViewSubclass'), ]
-
tardis.default_settings.custom_views.
INDEX_VIEWS
= {}¶ A custom index page override is defined in as dictionary mapping a class-based view (or view function) to a Django
Site
, specified by SITE_ID (an integer) or the domain name of the incoming request. See: https://mytardis.readthedocs.io/en/develop/apps/contextual_views.html#custom-index-viewe.g.:
INDEX_VIEWS = { 1: 'tardis.apps.my_custom_app.views.MyCustomIndexSubclass', 'store.example.com': 'tardis.apps.myapp.AnotherCustomIndexSubclass' }
-
tardis.default_settings.custom_views.
LOGIN_VIEWS
= {}¶ A custom login page override is defined in as dictionary mapping a class-based view (or view function) to a Django
Site
, specified by SITE_ID (an integer) or the domain name of the incoming request. See: https://mytardis.readthedocs.io/en/develop/apps/contextual_views.html#custom-login-viewe.g.:
LOGIN_VIEWS = { 1: 'tardis.apps.my_custom_app.views.MyCustomLoginSubclass', 'store.example.com': 'tardis.apps.myapp.AnotherCustomLoginSubclass' }
tardis.default_settings.database module¶
tardis.default_settings.debug module¶
-
tardis.default_settings.debug.
ALLOWED_HOSTS
= ['*']¶ For security reasons this needs to be set to your hostname and/or IP address in production.
-
tardis.default_settings.debug.
DEBUG
= True¶ Set to false for production use
-
tardis.default_settings.debug.
INTERNAL_IPS
= ('127.0.0.1',)¶ - A list of IP addresses, as strings, that:
- Allow the debug() context processor to add some variables to the template context.
tardis.default_settings.downloads module¶
-
tardis.default_settings.downloads.
DEFAULT_ARCHIVE_FORMATS
= ['tar']¶ Site’s preferred archive types, with the most preferred first other available option: ‘tgz’. Add to list if desired
-
tardis.default_settings.downloads.
DOWNLOAD_URI_TEMPLATES
= {}¶ When a file download is requested, by default, MyTardis will create a StreamingHttpResponse to serve the download which requires reading the file from a file-like object. For some storage backends, e.g. S3Boto3Storage provided by the django-storages package, it is more efficient to redirect the request directly to the storage provider.
Or the download request could be handled by an API which is aware of HSM (Hierarchical Storage Management) status for files which could be either on disk or on tape.
The DOWNLOAD_URI_TEMPLATES dictionary can be used to specify a URI template (e.g. ‘/api/v1/s3utils_replica/{dfo_id}/download/’ which can be used to download a DataFileObject, instead of using the default /api/v1/dataset_file/[datafile_id]/download/ endpoint.
For example,
- DOWNLOAD_URI_TEMPLATES = {
- ‘storages.backends.s3boto3.S3Boto3Storage’: ‘/api/v1/s3utils_replica/{dfo_id}/download/’
}
The ‘/api/v1/s3utils_replica/{dfo_id}/download/’ endpoint is provided by the ‘s3utils’ tardis app which needs to be in your INSTALLED_APPS
-
tardis.default_settings.downloads.
PROXY_DOWNLOADS
= False¶ Enable proxying of downloads to NGINX (or another web server)
-
tardis.default_settings.downloads.
PROXY_DOWNLOAD_PREFIXES
= {}¶ The PROXY_DOWNLOAD_PREFIXES dictionary describes the mapping between each directory prefix and the corresponding internal URL prefix:
- PROXY_DOWNLOAD_PREFIXES = {
- ‘/srv/’: ‘/protected/’
}
For downloads not handled by DOWNLOAD_URI_TEMPLATES, an alternative to streaming the downloads from MyTardis is to proxy the download request to NGINX using an X-Accel-Redirect header. You can choose a directory or mountpoint prefix e.g. ‘/srv/’ or ‘/mnt/’ and have MyTardis redirect all download requests to NGINX for files within that directory.
For this to work, the NGINX worker processes need to be able to read the data directories. One way to do this is to configure NGINX to run as the mytardis user, by changing the following in /etc/nginx/nginx.conf:
# user www-data; user mytardisand restarting the NGINX service.
When changing the NGINX user, you also need to delete or change ownership of files in NGINX’s proxy_temp_path (usually /var/lib/nginx/proxy/).
The NGINX location configuration for proxied downloads could look like this:
- location /protected/ {
- internal; alias /srv/;
}
which corresponds to the following PROXY_DOWNLOAD_PREFIXES setting:
- PROXY_DOWNLOAD_PREFIXES = {
- ‘/srv/’: ‘/protected/’
}
-
tardis.default_settings.downloads.
RECALL_URI_TEMPLATES
= {}¶ When a file recall (from tape/archive) is requested, MyTardis can direct the request to an API endpoint provided by the tardis.apps.hsm app, or to another API endpoint which can take a DataFileObject ID and trigger a recall for the corresponding file on the HSM (Hierarchical Storage Management) system.
For example,
- RECALL_URI_TEMPLATES = {
- ‘tardis.apps.hsm.storage.HsmFileSystemStorage’: ‘/api/v1/hsm_replica/{dfo_id}/recall/’
}
tardis.default_settings.email module¶
-
tardis.default_settings.email.
DEFAULT_FROM_EMAIL
= 'webmaster@localhost'¶ This can be set as : “MyTardis Admins <admins@mytardis.org>”
-
tardis.default_settings.email.
EMAIL_HOST
= 'localhost'¶ Set this to your local SMTP server, e.g. ‘smtp.example.edu’ or to a remote SMTP server, e.g. ‘smtp.gmail.com’
-
tardis.default_settings.email.
EMAIL_HOST_PASSWORD
= ''¶ When using a local SMTP server, you probably don’t need to authenticate, so you can leave this blank.
If using a remote SMTP server, this can be set to the password used to authenticate.
-
tardis.default_settings.email.
EMAIL_HOST_USER
= ''¶ When using a local SMTP server, you probably don’t need to authenticate, so you can leave this blank.
If using a remote SMTP server, this can be set to the email address used to authenticate, e.g. ‘bob@bobmail.com’
-
tardis.default_settings.email.
EMAIL_PORT
= 25¶ Some SMTP servers require a different port, e.g. 587. Django’s default value for this setting is 25.
-
tardis.default_settings.email.
EMAIL_USE_TLS
= False¶ Some SMTP servers require this to be set to True. Django’s default value for this setting is False.
tardis.default_settings.filters module¶
-
tardis.default_settings.filters.
FILTERS_TASK_PRIORITY
= 4¶ The default RabbitMQ task priority for messages sent to the filters microservice. Priority 4 is slightly less than the overall default task priority of 5, defined in tardis/default_settings/celery_settings.py
-
tardis.default_settings.filters.
USE_FILTERS
= False¶ If enabled, a task will be sent to RabbitMQ after a file is saved and verified, requesting post-processing, e.g. extracting metadata from file headers and/or generating thumbnail images.
tardis.default_settings.frontend module¶
-
tardis.default_settings.frontend.
BLEACH_ALLOWED_ATTRIBUTES
= {'a': ['href', 'title'], 'abbr': ['title'], 'acronym': ['title']}¶ These are the default bleach values and shown here as an example.
-
tardis.default_settings.frontend.
BLEACH_ALLOWED_TAGS
= ['a', 'abbr', 'acronym', 'b', 'blockquote', 'code', 'em', 'i', 'li', 'ol', 'strong', 'ul']¶ These are the default bleach values and shown here as an example.
-
tardis.default_settings.frontend.
MAX_IMAGES_IN_CAROUSEL
= 100¶ Max number of images in dataset view’s carousel: zero means no limit
-
tardis.default_settings.frontend.
RENDER_IMAGE_DATASET_SIZE_LIMIT
= 0¶ Render image dataset size limit: zero means no limit
In order to display a dataset thumbnail image, MyTardis queries the dataset’s files for image MIME types. These queries can be very slow for large datasets, making page load times slow. In future versions, the dataset thumbnails will be generated asynchronously (not at response time), but for now, we can set RENDER_IMAGE_DATASET_SIZE_LIMIT to the maximum number of files a dataset can have for MyTardis to scan it for image files at response time.
-
tardis.default_settings.frontend.
RENDER_IMAGE_SIZE_LIMIT
= 0¶ Render image file size limit: zero means no limit
tardis.default_settings.i18n module¶
tardis.default_settings.localisation module¶
tardis.default_settings.logging module¶
tardis.default_settings.middlewares module¶
tardis.default_settings.publication module¶
tardis.default_settings.search module¶
Settings for search
-
tardis.default_settings.search.
ELASTICSEARCH_PARALLEL_INDEX_SETTINGS
= {'chunk_size': 500, 'thread_count': 4}¶ Setting for running elastic search index in parallel mode to get indexing speed boost while indexing https://django-elasticsearch-dsl.readthedocs.io/en/latest/settings.html#elasticsearch-dsl-parallel
-
tardis.default_settings.search.
MAX_SEARCH_RESULTS
= 100¶ Limits the maximum number of search results for each model (Experiment, Dataset and DataFile). The default value of 100 means that a query could potentially return 300 results in total, i.e. 100 experiments, 100 datasets and 100 datafiles.
-
tardis.default_settings.search.
MIN_CUTOFF_SCORE
= 0.0¶ Filters results based on this value. The default value of 0.0 means that nothing will be excluded from search results. Set it to any number greater than 0.0 to filter out results.
-
tardis.default_settings.search.
SINGLE_SEARCH_ENABLED
= False¶ To enable search:
SINGLE_SEARCH_ENABLED = True INSTALLED_APPS += (‘django_elasticsearch_dsl’, ‘tardis.app.search’) ELASTICSEARCH_DSL = {
- ‘default’: {
- ‘hosts’: os.environ.get(‘ELASTICSEARCH_URL’, ‘http://localhost:9200’)
}
} ELASTICSEARCH_DSL_INDEX_SETTINGS = {
‘number_of_shards’: 1, ‘number_of_replicas’: 0}
tardis.default_settings.sharing module¶
tardis.default_settings.site_customisations module¶
-
tardis.default_settings.site_customisations.
SITE_TITLE
= 'MyTardis'¶ customise the title of your site
-
tardis.default_settings.site_customisations.
SPONSORED_TEXT
= None¶ add text to the footer to acknowledge someone
tardis.default_settings.static_files module¶
tardis.default_settings.storage module¶
-
tardis.default_settings.storage.
CALCULATE_CHECKSUMS_METHODS
= {}¶ A custom method can be provided for calculating checksums for a storage class, e.g.
- CALCULATE_CHECKSUMS_METHODS = {
- ‘storages.backends.s3boto3.S3Boto3Storage’:
- ‘tardis.apps.s3utils.utils.calculate_checksums’
}
The DataFileObject class’s calculate_checksums method checks for a storage class match in the CALCULATE_CHECKSUMS_METHODS dict, and if one is not found, it calls the classic compute_checksums method which uses the file_object to calculate the checksums one chunk at a time. For some storage backends (e.g. S3), representing the file as file-like object with Django’s file storage API is not the most efficient way to calculate the checksum.
-
tardis.default_settings.storage.
METADATA_STORE_PATH
= '/home/docs/checkouts/readthedocs.org/user_builds/mytardis/checkouts/v4.5.0-rc2/var/store'¶ storage path for image paths stored in parameters. Better to set to another location if possible
-
tardis.default_settings.storage.
REUSE_DATASET_STORAGE_BOX
= True¶ If a new DataFile is created in a Dataset whose files are all stored in the same storage box, then the new file will be stored in the same storage box, irrespective of the “default” StorageBoxAttribute.
The mytardis-app-mydata app has its own logic for determining the appropriate storage box for uploads from a MyData instance. When a MyData instance (an “Uploader”) is approved, it will be assigned a storage box which should be used for DataFileObjects created from MyData uploads.
tardis.default_settings.templates module¶
tardis.default_settings.uploads module¶
-
tardis.default_settings.uploads.
UPLOAD_METHOD
= False¶ Old version: UPLOAD_METHOD = “uploadify”. This can be changed to an app that provides an upload_button function, eg. “tardis.apps.filepicker.views.upload_button” to use a fancy commercial uploader. To use filepicker, please also get an API key at http://filepicker.io