cineclub-site/server/ulm_cine_club_api/settings/base.py

131 lines
3.8 KiB
Python
Raw Normal View History

2022-04-03 01:20:53 +02:00
"""
Django settings for open_democracy_back project.
2022-04-03 01:20:53 +02:00
Generated by 'django-admin startproject' using Django 3.2.11.
2022-04-03 01:20:53 +02:00
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import locale
import getconf
2022-04-03 01:20:53 +02:00
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
config = getconf.ConfigGetter(
"cineClub",
["./local_settings.ini"],
)
2022-04-03 01:20:53 +02:00
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# Application definition
INSTALLED_APPS = [
2022-04-03 01:20:54 +02:00
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"myapi.apps.MyapiConfig",
"rest_framework",
"corsheaders",
2022-04-03 01:20:53 +02:00
]
MIDDLEWARE = [
2022-04-03 01:20:54 +02:00
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"corsheaders.middleware.CorsMiddleware",
2022-04-03 01:20:54 +02:00
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
2022-04-03 01:20:53 +02:00
]
2022-04-03 01:20:54 +02:00
ROOT_URLCONF = "ulm_cine_club_api.urls"
2022-04-03 01:20:53 +02:00
TEMPLATES = [
{
2022-04-03 01:20:54 +02:00
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"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",
2022-04-03 01:20:53 +02:00
],
},
},
]
2022-04-03 01:20:54 +02:00
WSGI_APPLICATION = "ulm_cine_club_api.wsgi.application"
2022-04-03 01:20:53 +02:00
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
2022-04-03 01:20:54 +02:00
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
2022-04-03 01:20:53 +02:00
},
{
2022-04-03 01:20:54 +02:00
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
2022-04-03 01:20:53 +02:00
},
{
2022-04-03 01:20:54 +02:00
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
2022-04-03 01:20:53 +02:00
},
{
2022-04-03 01:20:54 +02:00
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
2022-04-03 01:20:53 +02:00
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
LANGUAGE_CODE = "fr"
2022-05-29 22:46:45 +02:00
DATETIME_FORMAT = "%Y-%m-%dT%H:%M"
TIME_ZONE = "Europe/Paris"
2022-04-03 01:20:53 +02:00
USE_I18N = True
USE_L10N = True
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
2022-04-03 01:20:53 +02:00
# ManifestStaticFilesStorage is recommended in production, to prevent outdated
# JavaScript / CSS assets being served from cache (e.g. after a Wagtail upgrade).
# See https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#manifeststaticfilesstorage
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
2022-04-03 01:20:53 +02:00
STATIC_ROOT = BASE_DIR / "static"
2022-04-03 01:20:54 +02:00
STATIC_URL = "/static/"
2022-04-03 01:20:53 +02:00
MEDIA_ROOT = BASE_DIR / "media"
MEDIA_URL = "/media/"
2022-04-03 01:20:53 +02:00
2022-04-03 01:20:54 +02:00
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
REST_FRAMEWORK = {
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.AllowAny",),
"DEFAULT_RENDERER_CLASSES": (
"djangorestframework_camel_case.render.CamelCaseJSONRenderer",
"djangorestframework_camel_case.render.CamelCaseBrowsableAPIRenderer",
),
"DEFAULT_PARSER_CLASSES": (
"djangorestframework_camel_case.parser.CamelCaseFormParser",
"djangorestframework_camel_case.parser.CamelCaseMultiPartParser",
"djangorestframework_camel_case.parser.CamelCaseJSONParser",
),
}
2022-06-10 00:18:56 +02:00
TMDB_API_KEY = config.getstr("tmdb.api_key")