Settings

Here you can find explanations for some of the settings, and how the settings files are distributed.

The different settings files

You can find all the settings files in the directory signbank/settings/.

There are several different files for different purposes:

  • base.py: settings shared with all environments.
  • production.py: production environment specific settings.
  • development.py: development environment specific settings.
  • testing.py: settings for tests.
  • settings_secret.py:
    • Settings you don’t want push to a public git repository.
    • SECRET_KEY and database passwords and such.

base.py

signbank.settings.base.ACCOUNT_ACTIVATION_DAYS

How many days a user has until activation time expires. Django-registration related setting.

signbank.settings.base.AUTHENTICATION_BACKENDS

A list of authentication backend classes (as strings) to use when attempting to authenticate a user.

signbank.settings.base.INSTALLED_APPS

A list of strings designating all applications that are enabled in this Django installation. Dotted Python path to: an application configuration class (preferred), or a package containing an application. The order of the apps matter!

signbank.settings.base.LANGUAGES

A list of all available languages. The list is a list of two-tuples in the format (language code, language name) - for example, (‘ja’, ‘Japanese’).

signbank.settings.base.LANGUAGE_CODE

A string representing the language code for this installation. This should be in standard language ID format. For example, U.S. English is “en-us”.

signbank.settings.base.LOGIN_REDIRECT_URL

The URL where requests are redirected after login when the contrib.auth.login view gets no next parameter.

signbank.settings.base.MIDDLEWARE

A list of middleware classes to use. The order of middleware classes is critical!

signbank.settings.base.REGISTRATION_OPEN

A boolean indicating whether registration of new accounts is currently permitted.

signbank.settings.base.STATICFILES_FINDERS

The list of finder backends that know how to find static files in various locations.

signbank.settings.base.TIME_ZONE

A string representing the time zone for this installation.

signbank.settings.base.USE_I18N

A boolean that specifies whether Django’s translation system should be enabled.

signbank.settings.base.USE_L10N

A boolean that specifies if localized formatting of data will be enabled by default or not.

signbank.settings.base.USE_TZ

A boolean that specifies if datetimes will be timezone-aware by default or not.

signbank.settings.base.VIDEO_UPLOAD_LOCATION

Location for upload of videos relative to MEDIA_ROOT, videos are stored here prior to copying over to the main storage location

development.py

signbank.settings.development.DEBUG

Debug should be True in development but not in production!

signbank.settings.development.EMAIL_BACKEND

To test emailing, use this to show emails in the console

signbank.settings.development.LOCALE_PATHS

A list of directories where Django looks for translation files.

production.py

signbank.settings.production.ALLOWED_HOSTS

IMPORTANT: The hostname that this signbank runs on, this prevents HTTP Host header attacks

signbank.settings.production.CACHES

Use Local-memory caching for specific views (if you have bigger needs, use something else).

signbank.settings.production.DEBUG

IMPORTANT: Debug should always be False in production

signbank.settings.production.DO_LOGGING

Turn off lots of logging.

signbank.settings.production.EMAIL_BACKEND

The backend to use for sending emails.

signbank.settings.production.LOGGING

A sample logging configuration. The only tangible logging performed by this configuration is to send an email to the site admins on every HTTP 500 error when DEBUG=False. See http://docs.djangoproject.com/en/stable/topics/logging for more details on how to customize your logging configuration.

signbank.settings.production.MEDIA_ROOT

Absolute filesystem path to the directory that will hold user-uploaded files.

signbank.settings.production.STATIC_ROOT

The absolute path to the directory where collectstatic will collect static files for deployment. Example: “/var/www/example.com/static/”

signbank.settings.production.UPLOAD_ROOT

Location and URL for uploaded files.

settings_secret.py

signbank.settings.settings_secret.ADMINS

A list of all the people who get code error notifications. When DEBUG=False and a view raises an exception, Django will email these people with the full exception information.

signbank.settings.settings_secret.DATABASES

A dictionary containing the settings for all databases to be used with Django.

signbank.settings.settings_secret.DB_IS_PSQL

Is the database engine used is postgresql?

signbank.settings.settings_secret.PSQL_DB_QUOTA

Maximum size of database in bytes, controlled outside of this application. Fill it in if you have a quota.

signbank.settings.settings_secret.PSQL_DB_NAME

The name of a database used.

signbank.settings.settings_secret.DEFAULT_FROM_EMAIL

Default email address to use for various automated correspondence from the site manager(s). Note: You can also use the following form ‘Webmaster <webmaster@yourdomain.com>’

signbank.settings.settings_secret.EMAIL_HOST

The host to use for sending email.

signbank.settings.settings_secret.EMAIL_PORT

Port to use for the SMTP server defined in EMAIL_HOST.

signbank.settings.settings_secret.SECRET_KEY

Make this unique, and don’t share it with anybody. This is used to provide cryptographic signing.

signbank.settings.settings_secret.SERVER_EMAIL

The email address that error messages come from, such as those sent to ADMINS and MANAGERS. Note: You can also use the following form ‘Webmaster <webmaster@yourdomain.com>’

testing.py

The testing.py settings file currently only imports development.py settings. Edit this file to customize test settings when runnings tests with bin/runtests.py.

When is which settings file applied?

By default when creating a new django project, a manage.py file is created. It is used to run all the management commands, and it applies all the settings.

FinSL-signbank useses separate management files to make it easier to run management commands in different environments with different settings. You can find these files in the bin/ folder:

Note

base.py holds shared settings, and is imported in every settings file. settings_secret.py is then imported in base.py.

  • develop.py: to run the development environment with development.py settings.
  • production.py: to run management commands with production.py settings.
  • runtests.py: to run management commands with testing.py settings.