2014-05-18 20:26:31 +02:00
|
|
|
# -*- python -*-
|
|
|
|
# pymode:lint_ignore=E501
|
2016-01-31 16:37:06 +01:00
|
|
|
"""
|
|
|
|
Common settings and globals.
|
2014-05-18 00:07:32 +02:00
|
|
|
|
2016-01-31 16:37:06 +01:00
|
|
|
"""
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
from os.path import abspath, basename, dirname, join, normpath
|
|
|
|
|
2015-01-17 17:50:59 +01:00
|
|
|
from django.contrib.messages import constants as messages
|
2014-05-18 20:26:31 +02:00
|
|
|
|
2016-02-01 23:27:05 +01:00
|
|
|
from gvacommon.settings_utils import get_env_variable
|
2014-05-18 20:26:31 +02:00
|
|
|
|
2014-05-18 00:07:32 +02:00
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### PATH CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# Absolute filesystem path to the Django project directory:
|
|
|
|
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
|
|
|
|
|
|
|
|
# Absolute filesystem path to the top-level project folder:
|
|
|
|
SITE_ROOT = dirname(DJANGO_ROOT)
|
|
|
|
|
|
|
|
# Site name:
|
|
|
|
SITE_NAME = basename(DJANGO_ROOT)
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END PATH CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### DEBUG CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
|
|
|
DEBUG = False
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END DEBUG CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### MANAGER CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
|
|
|
|
ADMINS = (
|
2019-01-30 21:27:25 +01:00
|
|
|
(
|
|
|
|
get_env_variable("GVA_ADMIN_NAME", default="Admin"),
|
|
|
|
get_env_variable("GVA_ADMIN_EMAIL", default="admin@example.org"),
|
|
|
|
),
|
2014-05-18 00:07:32 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
|
|
|
|
MANAGERS = ADMINS
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END MANAGER CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### DATABASE CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
|
|
|
DATABASES = {
|
2019-01-30 21:27:25 +01:00
|
|
|
"default": {
|
|
|
|
"ENGINE": "django.db.backends.postgresql",
|
|
|
|
"NAME": get_env_variable("GVA_PGSQL_DATABASE", default="gnuviechadmin"),
|
|
|
|
"USER": get_env_variable("GVA_PGSQL_USER", default="gnuviechadmin"),
|
|
|
|
"PASSWORD": get_env_variable("GVA_PGSQL_PASSWORD"),
|
|
|
|
"HOST": get_env_variable("GVA_PGSQL_HOSTNAME", default="db"),
|
|
|
|
"PORT": get_env_variable("GVA_PGSQL_PORT", int, default=5432),
|
2014-05-18 00:07:32 +02:00
|
|
|
}
|
|
|
|
}
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END DATABASE CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### GENERAL CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
|
2019-01-30 21:27:25 +01:00
|
|
|
TIME_ZONE = "Europe/Berlin"
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#language-code
|
2019-01-30 21:27:25 +01:00
|
|
|
LANGUAGE_CODE = "en-us"
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id
|
|
|
|
SITE_ID = 1
|
2019-01-30 21:27:25 +01:00
|
|
|
SITES_DOMAIN_NAME = get_env_variable("GVA_DOMAIN_NAME")
|
|
|
|
SITES_SITE_NAME = get_env_variable("GVA_SITE_NAME")
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
|
|
|
|
USE_TZ = True
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END GENERAL CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2019-01-30 21:27:25 +01:00
|
|
|
LOCALE_PATHS = (normpath(join(SITE_ROOT, "gnuviechadmin", "locale")),)
|
2015-01-17 16:06:25 +01:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### MEDIA CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
|
2019-01-30 21:27:25 +01:00
|
|
|
MEDIA_ROOT = normpath(join(SITE_ROOT, "media"))
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
|
2019-01-30 21:27:25 +01:00
|
|
|
MEDIA_URL = "/media/"
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END MEDIA CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
2019-01-30 21:27:25 +01:00
|
|
|
STATIC_URL = "/static/"
|
2014-05-18 00:07:32 +02:00
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS # noqa
|
2019-01-30 21:27:25 +01:00
|
|
|
STATICFILES_DIRS = (normpath(join(SITE_ROOT, "gnuviechadmin", "assets")),)
|
2014-05-18 00:07:32 +02:00
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders # noqa
|
2014-05-18 00:07:32 +02:00
|
|
|
STATICFILES_FINDERS = (
|
2019-01-30 21:27:25 +01:00
|
|
|
"django.contrib.staticfiles.finders.FileSystemFinder",
|
|
|
|
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
2014-05-18 00:07:32 +02:00
|
|
|
)
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END STATIC FILE CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### SECRET CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
|
|
|
# Note: This key should only be used for development and testing.
|
2019-01-30 21:27:25 +01:00
|
|
|
SECRET_KEY = get_env_variable("GVA_SITE_SECRET")
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END SECRET CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### SITE CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# Hosts/domain names that are valid for this site
|
|
|
|
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
|
|
|
|
ALLOWED_HOSTS = []
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END SITE CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### FIXTURE CONFIGURATION
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FIXTURE_DIRS # noqa
|
2019-01-30 21:27:25 +01:00
|
|
|
FIXTURE_DIRS = (normpath(join(SITE_ROOT, "fixtures")),)
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END FIXTURE CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### TEMPLATE CONFIGURATION
|
2015-12-19 20:11:23 +01:00
|
|
|
# See: https://docs.djangoproject.com/en/1.9/ref/settings/#std:setting-TEMPLATES # noqa
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
2019-01-30 21:27:25 +01:00
|
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
|
|
"DIRS": [normpath(join(DJANGO_ROOT, "templates"))],
|
|
|
|
"APP_DIRS": True,
|
|
|
|
"OPTIONS": {
|
|
|
|
"context_processors": [
|
|
|
|
"django.contrib.auth.context_processors.auth",
|
|
|
|
"django.template.context_processors.debug",
|
|
|
|
"django.template.context_processors.i18n",
|
|
|
|
"django.template.context_processors.media",
|
|
|
|
"django.template.context_processors.static",
|
|
|
|
"django.template.context_processors.tz",
|
|
|
|
"django.contrib.messages.context_processors.messages",
|
|
|
|
"django.template.context_processors.request",
|
2015-12-19 20:11:23 +01:00
|
|
|
# custom context processors
|
2019-01-30 21:27:25 +01:00
|
|
|
"gnuviechadmin.context_processors.navigation",
|
|
|
|
"gnuviechadmin.context_processors.version_info",
|
|
|
|
]
|
2015-12-19 20:11:23 +01:00
|
|
|
},
|
2019-01-30 21:27:25 +01:00
|
|
|
}
|
2015-12-19 20:11:23 +01:00
|
|
|
]
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END TEMPLATE CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### MIDDLEWARE CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#middleware-classes
|
2018-11-19 23:28:40 +01:00
|
|
|
MIDDLEWARE = [
|
2014-05-18 00:07:32 +02:00
|
|
|
# Default Django middleware.
|
2019-01-30 21:27:25 +01:00
|
|
|
"django.middleware.common.CommonMiddleware",
|
|
|
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
|
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
|
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
|
|
"django.middleware.locale.LocaleMiddleware",
|
|
|
|
"django.contrib.messages.middleware.MessageMiddleware",
|
2014-05-18 20:26:31 +02:00
|
|
|
# uncomment next line to enable translation to browser locale
|
2019-01-30 21:27:25 +01:00
|
|
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
2018-11-19 23:28:40 +01:00
|
|
|
]
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END MIDDLEWARE CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-01-17 16:28:19 +01:00
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
|
|
# Needed to login by username in Django admin, regardless of `allauth`
|
|
|
|
"django.contrib.auth.backends.ModelBackend",
|
|
|
|
# `allauth` specific authentication methods, such as login by e-mail
|
|
|
|
"allauth.account.auth_backends.AuthenticationBackend",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### URL CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
|
2019-01-30 21:27:25 +01:00
|
|
|
ROOT_URLCONF = "%s.urls" % SITE_NAME
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END URL CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### TEST RUNNER CONFIGURATION
|
2019-01-30 21:27:25 +01:00
|
|
|
TEST_RUNNER = "django.test.runner.DiscoverRunner"
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END TEST RUNNER CONFIGURATION
|
2014-12-17 21:22:37 +01:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### APP CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
DJANGO_APPS = (
|
|
|
|
# Default Django apps:
|
2019-01-30 21:27:25 +01:00
|
|
|
"django.contrib.auth",
|
|
|
|
"django.contrib.contenttypes",
|
|
|
|
"django.contrib.sessions",
|
|
|
|
"django.contrib.sites",
|
|
|
|
"django.contrib.messages",
|
|
|
|
"django.contrib.staticfiles",
|
2014-05-18 00:07:32 +02:00
|
|
|
# Useful template tags:
|
2019-01-30 21:27:25 +01:00
|
|
|
"django.contrib.humanize",
|
2014-05-18 00:07:32 +02:00
|
|
|
# Admin panel and documentation:
|
2019-01-30 21:27:25 +01:00
|
|
|
"django.contrib.admin",
|
2015-02-01 16:34:46 +01:00
|
|
|
# Flatpages for about page
|
2019-01-30 21:27:25 +01:00
|
|
|
"django.contrib.flatpages",
|
|
|
|
"crispy_forms",
|
2014-05-18 00:07:32 +02:00
|
|
|
)
|
|
|
|
|
2015-01-17 16:28:19 +01:00
|
|
|
ALLAUTH_APPS = (
|
2019-01-30 21:27:25 +01:00
|
|
|
"allauth",
|
|
|
|
"allauth.account",
|
|
|
|
"allauth.socialaccount",
|
|
|
|
"allauth.socialaccount.providers.google",
|
|
|
|
"allauth.socialaccount.providers.linkedin_oauth2",
|
|
|
|
"allauth.socialaccount.providers.twitter",
|
2015-01-17 16:28:19 +01:00
|
|
|
)
|
|
|
|
|
2014-05-18 00:07:32 +02:00
|
|
|
# Apps specific for this project go here.
|
|
|
|
LOCAL_APPS = (
|
2019-01-30 21:27:25 +01:00
|
|
|
"dashboard",
|
|
|
|
"taskresults",
|
|
|
|
"ldaptasks",
|
|
|
|
"mysqltasks",
|
|
|
|
"pgsqltasks",
|
|
|
|
"fileservertasks",
|
|
|
|
"webtasks",
|
|
|
|
"domains",
|
|
|
|
"osusers",
|
|
|
|
"managemails",
|
|
|
|
"userdbs",
|
|
|
|
"hostingpackages",
|
|
|
|
"websites",
|
|
|
|
"contact_form",
|
2014-05-18 00:07:32 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
|
2015-01-17 16:28:19 +01:00
|
|
|
INSTALLED_APPS = DJANGO_APPS + ALLAUTH_APPS + LOCAL_APPS
|
2015-01-17 17:50:59 +01:00
|
|
|
|
|
|
|
MESSAGE_TAGS = {
|
2019-01-30 21:27:25 +01:00
|
|
|
messages.DEBUG: "",
|
|
|
|
messages.ERROR: "alert-danger",
|
|
|
|
messages.INFO: "alert-info",
|
|
|
|
messages.SUCCESS: "alert-success",
|
|
|
|
messages.WARNING: "alert-warning",
|
2015-01-17 17:50:59 +01:00
|
|
|
}
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END APP CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### ALLAUTH CONFIGURATION
|
2015-01-18 00:38:33 +01:00
|
|
|
ACCOUNT_EMAIL_REQUIRED = True
|
2019-01-30 21:27:25 +01:00
|
|
|
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
|
|
|
LOGIN_REDIRECT_URL = "/"
|
2015-01-17 17:50:59 +01:00
|
|
|
SOCIALACCOUNT_QUERY_EMAIL = True
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END ALLAUTH CONFIGURATION
|
2015-01-17 17:50:59 +01:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### CRISPY FORMS CONFIGURATION
|
2019-01-30 21:27:25 +01:00
|
|
|
CRISPY_TEMPLATE_PACK = "bootstrap3"
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END CRISPY_FORMS CONFIGURATION
|
2015-01-17 13:58:54 +01:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### LOGGING CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#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/dev/topics/logging for
|
|
|
|
# more details on how to customize your logging configuration.
|
|
|
|
LOGGING = {
|
2019-01-30 21:27:25 +01:00
|
|
|
"version": 1,
|
|
|
|
"disable_existing_loggers": False,
|
|
|
|
"formatters": {
|
|
|
|
"verbose": {
|
|
|
|
"format": "%(levelname)s %(asctime)s %(name)s "
|
|
|
|
"%(module)s:%(lineno)d %(process)d %(thread)d %(message)s"
|
2015-02-01 14:59:36 +01:00
|
|
|
},
|
2019-01-30 21:27:25 +01:00
|
|
|
"simple": {"format": "%(levelname)s %(name)s:%(lineno)d %(message)s"},
|
2015-02-01 14:59:36 +01:00
|
|
|
},
|
2019-01-30 21:27:25 +01:00
|
|
|
"filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
|
|
|
|
"handlers": {
|
|
|
|
"mail_admins": {
|
|
|
|
"level": "ERROR",
|
|
|
|
"filters": ["require_debug_false"],
|
|
|
|
"class": "django.utils.log.AdminEmailHandler",
|
2014-05-18 00:07:32 +02:00
|
|
|
}
|
|
|
|
},
|
2019-01-30 21:27:25 +01:00
|
|
|
"loggers": {
|
|
|
|
"django.request": {
|
|
|
|
"handlers": ["mail_admins"],
|
|
|
|
"level": "ERROR",
|
|
|
|
"propagate": True,
|
2014-05-18 00:07:32 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END LOGGING CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### WSGI CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
2019-01-30 21:27:25 +01:00
|
|
|
WSGI_APPLICATION = "%s.wsgi.application" % SITE_NAME
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END WSGI CONFIGURATION
|
2014-05-18 00:07:32 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### CELERY CONFIGURATION
|
2018-11-19 23:28:40 +01:00
|
|
|
BROKER_URL = get_env_variable(
|
2019-01-30 21:27:25 +01:00
|
|
|
"GVA_BROKER_URL", default="amqp://gnuviechadmin:gnuviechadmin@mq/gnuviechadmin"
|
|
|
|
)
|
|
|
|
BROKER_TRANSPORT_OPTIONS = {
|
|
|
|
"max_retries": 3,
|
|
|
|
"interval_start": 0,
|
|
|
|
"interval_step": 0.2,
|
|
|
|
"interval_max": 0.2,
|
|
|
|
}
|
2018-11-19 23:28:40 +01:00
|
|
|
CELERY_RESULT_BACKEND = get_env_variable(
|
2019-01-30 21:27:25 +01:00
|
|
|
"GVA_RESULTS_REDIS_URL", default="redis://:gnuviechadmin@redis:6379/0"
|
2014-05-30 17:10:22 +02:00
|
|
|
)
|
2019-01-30 21:27:25 +01:00
|
|
|
CELERY_TASK_RESULT_EXPIRES = None
|
|
|
|
CELERY_ROUTES = ("gvacommon.celeryrouters.GvaRouter",)
|
|
|
|
CELERY_TIMEZONE = "Europe/Berlin"
|
2014-12-29 12:57:02 +01:00
|
|
|
CELERY_ENABLE_UTC = True
|
2019-01-30 21:27:25 +01:00
|
|
|
CELERY_ACCEPT_CONTENT = ["json"]
|
|
|
|
CELERY_TASK_SERIALIZER = "json"
|
|
|
|
CELERY_RESULT_SERIALIZER = "json"
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END CELERY CONFIGURATION
|
2014-05-25 23:35:06 +02:00
|
|
|
|
|
|
|
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### CUSTOM APP CONFIGURATION
|
2019-01-30 21:27:25 +01:00
|
|
|
OSUSER_MINUID = get_env_variable("GVA_MIN_OS_UID", int, default=10000)
|
|
|
|
OSUSER_MINGID = get_env_variable("GVA_MIN_OS_GID", int, default=10000)
|
|
|
|
OSUSER_USERNAME_PREFIX = get_env_variable("GVA_OSUSER_PREFIX", default="usr")
|
|
|
|
OSUSER_HOME_BASEPATH = get_env_variable("GVA_OSUSER_HOME_BASEPATH", default="/home")
|
2018-11-19 23:28:40 +01:00
|
|
|
OSUSER_DEFAULT_SHELL = get_env_variable(
|
2019-01-30 21:27:25 +01:00
|
|
|
"GVA_OSUSER_DEFAULT_SHELL", default="/usr/bin/rssh"
|
|
|
|
)
|
|
|
|
OSUSER_SFTP_GROUP = "sftponly"
|
|
|
|
OSUSER_SSH_GROUP = "sshusers"
|
2015-01-24 16:17:39 +01:00
|
|
|
OSUSER_DEFAULT_GROUPS = [OSUSER_SFTP_GROUP]
|
2019-01-30 21:27:25 +01:00
|
|
|
OSUSER_UPLOAD_SERVER = get_env_variable("GVA_OSUSER_UPLOADSERVER", default="file")
|
2018-11-19 23:28:40 +01:00
|
|
|
|
|
|
|
GVA_LINK_WEBMAIL = get_env_variable(
|
2019-01-30 21:27:25 +01:00
|
|
|
"GVA_WEBMAIL_URL", default="https://webmail.example.org/"
|
|
|
|
)
|
2018-11-19 23:28:40 +01:00
|
|
|
GVA_LINK_PHPMYADMIN = get_env_variable(
|
2019-01-30 21:27:25 +01:00
|
|
|
"GVA_PHPMYADMIN_URL", default="https://phpmyadmin.example.org/"
|
|
|
|
)
|
2018-11-19 23:28:40 +01:00
|
|
|
GVA_LINK_PHPPGADMIN = get_env_variable(
|
2019-01-30 21:27:25 +01:00
|
|
|
"GVA_PHPPGADMIN_URL", default="https://phppgadmin.example.org/"
|
|
|
|
)
|
2015-11-22 15:03:47 +01:00
|
|
|
# ######### END CUSTOM APP CONFIGURATION
|
2018-11-19 23:28:40 +01:00
|
|
|
|
2019-01-30 21:27:25 +01:00
|
|
|
GVA_ENVIRONMENT = get_env_variable("GVA_ENVIRONMENT", default="prod")
|
2018-11-19 23:28:40 +01:00
|
|
|
|
|
|
|
# ######### STATIC FILE CONFIGURATION
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
|
2019-01-30 21:27:25 +01:00
|
|
|
STATIC_ROOT = "/srv/gnuviechadmin/static/"
|
|
|
|
|
2018-11-19 23:28:40 +01:00
|
|
|
|
2018-12-26 14:49:56 +01:00
|
|
|
def show_debug_toolbar(request):
|
2019-07-05 21:25:31 +02:00
|
|
|
return DEBUG and GVA_ENVIRONMENT == "local"
|
2018-12-26 14:49:56 +01:00
|
|
|
|
|
|
|
|
2019-01-30 21:27:25 +01:00
|
|
|
if GVA_ENVIRONMENT == "local":
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### DEBUG CONFIGURATION
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
|
|
|
DEBUG = True
|
2019-01-30 21:27:25 +01:00
|
|
|
|
2018-11-19 23:28:40 +01:00
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
|
2019-01-30 21:27:25 +01:00
|
|
|
TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### END DEBUG CONFIGURATION
|
2019-01-30 21:27:25 +01:00
|
|
|
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### EMAIL CONFIGURATION
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
2019-01-30 21:27:25 +01:00
|
|
|
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### END EMAIL CONFIGURATION
|
2019-01-30 21:27:25 +01:00
|
|
|
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### CACHE CONFIGURATION
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
|
2019-01-30 21:27:25 +01:00
|
|
|
CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}}
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### END CACHE CONFIGURATION
|
2019-01-30 21:27:25 +01:00
|
|
|
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### TOOLBAR CONFIGURATION
|
|
|
|
# See: http://django-debug-toolbar.readthedocs.org/en/latest/installation.html#explicit-setup # noqa
|
2019-01-30 21:27:25 +01:00
|
|
|
INSTALLED_APPS += ("debug_toolbar",)
|
|
|
|
|
|
|
|
MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
|
|
|
|
|
|
|
|
LOGGING["handlers"].update(
|
|
|
|
{
|
|
|
|
"console": {
|
|
|
|
"level": "DEBUG",
|
|
|
|
"class": "logging.StreamHandler",
|
|
|
|
"formatter": "simple",
|
|
|
|
}
|
2018-11-19 23:28:40 +01:00
|
|
|
}
|
2019-01-30 21:27:25 +01:00
|
|
|
)
|
|
|
|
LOGGING["loggers"].update(
|
|
|
|
dict(
|
|
|
|
[
|
|
|
|
(key, {"handlers": ["console"], "level": "DEBUG", "propagate": True})
|
|
|
|
for key in [
|
|
|
|
"dashboard",
|
|
|
|
"domains",
|
|
|
|
"fileservertasks",
|
|
|
|
"gvacommon",
|
|
|
|
"gvawebcore",
|
|
|
|
"hostingpackages",
|
|
|
|
"ldaptasks",
|
|
|
|
"managemails",
|
|
|
|
"mysqltasks",
|
|
|
|
"osusers",
|
|
|
|
"pgsqltasks",
|
|
|
|
"taskresults",
|
|
|
|
"userdbs",
|
|
|
|
"websites",
|
|
|
|
]
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2018-11-19 23:28:40 +01:00
|
|
|
DEBUG_TOOLBAR_PATCH_SETTINGS = False
|
2018-12-26 14:49:56 +01:00
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
2019-01-30 21:27:25 +01:00
|
|
|
"SHOW_TOOLBAR_CALLBACK": "gnuviechadmin.settings.show_debug_toolbar"
|
2018-12-26 14:49:56 +01:00
|
|
|
}
|
2019-01-30 21:27:25 +01:00
|
|
|
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### END TOOLBAR CONFIGURATION
|
2019-01-30 21:27:25 +01:00
|
|
|
elif GVA_ENVIRONMENT == "test":
|
2019-07-05 21:25:31 +02:00
|
|
|
ALLOWED_HOSTS = ["localhost"]
|
2019-01-30 21:27:25 +01:00
|
|
|
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
|
|
|
|
LOGGING["handlers"].update(
|
|
|
|
{
|
|
|
|
"console": {
|
|
|
|
"level": "ERROR",
|
|
|
|
"class": "logging.StreamHandler",
|
|
|
|
"formatter": "simple",
|
|
|
|
}
|
2018-11-19 23:28:40 +01:00
|
|
|
}
|
2019-01-30 21:27:25 +01:00
|
|
|
)
|
|
|
|
LOGGING["loggers"].update(
|
|
|
|
dict(
|
|
|
|
[
|
|
|
|
(key, {"handlers": ["console"], "level": "ERROR", "propagate": True})
|
|
|
|
for key in [
|
|
|
|
"dashboard",
|
|
|
|
"domains",
|
|
|
|
"fileservertasks",
|
|
|
|
"gvacommon",
|
|
|
|
"gvawebcore",
|
|
|
|
"hostingpackages",
|
|
|
|
"ldaptasks",
|
|
|
|
"managemails",
|
|
|
|
"mysqltasks",
|
|
|
|
"osusers",
|
|
|
|
"pgsqltasks",
|
|
|
|
"taskresults",
|
|
|
|
"userdbs",
|
|
|
|
"websites",
|
|
|
|
]
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
BROKER_URL = BROKER_URL + "_test"
|
2018-11-19 23:28:40 +01:00
|
|
|
CELERY_RESULT_PERSISTENT = False
|
|
|
|
else:
|
|
|
|
# ######### HOST CONFIGURATION
|
|
|
|
# See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production # noqa
|
|
|
|
ALLOWED_HOSTS = [SITES_DOMAIN_NAME]
|
|
|
|
# ######### END HOST CONFIGURATION
|
|
|
|
|
|
|
|
# ######### EMAIL CONFIGURATION
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
2019-01-30 21:27:25 +01:00
|
|
|
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
|
2018-11-19 23:28:40 +01:00
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix
|
2019-01-30 21:27:25 +01:00
|
|
|
EMAIL_SUBJECT_PREFIX = "[%s] " % SITE_NAME
|
2018-11-19 23:28:40 +01:00
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#default-from-email
|
|
|
|
DEFAULT_FROM_EMAIL = get_env_variable(
|
2019-01-30 21:27:25 +01:00
|
|
|
"GVA_SITE_ADMINMAIL", default="admin@example.org"
|
|
|
|
)
|
2018-11-19 23:28:40 +01:00
|
|
|
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email
|
2019-01-30 21:27:25 +01:00
|
|
|
SERVER_EMAIL = get_env_variable("GVA_SITE_ADMINMAIL", default="admin@example.org")
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### END EMAIL CONFIGURATION
|
|
|
|
|
|
|
|
# ######### CACHE CONFIGURATION
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
|
|
|
|
# CACHES = {}
|
|
|
|
# ######### END CACHE CONFIGURATION
|
|
|
|
|
|
|
|
# ######### ALLAUTH PRODUCTION CONFIGURATION
|
2019-01-30 21:27:25 +01:00
|
|
|
ACCOUNT_EMAIL_SUBJECT_PREFIX = "[Jan Dittberner IT-Consulting & -Solutions] "
|
|
|
|
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
|
2018-11-19 23:28:40 +01:00
|
|
|
# ######### END ALLAUTH PRODUCTION CONFIGURATION
|