180 lines
4.5 KiB
Python
180 lines
4.5 KiB
Python
import datetime
|
|
from config.settings.environ import * # noqa
|
|
|
|
APP_NAME = "Shop"
|
|
DESCRIPTION = ""
|
|
VERSION = "0.1.0"
|
|
|
|
|
|
DJANGO_APPS = [
|
|
"unfold", # before django.contrib.admin
|
|
"django.contrib.admin",
|
|
"django.contrib.auth",
|
|
"django.contrib.contenttypes",
|
|
"django.contrib.sessions",
|
|
"django.contrib.messages",
|
|
"django.contrib.staticfiles",
|
|
# 'django.contrib.gis', -- Requires gdal-bin
|
|
]
|
|
|
|
THIRD_PARTY_APPS = [
|
|
"corsheaders",
|
|
"django_extensions",
|
|
"django_filters",
|
|
"watchman",
|
|
"drf_spectacular",
|
|
]
|
|
|
|
PROJECT_APPS = [
|
|
"shop",
|
|
"tpv",
|
|
]
|
|
|
|
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + PROJECT_APPS
|
|
|
|
PROJECT_MIDDLEWARE = []
|
|
|
|
DJANGO_MIDDLEWARE = [
|
|
"django.middleware.security.SecurityMiddleware",
|
|
"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",
|
|
]
|
|
|
|
MIDDLEWARE = DJANGO_MIDDLEWARE + PROJECT_MIDDLEWARE
|
|
|
|
ROOT_URLCONF = "config.urls"
|
|
|
|
TEMPLATES = [
|
|
{
|
|
"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",
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = "config.wsgi.application"
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
"default": DATABASE_URL,
|
|
}
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
{
|
|
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
|
},
|
|
{
|
|
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
|
},
|
|
{
|
|
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
|
},
|
|
{
|
|
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
|
},
|
|
]
|
|
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/4.2/topics/i18n/
|
|
|
|
LANGUAGE_CODE = "es-es"
|
|
|
|
TIME_ZONE = "Europe/Madrid"
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
|
|
|
STATIC_URL = "/static/"
|
|
STATIC_ROOT = BASE_DIR / "static"
|
|
|
|
MEDIA_URL = "/media/"
|
|
MEDIA_ROOT = BASE_DIR / "media"
|
|
|
|
STORAGES = {
|
|
"default": {
|
|
"BACKEND": "django.core.files.storage.FileSystemStorage",
|
|
},
|
|
"staticfiles": {
|
|
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
|
|
},
|
|
}
|
|
|
|
|
|
# Django Rest Framework Configuration
|
|
REST_FRAMEWORK = {
|
|
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
|
|
"DEFAULT_AUTHENTICATION_CLASSES": (
|
|
"rest_framework_simplejwt.authentication.JWTAuthentication",
|
|
"rest_framework.authentication.SessionAuthentication",
|
|
"rest_framework.authentication.BasicAuthentication",
|
|
),
|
|
"DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",),
|
|
"DEFAULT_FILTER_BACKENDS": [
|
|
"rest_framework.filters.OrderingFilter",
|
|
"django_filters.rest_framework.DjangoFilterBackend",
|
|
"rest_framework.filters.SearchFilter",
|
|
],
|
|
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
|
|
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
|
"PAGE_SIZE": PAGE_SIZE,
|
|
}
|
|
|
|
JWT_AUTH = {
|
|
"JWT_SECRET_KEY": SECRET_KEY,
|
|
"JWT_VERIFY": True,
|
|
"JWT_VERIFY_EXPIRATION": True,
|
|
"JWT_EXPIRATION_DELTA": datetime.timedelta(days=7),
|
|
"JWT_ALLOW_REFRESH": True,
|
|
"JWT_REFRESH_EXPIRATION_DELTA": datetime.timedelta(days=7),
|
|
"JWT_AUTH_HEADER_PREFIX": "JWT",
|
|
"JWT_AUTH_COOKIE": "jwt",
|
|
}
|
|
|
|
LOCALE_PATHS = [
|
|
BASE_DIR / "locale",
|
|
]
|
|
|
|
if S3_ENABLED:
|
|
STORAGES["default"] = {
|
|
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
|
|
}
|
|
|
|
WATCHMAN_STORAGE_PATH = "tmp"
|
|
|
|
SPECTACULAR_SETTINGS = {
|
|
"TITLE": APP_NAME,
|
|
"DESCRIPTION": DESCRIPTION,
|
|
"VERSION": VERSION,
|
|
"SERVE_INCLUDE_SCHEMA": False,
|
|
}
|
|
|
|
CELERY_BROKER_URL = env.str("CELERY_BROKER_URL", default="redis://172.17.0.1:6379/0")
|
|
CELERY_TIME_ZONE = TIME_ZONE
|
|
CELERY_ALWAYS_EAGER = DEBUG
|