Settings

This section covers the newly added settings for the RDMC project configuration.

Custom Django Settings

1. MEDIA_ROOT
  • Description: Specifies the path where uploaded media files will be stored.

  • Default Value: Defined dynamically as the 'upload' directory inside the project's base directory.

  • Example:

MEDIA_ROOT = os.path.join(BASE_DIR, 'upload')
2. MANIFEST_FILE_NAME
  • Description: Name of the manifest file used within the project.

  • Default Value: 'manifest.rdmc'

  • Example:

    MANIFEST_FILE_NAME = 'manifest.rdmc'
    
3. SCHEMA_FILE_NAME
  • Description: Name of the schema file used within the project.

  • Default Value: 'schema.json'

  • Example:

    SCHEMA_FILE_NAME = 'schema.json'
    
4. IS_DEMO
  • Description: A flag used to restrict certain functionalities when running the RDMC in demo mode.

  • Default Value: False unless the environment variable RDMC_RUN_AS_DEMO is set to true.

  • Example:

    IS_DEMO = os.getenv('RDMC_RUN_AS_DEMO', 'false').lower() == 'true'
    
5. CSRF_TRUSTED_ORIGINS
  • Description: A list of trusted origins for CSRF protection.

  • Default Value: ['https://ci.rdmc.nfdixcs.org']

  • Example:

    CSRF_TRUSTED_ORIGINS = ['https://ci.rdmc.nfdixcs.org']
    
6. CORS_ALLOWED_ORIGINS
  • Description: Specifies a list of allowed origins for Cross-Origin Resource Sharing (CORS).

  • Default Value: ['https://ci.rdmc.nfdixcs.org']

  • Example:

    CORS_ALLOWED_ORIGINS = [
        "https://ci.rdmc.nfdixcs.org",
    ]
    
7. Zenodo Integration

Add the following url's to the settings.py file.

ZENODO_AUTHORIZATION_URL = "https://zenodo.org/oauth/authorize"
ZENODO_TOKEN_URL = "https://zenodo.org/oauth/token"
ZENODO_DEPOSIT_URL = "https://zenodo.org/api/deposit/depositions"
ZENODO_UPLOAD_URL = "https://zenodo.org/api/deposit/depositions/{}/files"

and for client_id, client_secret and redirect_url

DEMO = config('DEMO', default=False, cast=bool)

if DEMO:
    ZENODO_CLIENT_ID = config('ZENODO_CLIENT_ID')
    ZENODO_CLIENT_SECRET = config('ZENODO_CLIENT_SECRET')
    ZENODO_REDIRECT_URI = ""
else:
    ZENODO_CLIENT_ID = config('ZENODO_CLIENT_ID')
    ZENODO_CLIENT_SECRET = config('ZENODO_CLIENT_SECRET')
    ZENODO_REDIRECT_URI = "http://127.0.0.1:8000/rdmc/callback"

Security Considerations

  • When running in demo mode (IS_DEMO = True), some functionalities will be restricted to prevent misuse.