- New Features - Introduce `AUTH_USER_MODEL` for a custom user. - Add `STATICFILES_DIRS` to explicitly point to the static directory. - Simplify email backend configuration using environment variables. - Enhancements - Remove djinit boilerplate and development‑only settings. - Drop `corsheaders` middleware and `rest_framework_simplejwt.token_blacklist`. - Update `TEMPLATES` to include project templates via `BASE_DIR / "templates"`. - Clean up URL patterns, removing deprecated JWT endpoint comments. - Reorganize security settings and static storage configuration. - Bug Fixes - (none)
135 lines
3.7 KiB
Python
135 lines
3.7 KiB
Python
from pathlib import Path
|
|
|
|
import environ
|
|
|
|
env = environ.Env()
|
|
environ.Env.read_env()
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
|
|
|
THIRD_PARTY_APPS = [
|
|
"django_tailwind_cli",
|
|
"django_htmx",
|
|
]
|
|
|
|
USER_DEFINED_APPS = [
|
|
"apps.accounts.apps.AccountsConfig",
|
|
"apps.projects.apps.ProjectsConfig",
|
|
"apps.finance.apps.FinanceConfig",
|
|
"apps.kanban.apps.KanbanConfig",
|
|
"apps.issues.apps.IssuesConfig",
|
|
"apps.tickets.apps.TicketsConfig",
|
|
"apps.activity.apps.ActivityConfig",
|
|
]
|
|
|
|
BUILT_IN_APPS = [
|
|
"django.contrib.admin",
|
|
"django.contrib.auth",
|
|
"django.contrib.contenttypes",
|
|
"django.contrib.sessions",
|
|
"django.contrib.messages",
|
|
"django.contrib.staticfiles",
|
|
]
|
|
|
|
INSTALLED_APPS = BUILT_IN_APPS + THIRD_PARTY_APPS + USER_DEFINED_APPS
|
|
INSTALLED_APPS.insert(0, "jazzmin")
|
|
|
|
MIDDLEWARE = [
|
|
"django.middleware.security.SecurityMiddleware",
|
|
"whitenoise.middleware.WhiteNoiseMiddleware",
|
|
"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 = "config.urls"
|
|
|
|
TEMPLATES = [
|
|
{
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
"DIRS": [BASE_DIR / "templates"],
|
|
"APP_DIRS": True,
|
|
"OPTIONS": {
|
|
"context_processors": [
|
|
"django.template.context_processors.request",
|
|
"django.contrib.auth.context_processors.auth",
|
|
"django.contrib.messages.context_processors.messages",
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = "config.wsgi.application"
|
|
|
|
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"},
|
|
]
|
|
|
|
LANGUAGE_CODE = "en-us"
|
|
TIME_ZONE = "UTC"
|
|
USE_I18N = True
|
|
USE_TZ = True
|
|
|
|
STATIC_URL = "/static/"
|
|
STATIC_ROOT = BASE_DIR / "staticfiles"
|
|
STATICFILES_DIRS = [BASE_DIR / "static/"]
|
|
|
|
MEDIA_URL = "/media/"
|
|
MEDIA_ROOT = BASE_DIR / "media"
|
|
|
|
STORAGES = {
|
|
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
|
|
"staticfiles": {"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage"},
|
|
}
|
|
|
|
AUTH_USER_MODEL = "accounts.CustomUser"
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
|
|
LOGIN_URL = "/accounts/login/"
|
|
LOGIN_REDIRECT_URL = "/"
|
|
LOGOUT_REDIRECT_URL = "/accounts/login/"
|
|
|
|
SECURE_BROWSER_XSS_FILTER = True
|
|
SECURE_CONTENT_TYPE_NOSNIFF = True
|
|
X_FRAME_OPTIONS = "DENY"
|
|
|
|
TAILWIND_CLI_VERSION = "2.7.8"
|
|
TAILWIND_CLI_USE_DAISY_UI = True
|
|
TAILWIND_CLI_CONFIG = {
|
|
"theme": {
|
|
"extend": {
|
|
"colors": {
|
|
"primary": "#DC2626",
|
|
"secondary": "#EF4444",
|
|
"accent": "#FCFECC",
|
|
}
|
|
}
|
|
},
|
|
"daisyui": {
|
|
"themes": [
|
|
{
|
|
"light": {
|
|
"primary": "#DC2626",
|
|
"secondary": "#EF4444",
|
|
"accent": "#FCFECC",
|
|
"neutral": "#1a1a2e",
|
|
"base-100": "#ffffff",
|
|
"base-200": "#f8fafc",
|
|
"base-300": "#e2e8f0",
|
|
"info": "#0E4D80",
|
|
"success": "#16a34a",
|
|
"warning": "#f59e0b",
|
|
"error": "#DC2626",
|
|
}
|
|
}
|
|
]
|
|
},
|
|
}
|