-
Notifications
You must be signed in to change notification settings - Fork 65
Settings
Janeway utilises the Django Framework, and the majority of its settings.py variables are well documented on the Django site.
In our example_settings.py this is set to a random string of characters. Before you put Janeway into a prodction environment you must change this.
- SECRET_KEY documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#secret-key
The DEBUG variable determines if Django renders error information rather than a 500 error. Should be True in Development and False in Production.
- DEBUG documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#debug
This setting determines what hosts and domains that Janeway can server. We set this to [*] so that you can add new journals easily, however you can set it to a list of domains that are allowed eg ['www.example.com' 'secure.example.com']
. Janeway's middleware handles allowing all hosts by redirecting those that don't match to the DEFAULT_HOST
setting (see below).
- ALLOWED_HOSTS documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#allowed-hosts
The Templates setting is a list of dictionaries that do a couple of things:
- Determine which template backend you wish to use (Janeway can currently only use DjangoTemplates).
- Determine which directories to look in for templates (you can use this to override templates without actually changing the core of Janeway).
- Adds context processors which inject settings into templates.
- Loaders - to determine how to load templates into Django (we use a custom middleware loader to ensure that the correct set of templates is loaded for each journal and press).
- Builtins - loads a tag, automatically, across all templates.
- TEMPLATES documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#templates
This list allows us to export settings from settings.py into templates so these variables are available to use in templates.
This project is maintained by Jakub Roztocil - https://github.com/jakubroztocil
- SETTINGS_EXPORT documentation: https://github.com/jakubroztocil/django-settings-export
This is used in the event that someone attempts to hit a domain that isn't yet configured as a journal ie. user attempts to connect to journal_one.example.com but its not set up yet, they will be redirected to the DEFAULT_HOST
This setting should look like: DEFAULT_HOST = 'https://www.example.com'
We wont go into a full explaination of Databases within Django as its complex and they have written good documentation on it already, however, we will say that although Janeway by default uses MySQL in example_settings, it will work perfectly with other DB backends supported by Django inc:
-
Postgresql
-
SQLite3
-
Orcale
-
DATABASES documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#databases
This setting is used to find the location of Django Locales files for translating the front end. We automatically add folders for each plugin.
- LOCALE_PATHS documentation: ttps://docs.djangoproject.com/en/1.11/ref/settings/#locale-paths
These settings are used to serve media files. In production this folder should be served by your web server (apache/nginx/whatever) as Django isn't suitable for serving content quickly. When DEBUG is set to True, however, Django will server the media folder for you, though you should only use this in the development environment.
- MEDIA_ROOT documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#media-root
- MEDIA_URL documentatio: https://docs.djangoproject.com/en/1.11/ref/settings/#media-url
These settings are used to server static content, unlike media (which can be uploaded by users), the static folder should be used to store CSS & JS files. Themes each have a build_assets.py which is a file that will generate and/or copy CSS and JS files into the Static Folder.
- STATIC_ROOT documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#static-root
- STATICFILES_DIRS documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#staticfiles-dirs
- STATIC_URL documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#static-url
For rich HTML fields, Janeway uses DJANGO SUMMERNOTE, and the example settings includes a default config for summernote, you can find out more on their documentation page.
- DJANGO-SUMMERNOTE documentation: https://github.com/summernote/django-summernote#options
This group of settings allows you to setup email within Janeway/Django. The default Email Backend is SMTP and comes with the following settings:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = ''
EMAIL_PORT = ''
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = True
Information on SMTP details can be found on your Email Provider's website. At Birkbeck we utilise Mailgun for email as its quite easy to setup and doesn't require management of email servers. Django and Janeway also have a backend specifically for Mailgun so email can be setup like this:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
MAILGUN_ACCESS_KEY = 'key-yourmailgunaccesskey'
MAILGUN_SERVER_NAME = 'example.com'
- EMAIL documentation: https://docs.djangoproject.com/en/1.11/ref/settings/#email
Django mailgun is maiuntained by Bradley Whittington
- Django-Mailgun documentation: https://github.com/BradWhittington/django-mailgun
The plugin_hooks setting is use to setup plugin's template hooks. When Django is started, each plugin register's its hooks and they are stored in this variable.
This works the same as above, but for notification plugins
ORCiD is an identifcation system for academia. Janeway enables you to allow users to login with ORCiD. See the Setting Up ORCiD Login section for more info on how to obtain a Secret and ID for the below settings.
ORCID_API_URL = 'https://pub.orcid.org/v1.2_rc7/'
ORCID_URL = 'https://orcid.org/oauth/authorize'
ORCID_TOKEN_URL = 'https://pub.orcid.org/oauth/token'
ORCID_CLIENT_SECRET = ''
ORCID_CLIENT_ID = ''
Janeway can utilise Amazon's S3 service to store your backups using the backup command. If you want to use S3 for backups, you need to complete the S3 details, you can obtain these from the AWS Console.
S3_ACCESS_KEY = ''
S3_SECRET_KEY = ''
S3_BUCKET_NAME = ''
END_POINT = 'eu-west-2' # eg. eu-west-1
S3_HOST = 's3.eu-west-2.amazonaws.com' # eg. s3.eu-west-1.amazonaws.com
These settings tell the backup command how it should operate
BACKUP_TYPE = 'directory' # s3 or directory
BACKUP_DIR = '/path/to/backup/dir/'
BACKUP_EMAIL = False # If set to True, will send an email each time backup is run
If BACKUP_TYPE is set to 'directory' you will need to provide a path in 'BACKUP_DIR' if it is set to 's3' you must have completed the section above.
This setting determines if we should use domains or paths to get the current journal or press
URL_CONFIG = 'domain' # path or domain
See more information on our path based journals page.
Recaptcha (v2) is a system used to stop bots from submitting form data to your server. You don't have to use it but it is highly recommended.
- Google's Recaptcha Admin page: https://www.google.com/recaptcha/admin#list
All you need to do is add a label, select reCAPTCHA V2 and add a list of domains you will use it with. If you have already added reCAPTCHA you can supplement an existing domain list with the new ones you require.
CAPTCHA_TYPE = 'select a value' # should be either simple_math or recaptcha to enable captcha fields
RECAPTCHA_PRIVATE_KEY = 'your private key'
RECAPTCHA_PUBLIC_KEY = 'your public key'
Wiki has moved to read the docs.