2021-02-27 20:07:48 +00:00
|
|
|
from pathlib import Path
|
2021-02-28 22:03:32 +00:00
|
|
|
|
2021-02-28 22:55:01 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2021-02-27 20:07:48 +00:00
|
|
|
from environs import Env
|
2018-06-23 11:00:26 +00:00
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
env = Env()
|
|
|
|
env.read_env()
|
2018-06-23 11:00:26 +00:00
|
|
|
|
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
2021-02-28 22:55:01 +00:00
|
|
|
PROJECT_DIR = BASE_DIR / "project"
|
2018-06-23 11:00:26 +00:00
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
SECRET_KEY = env.str("SECRET_KEY", default="something-very-secret")
|
2018-06-23 11:00:26 +00:00
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
DEBUG = env.bool("DEBUG", default=False)
|
2018-06-23 11:00:26 +00:00
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["*"])
|
2018-06-23 11:00:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
2019-08-31 22:27:36 +00:00
|
|
|
"django.contrib.admin",
|
|
|
|
"django.contrib.auth",
|
|
|
|
"django.contrib.contenttypes",
|
|
|
|
"django.contrib.sessions",
|
|
|
|
"django.contrib.messages",
|
|
|
|
"django.contrib.staticfiles",
|
|
|
|
"django.contrib.sites",
|
2021-02-27 20:07:48 +00:00
|
|
|
"debug_toolbar",
|
|
|
|
"allauth",
|
|
|
|
"allauth.account",
|
2021-02-28 11:41:10 +00:00
|
|
|
"utils",
|
2019-08-31 22:27:36 +00:00
|
|
|
"accounting",
|
|
|
|
"membership",
|
2018-06-23 11:00:26 +00:00
|
|
|
]
|
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
DATABASES = {"default": env.dj_db_url("DATABASE_URL")}
|
|
|
|
|
2018-06-23 11:00:26 +00:00
|
|
|
MIDDLEWARE = [
|
2019-08-31 22:27:36 +00:00
|
|
|
"django.middleware.security.SecurityMiddleware",
|
2021-03-01 19:34:51 +00:00
|
|
|
"whitenoise.middleware.WhiteNoiseMiddleware",
|
2019-08-31 22:27:36 +00:00
|
|
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
|
|
"django.middleware.common.CommonMiddleware",
|
|
|
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
|
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
|
|
"django.contrib.messages.middleware.MessageMiddleware",
|
|
|
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
2021-02-27 20:07:48 +00:00
|
|
|
"debug_toolbar.middleware.DebugToolbarMiddleware",
|
2018-06-23 11:00:26 +00:00
|
|
|
]
|
|
|
|
|
2019-08-31 22:27:36 +00:00
|
|
|
ROOT_URLCONF = "project.urls"
|
2018-06-23 11:00:26 +00:00
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
2019-08-31 22:27:36 +00:00
|
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
2021-02-28 22:55:01 +00:00
|
|
|
"DIRS": [PROJECT_DIR / "templates"],
|
2019-08-31 22:27:36 +00:00
|
|
|
"APP_DIRS": True,
|
|
|
|
"OPTIONS": {
|
|
|
|
"context_processors": [
|
|
|
|
"django.template.context_processors.debug",
|
|
|
|
"django.template.context_processors.request",
|
|
|
|
"django.contrib.auth.context_processors.auth",
|
|
|
|
"django.contrib.messages.context_processors.messages",
|
|
|
|
"project.context_processors.current_site",
|
|
|
|
]
|
2018-06-23 11:00:26 +00:00
|
|
|
},
|
2019-08-31 22:27:36 +00:00
|
|
|
}
|
2018-06-23 11:00:26 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
AUTHENTICATION_BACKENDS = (
|
2019-08-31 22:27:36 +00:00
|
|
|
"django.contrib.auth.backends.ModelBackend",
|
|
|
|
"allauth.account.auth_backends.AuthenticationBackend",
|
2018-06-23 11:00:26 +00:00
|
|
|
)
|
|
|
|
|
2019-08-31 22:27:36 +00:00
|
|
|
WSGI_APPLICATION = "project.wsgi.application"
|
2018-06-23 11:00:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
|
|
{
|
2019-08-31 22:27:36 +00:00
|
|
|
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator" # noqa
|
2018-06-23 11:00:26 +00:00
|
|
|
},
|
2019-08-31 22:27:36 +00:00
|
|
|
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"}, # noqa
|
|
|
|
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"}, # noqa
|
2018-06-23 11:00:26 +00:00
|
|
|
]
|
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
LANGUAGE_CODE = "da-dk"
|
2019-08-31 18:46:49 +00:00
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
TIME_ZONE = "Europe/Copenhagen"
|
2018-06-23 11:00:26 +00:00
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
2019-08-31 22:27:36 +00:00
|
|
|
STATIC_URL = "/static/"
|
2021-02-28 22:55:01 +00:00
|
|
|
STATICFILES_DIRS = [PROJECT_DIR / "static"]
|
2021-03-01 16:13:15 +00:00
|
|
|
STATIC_ROOT = BASE_DIR / "static"
|
2019-08-31 18:46:49 +00:00
|
|
|
|
2018-06-23 12:59:12 +00:00
|
|
|
SITE_ID = 1
|
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
LOGIN_REDIRECT_URL = "/"
|
|
|
|
|
2019-08-31 22:27:36 +00:00
|
|
|
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
2018-06-23 19:08:56 +00:00
|
|
|
|
2021-02-27 20:07:48 +00:00
|
|
|
# Always show DDT in development for any IP, not just 127.0.0.1 or
|
|
|
|
# settings.INTERNAL_IPS. This is useful in a docker setup where the
|
|
|
|
# requesting IP isn't static.
|
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
|
|
"SHOW_TOOLBAR_CALLBACK": lambda _x: DEBUG,
|
|
|
|
}
|
|
|
|
|
2019-08-31 22:27:36 +00:00
|
|
|
CURRENCIES = ("DKK",)
|
|
|
|
CURRENCY_CHOICES = [("DKK", "DKK")]
|
2021-02-27 22:18:27 +00:00
|
|
|
|
2021-02-28 22:55:01 +00:00
|
|
|
LANGUAGES = [
|
|
|
|
("da", _("Danish")),
|
|
|
|
("en", _("English")),
|
|
|
|
]
|
|
|
|
|
|
|
|
# We store all translations in one location
|
|
|
|
LOCALE_PATHS = [PROJECT_DIR / "locale"]
|
2021-02-27 22:18:27 +00:00
|
|
|
|
|
|
|
# Allauth configuration
|
|
|
|
ACCOUNT_AUTHENTICATION_METHOD = "email"
|
|
|
|
ACCOUNT_EMAIL_REQUIRED = True
|
|
|
|
ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE = False
|
2021-02-28 22:03:32 +00:00
|
|
|
ACCOUNT_USERNAME_REQUIRED = False
|