New Features - Add ASGI entry point (`asgi.py`) with environment‑based settings. - Create base and production settings modules (`base.py`, `production.py`) for shared and production‑specific configurations. - Generate root `urls.py` with DRF JWT endpoints and included app URLs. - Provide `wsgi.py` configured for production settings. Enhancements - Include `django-jazzmin`, `drf-spectacular`, and `django-cors-headers` defaults. - Set up `django-tailwind-cli` and `django-htmx` middleware configurations. Bug Fixes - (none)
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
"""generated with djinit"""
|
|
|
|
from .base import *
|
|
import dj_database_url
|
|
|
|
DEBUG = False
|
|
SECRET_KEY = env('SECRET_KEY')
|
|
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[])
|
|
|
|
# Database
|
|
# Using dj_database_url (recommended for production)
|
|
DATABASES = {
|
|
'default': env.db('DATABASE_URL')
|
|
}
|
|
|
|
# CORS settings for production
|
|
# Filter out empty strings from FRONTEND_URL
|
|
CORS_ALLOWED_ORIGINS = env.list('FRONTEND_URL', default=[])
|
|
CORS_ALLOW_CREDENTIALS = True
|
|
|
|
# Additional CORS security for production
|
|
CORS_ALLOW_PRIVATE_NETWORK = False
|
|
|
|
# Email settings
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
EMAIL_HOST = env('EMAIL_HOST', default="smtp.gmail.com")
|
|
EMAIL_PORT = env.int('EMAIL_PORT', default=587)
|
|
EMAIL_USE_TLS = env.bool('EMAIL_USE_TLS', default=True)
|
|
EMAIL_HOST_USER = env('EMAIL_HOST_USER', default="")
|
|
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD', default="")
|
|
DEFAULT_FROM_EMAIL = env('EMAIL_HOST_USER', default="")
|
|
SERVER_EMAIL = env('EMAIL_HOST_USER', default="")
|
|
|
|
# Security settings for production
|
|
SECURE_SSL_REDIRECT = True
|
|
SECURE_HSTS_SECONDS = 31536000
|
|
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
|
|
SECURE_HSTS_PRELOAD = True
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
|
|
# Session settings
|
|
SESSION_COOKIE_SECURE = True
|
|
CSRF_COOKIE_SECURE = True
|
|
|
|
# Static files
|
|
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
|
|
|
## Tailwind
|
|
TAILWIND_CLI_VERSION = "4.1.3" # Pin version
|
|
TAILWIND_CLI_AUTOMATIC_DOWNLOAD = False # Use pre-installed CLI
|
|
TAILWIND_CLI_DIST_CSS = "static/css/tailwind.min.css" |