181 lines
4.8 KiB
Python
181 lines
4.8 KiB
Python
|
"""
|
||
|
Django settings for app project.
|
||
|
|
||
|
Generated by 'django-admin startproject' using Django 4.0.6.
|
||
|
|
||
|
For more information on this file, see
|
||
|
https://docs.djangoproject.com/en/4.0/topics/settings/
|
||
|
|
||
|
For the full list of settings and their values, see
|
||
|
https://docs.djangoproject.com/en/4.0/ref/settings/
|
||
|
"""
|
||
|
|
||
|
import os
|
||
|
from pathlib import Path
|
||
|
|
||
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||
|
|
||
|
# Quick-start development settings - unsuitable for production
|
||
|
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||
|
|
||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||
|
# MOVED TO local_settings.py
|
||
|
|
||
|
ALLOWED_HOSTS = []
|
||
|
|
||
|
|
||
|
# Application definition
|
||
|
|
||
|
INSTALLED_APPS = [
|
||
|
"core",
|
||
|
"django.contrib.admin",
|
||
|
"django.contrib.auth",
|
||
|
"django.contrib.contenttypes",
|
||
|
"django.contrib.sessions",
|
||
|
"django.contrib.messages",
|
||
|
"django.contrib.staticfiles",
|
||
|
"debug_toolbar",
|
||
|
"template_profiler_panel",
|
||
|
"django_htmx",
|
||
|
"crispy_forms",
|
||
|
"crispy_bulma",
|
||
|
# "django_tables2",
|
||
|
# "django_tables2_bulma_template",
|
||
|
]
|
||
|
CRISPY_TEMPLATE_PACK = "bulma"
|
||
|
CRISPY_ALLOWED_TEMPLATE_PACKS = ("bulma",)
|
||
|
DJANGO_TABLES2_TEMPLATE = "django-tables2/bulma.html"
|
||
|
|
||
|
MIDDLEWARE = [
|
||
|
"debug_toolbar.middleware.DebugToolbarMiddleware",
|
||
|
"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",
|
||
|
"django_htmx.middleware.HtmxMiddleware",
|
||
|
]
|
||
|
|
||
|
ROOT_URLCONF = "app.urls"
|
||
|
|
||
|
TEMPLATES = [
|
||
|
{
|
||
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||
|
"DIRS": [os.path.join(BASE_DIR, "core/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",
|
||
|
],
|
||
|
},
|
||
|
},
|
||
|
]
|
||
|
|
||
|
WSGI_APPLICATION = "app.wsgi.application"
|
||
|
|
||
|
|
||
|
# Database
|
||
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
||
|
|
||
|
DATABASES = {
|
||
|
"default": {
|
||
|
"ENGINE": "django.db.backends.sqlite3",
|
||
|
"NAME": BASE_DIR / "db.sqlite3",
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
# Password validation
|
||
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
|
||
|
|
||
|
AUTH_PASSWORD_VALIDATORS = [
|
||
|
{"NAME": f"django.contrib.auth.password_validation.{name}"}
|
||
|
for name in [
|
||
|
"UserAttributeSimilarityValidator",
|
||
|
"MinimumLengthValidator",
|
||
|
"CommonPasswordValidator",
|
||
|
"NumericPasswordValidator",
|
||
|
]
|
||
|
]
|
||
|
|
||
|
|
||
|
# Internationalization
|
||
|
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
||
|
|
||
|
LANGUAGE_CODE = "en-us"
|
||
|
|
||
|
TIME_ZONE = "UTC"
|
||
|
|
||
|
USE_I18N = True
|
||
|
|
||
|
USE_TZ = True
|
||
|
|
||
|
|
||
|
# Static files (CSS, JavaScript, Images)
|
||
|
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||
|
|
||
|
STATIC_URL = "static/"
|
||
|
|
||
|
# Default primary key field type
|
||
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
||
|
|
||
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||
|
|
||
|
AUTH_USER_MODEL = "core.User"
|
||
|
|
||
|
LOGIN_REDIRECT_URL = "home"
|
||
|
LOGOUT_REDIRECT_URL = "home"
|
||
|
LOGIN_URL = "/accounts/login/"
|
||
|
|
||
|
# ALLOWED_PAYMENT_METHODS = ["bacs_debit", "card"]
|
||
|
ALLOWED_PAYMENT_METHODS = ["card"]
|
||
|
|
||
|
REST_FRAMEWORK = {
|
||
|
"DEFAULT_PARSER_CLASSES": [
|
||
|
"rest_framework.parsers.JSONParser",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
INTERNAL_IPS = [
|
||
|
"127.0.0.1",
|
||
|
"10.1.10.11",
|
||
|
]
|
||
|
|
||
|
DEBUG_TOOLBAR_PANELS = [
|
||
|
"template_profiler_panel.panels.template.TemplateProfilerPanel",
|
||
|
"debug_toolbar.panels.history.HistoryPanel",
|
||
|
"debug_toolbar.panels.versions.VersionsPanel",
|
||
|
"debug_toolbar.panels.timer.TimerPanel",
|
||
|
"debug_toolbar.panels.settings.SettingsPanel",
|
||
|
"debug_toolbar.panels.headers.HeadersPanel",
|
||
|
"debug_toolbar.panels.request.RequestPanel",
|
||
|
"debug_toolbar.panels.sql.SQLPanel",
|
||
|
"debug_toolbar.panels.staticfiles.StaticFilesPanel",
|
||
|
"debug_toolbar.panels.templates.TemplatesPanel",
|
||
|
"debug_toolbar.panels.cache.CachePanel",
|
||
|
"debug_toolbar.panels.signals.SignalsPanel",
|
||
|
"debug_toolbar.panels.logging.LoggingPanel",
|
||
|
"debug_toolbar.panels.redirects.RedirectsPanel",
|
||
|
"debug_toolbar.panels.profiling.ProfilingPanel",
|
||
|
]
|
||
|
|
||
|
from app.local_settings import * # noqa
|
||
|
|
||
|
if PROFILER: # noqa - trust me its there
|
||
|
import pyroscope
|
||
|
|
||
|
pyroscope.configure(
|
||
|
application_name="neptune",
|
||
|
server_address="http://pyroscope:4040",
|
||
|
auth_token=os.getenv("PYROSCOPE_AUTH_TOKEN", ""),
|
||
|
# tags = {
|
||
|
# "region": f'{os.getenv("REGION")}',
|
||
|
# }
|
||
|
)
|