2023-04-24 20:11:27 +00:00
|
|
|
"""
|
|
|
|
Django settings for artel project.
|
|
|
|
|
|
|
|
Generated by 'django-admin startproject' using Django 4.1.8.
|
|
|
|
|
|
|
|
For more information on this file, see
|
|
|
|
https://docs.djangoproject.com/en/4.1/topics/settings/
|
|
|
|
|
|
|
|
For the full list of settings and their values, see
|
|
|
|
https://docs.djangoproject.com/en/4.1/ref/settings/
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
|
|
import os
|
|
|
|
|
|
|
|
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
BASE_DIR = os.path.dirname(PROJECT_DIR)
|
|
|
|
|
2023-07-14 22:30:40 +00:00
|
|
|
import sentry_sdk
|
|
|
|
from sentry_sdk.integrations.django import DjangoIntegration
|
|
|
|
|
|
|
|
# -> GlitchTip error reporting
|
|
|
|
sentry_sdk.init(
|
2023-07-25 22:31:10 +00:00
|
|
|
dsn=os.environ.get("SENTRY_DSN", ''),
|
2023-07-14 22:30:40 +00:00
|
|
|
integrations=[DjangoIntegration()],
|
|
|
|
auto_session_tracking=False,
|
|
|
|
traces_sample_rate=0
|
|
|
|
)
|
|
|
|
|
2023-07-15 10:42:13 +00:00
|
|
|
SENTRY_ENVIRONMENT = os.environ.get("SENTRY_ENVIRONMENT", '')
|
|
|
|
|
2023-04-24 20:11:27 +00:00
|
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
|
|
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
|
|
|
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
|
|
|
"home",
|
2023-04-27 21:06:28 +00:00
|
|
|
"store",
|
2023-06-22 08:41:42 +00:00
|
|
|
"mailings",
|
2023-04-29 09:51:04 +00:00
|
|
|
"blog",
|
2023-04-24 20:11:27 +00:00
|
|
|
"search",
|
|
|
|
"wagtail.contrib.forms",
|
|
|
|
"wagtail.contrib.redirects",
|
|
|
|
"wagtail.embeds",
|
|
|
|
"wagtail.sites",
|
|
|
|
"wagtail.users",
|
|
|
|
"wagtail.snippets",
|
|
|
|
"wagtail.documents",
|
|
|
|
"wagtail.images",
|
|
|
|
"wagtail.search",
|
|
|
|
"wagtail.admin",
|
2023-04-27 21:06:28 +00:00
|
|
|
'wagtail.contrib.modeladmin',
|
2023-04-24 20:11:27 +00:00
|
|
|
"wagtail",
|
2023-04-29 09:51:04 +00:00
|
|
|
"wagtailmenus",
|
2023-04-24 20:11:27 +00:00
|
|
|
"modelcluster",
|
|
|
|
"taggit",
|
|
|
|
"django.contrib.admin",
|
|
|
|
"django.contrib.auth",
|
|
|
|
"django.contrib.contenttypes",
|
|
|
|
"django.contrib.sessions",
|
|
|
|
"django.contrib.messages",
|
|
|
|
"django.contrib.staticfiles",
|
2023-06-01 20:35:14 +00:00
|
|
|
"rest_framework",
|
|
|
|
"phonenumber_field",
|
2023-04-24 20:11:27 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
MIDDLEWARE = [
|
|
|
|
"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",
|
|
|
|
"django.middleware.security.SecurityMiddleware",
|
|
|
|
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
|
|
|
|
]
|
|
|
|
|
|
|
|
ROOT_URLCONF = "artel.urls"
|
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
|
|
"DIRS": [
|
|
|
|
os.path.join(PROJECT_DIR, "templates"),
|
|
|
|
],
|
|
|
|
"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",
|
2023-04-29 09:51:04 +00:00
|
|
|
'wagtailmenus.context_processors.wagtailmenus',
|
2023-04-24 20:11:27 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
WSGI_APPLICATION = "artel.wsgi.application"
|
|
|
|
|
|
|
|
|
|
|
|
# Database
|
|
|
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
|
2023-05-03 18:17:49 +00:00
|
|
|
import dj_database_url as db_url
|
|
|
|
|
2023-04-24 20:11:27 +00:00
|
|
|
DATABASES = {
|
2023-05-03 18:17:49 +00:00
|
|
|
"default": db_url.parse(
|
2023-05-16 20:48:35 +00:00
|
|
|
os.environ.get("DATABASE_URL", "postgres://comfy:password@db/comfy_shop")
|
2023-05-03 18:17:49 +00:00
|
|
|
)
|
2023-04-24 20:11:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Password validation
|
|
|
|
# https://docs.djangoproject.com/en/4.1/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.1/topics/i18n/
|
|
|
|
|
|
|
|
LANGUAGE_CODE = "en-us"
|
|
|
|
|
|
|
|
TIME_ZONE = "UTC"
|
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/4.1/howto/static-files/
|
|
|
|
|
|
|
|
STATICFILES_FINDERS = [
|
|
|
|
"django.contrib.staticfiles.finders.FileSystemFinder",
|
|
|
|
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
|
|
|
]
|
|
|
|
|
|
|
|
STATICFILES_DIRS = [
|
|
|
|
os.path.join(PROJECT_DIR, "static"),
|
|
|
|
]
|
|
|
|
|
|
|
|
# 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/4.1/ref/contrib/staticfiles/#manifeststaticfilesstorage
|
|
|
|
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
|
|
|
|
|
|
|
|
STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
|
|
|
STATIC_URL = "/static/"
|
|
|
|
|
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
|
|
|
MEDIA_URL = "/media/"
|
|
|
|
|
|
|
|
|
|
|
|
# Wagtail settings
|
|
|
|
|
|
|
|
WAGTAIL_SITE_NAME = "artel"
|
|
|
|
|
|
|
|
# Search
|
|
|
|
# https://docs.wagtail.org/en/stable/topics/search/backends.html
|
|
|
|
WAGTAILSEARCH_BACKENDS = {
|
|
|
|
"default": {
|
|
|
|
"BACKEND": "wagtail.search.backends.database",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Base URL to use when referring to full URLs within the Wagtail admin backend -
|
|
|
|
# e.g. in notification emails. Don't include '/admin' or a trailing slash
|
2023-06-07 23:09:51 +00:00
|
|
|
WAGTAILADMIN_BASE_URL = "https://artel.tepewu.pl"
|
2023-05-14 15:14:44 +00:00
|
|
|
|
2023-06-18 18:58:04 +00:00
|
|
|
# Messages
|
|
|
|
from django.contrib import messages
|
|
|
|
|
|
|
|
MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"
|
|
|
|
MESSAGE_TAGS = {
|
|
|
|
messages.DEBUG: "debug",
|
|
|
|
messages.INFO: "info",
|
|
|
|
messages.SUCCESS: "success",
|
|
|
|
messages.WARNING: "warning",
|
|
|
|
messages.ERROR: "danger",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-14 15:14:44 +00:00
|
|
|
# STORE SETTINGS
|
|
|
|
PRODUCTS_PER_PAGE = 6
|
2023-05-22 19:27:59 +00:00
|
|
|
|
|
|
|
# CART settings
|
|
|
|
CART_SESSION_ID = 'cart'
|
2023-06-07 23:09:51 +00:00
|
|
|
|
|
|
|
# EMAIL settings
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
|
|
EMAIL_HOST = os.environ.get('EMAIL_HOST', 'smtp.gmail.com')
|
|
|
|
EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER', '')
|
|
|
|
EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_HOST_PASSWORD", '')
|
|
|
|
EMAIL_PORT = os.environ.get('EMAIL_PORT', 587)
|
2023-06-18 14:18:00 +00:00
|
|
|
EMAIL_USE_TLS = True
|
2023-06-22 21:44:22 +00:00
|
|
|
DEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL', 'artel-sklep@tepewu.pl')
|
2023-07-25 22:31:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
LOGGING = {
|
|
|
|
"version": 1,
|
|
|
|
"disable_existing_loggers": False,
|
|
|
|
"handlers": {
|
|
|
|
"console": {
|
|
|
|
"class": "logging.StreamHandler",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"root": {
|
|
|
|
"handlers": ["console"],
|
|
|
|
"level": "WARNING",
|
|
|
|
},
|
|
|
|
}
|