feat: Add user deletion capability for admins, add WhiteNoise for Django admin static assets, and configure CSRF_TRUSTED_ORIGINS for production reverse proxies
This commit is contained in:
Binary file not shown.
@@ -12,6 +12,13 @@ DEBUG = os.environ.get('DEBUG', 'True') == 'True'
|
||||
|
||||
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '*').split(',')
|
||||
|
||||
# CSRF & Origin configuration for reverse proxies (Coolify, Traefik, custom domains)
|
||||
raw_csrf = os.environ.get('CSRF_TRUSTED_ORIGINS', '')
|
||||
if raw_csrf:
|
||||
CSRF_TRUSTED_ORIGINS = [o.strip() for o in raw_csrf.split(',') if o.strip()]
|
||||
else:
|
||||
CSRF_TRUSTED_ORIGINS = ['http://*', 'https://*']
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
@@ -34,6 +41,7 @@ AUTH_USER_MODEL = 'users.User'
|
||||
MIDDLEWARE = [
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
@@ -97,6 +105,7 @@ USE_TZ = True
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user