198 lines
5.4 KiB
Python
198 lines
5.4 KiB
Python
import os
|
|
from pathlib import Path
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
|
|
|
|
# DEBUG = os.environ.get('DJANGO_DEBUG', 'False') == 'True'
|
|
#
|
|
# ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', '*').split(',')
|
|
|
|
DEBUG = False
|
|
|
|
ALLOWED_HOSTS = [
|
|
'db.eventifyplus.com',
|
|
'uat.eventifyplus.com',
|
|
'em.eventifyplus.com',
|
|
'backend.eventifyplus.com',
|
|
'admin.eventifyplus.com',
|
|
'app.eventifyplus.com',
|
|
'localhost',
|
|
'127.0.0.1',
|
|
]
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'eventify_logger',
|
|
'master_data',
|
|
'events',
|
|
'accounts',
|
|
'partner',
|
|
'templatetags',
|
|
'mobile_api',
|
|
'web_api',
|
|
'bookings',
|
|
'banking_operations',
|
|
'rest_framework',
|
|
'rest_framework.authtoken',
|
|
'rest_framework_simplejwt',
|
|
'admin_api',
|
|
'django_summernote',
|
|
'ledger',
|
|
'notifications',
|
|
]
|
|
|
|
INSTALLED_APPS += [
|
|
"corsheaders",
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'corsheaders.middleware.CorsMiddleware',
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'eventify_logger.middleware.EventifyLoggingMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
'corsheaders.middleware.CorsMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
]
|
|
|
|
CORS_ALLOWED_ORIGINS = [
|
|
"https://app.eventifyplus.com",
|
|
"https://admin.eventifyplus.com",
|
|
"https://uat.eventifyplus.com",
|
|
"http://localhost:5178",
|
|
"http://localhost:5179",
|
|
"http://localhost:5173",
|
|
"http://localhost:3001",
|
|
"http://localhost:3000",
|
|
"http://localhost:8080",
|
|
"https://prototype.eventifyplus.com",
|
|
"https://eventifyplus.com",
|
|
"https://mv.eventifyplus.com",
|
|
"https://db.eventifyplus.com",
|
|
"https://test.eventifyplus.com",
|
|
"https://em.eventifyplus.com"
|
|
]
|
|
|
|
ROOT_URLCONF = 'eventify.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [BASE_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',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'eventify.wsgi.application'
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.sqlite3'),
|
|
'NAME': os.environ.get('DB_NAME', str(BASE_DIR / 'db.sqlite3')),
|
|
'USER': os.environ.get('DB_USER', ''),
|
|
'PASSWORD': os.environ.get('DB_PASS', ''),
|
|
'HOST': os.environ.get('DB_HOST', ''),
|
|
'PORT': os.environ.get('DB_PORT', '5432'),
|
|
}
|
|
}
|
|
|
|
# DATABASES = {
|
|
# 'default': {
|
|
# 'ENGINE': 'django.db.backends.postgresql',
|
|
# 'NAME': 'eventify_uat_db', # your DB name
|
|
# 'USER': 'eventify_uat', # your DB user
|
|
# 'HOST': '0.0.0.0', # or IP/domain
|
|
# 'PORT': '5440', # default PostgreSQL port
|
|
# }
|
|
# }
|
|
|
|
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_L10N = 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'
|
|
|
|
X_FRAME_OPTIONS = 'SAMEORIGIN'
|
|
|
|
AUTH_USER_MODEL = 'accounts.User'
|
|
|
|
LOGIN_URL = 'login'
|
|
LOGIN_REDIRECT_URL = 'dashboard'
|
|
LOGOUT_REDIRECT_URL = 'login'
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
EMAIL_HOST = 'mail.bshtech.net'
|
|
EMAIL_PORT = 587
|
|
EMAIL_USE_TLS = True
|
|
EMAIL_HOST_USER = 'no-reply@eventifyplus.com'
|
|
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD', '')
|
|
DEFAULT_FROM_EMAIL = 'Eventify <no-reply@eventifyplus.com>'
|
|
|
|
SUMMERNOTE_THEME = 'bs5'
|
|
|
|
# Reverse proxy / CSRF fix
|
|
CSRF_TRUSTED_ORIGINS = [
|
|
'https://app.eventifyplus.com',
|
|
'https://admin.eventifyplus.com',
|
|
'https://db.eventifyplus.com',
|
|
'https://uat.eventifyplus.com',
|
|
'https://test.eventifyplus.com',
|
|
'https://eventifyplus.com',
|
|
]
|
|
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
USE_X_FORWARDED_HOST = True
|
|
|
|
# --- JWT Auth (Phase 1) ---
|
|
from datetime import timedelta
|
|
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
|
),
|
|
'DEFAULT_PERMISSION_CLASSES': (
|
|
'rest_framework.permissions.IsAuthenticated',
|
|
),
|
|
}
|
|
|
|
SIMPLE_JWT = {
|
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=30), # Reduced from 1 day for security
|
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=7),
|
|
'ROTATE_REFRESH_TOKENS': True,
|
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
|
'USER_ID_FIELD': 'id',
|
|
'USER_ID_CLAIM': 'user_id',
|
|
}
|