import os from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'change-me-in-production') # DEBUG = os.environ.get('DJANGO_DEBUG', 'False') == 'True' # # ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', '*').split(',') DEBUG = False ALLOWED_HOSTS = [ '*' ] 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', ] 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 = [ "http://localhost:5178", "http://localhost:5179", "http://localhost:5173", "http://localhost:3001", "http://localhost:3000", "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 # 'PASSWORD': 'eventifyplus@!@#$', # your DB password # '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.console.EmailBackend' # DEFAULT_FROM_EMAIL = 'no-reply@example.com' SUMMERNOTE_THEME = 'bs5' # Reverse proxy / CSRF fix CSRF_TRUSTED_ORIGINS = [ '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(days=1), 'REFRESH_TOKEN_LIFETIME': timedelta(days=7), 'AUTH_HEADER_TYPES': ('Bearer',), 'USER_ID_FIELD': 'id', 'USER_ID_CLAIM': 'user_id', } # --------------------------------------------------------------------------- # Secondary read-only database: real user data from eventify-django SQLite # Activated automatically when users_db.sqlite3 is mounted into the container # --------------------------------------------------------------------------- import os as _os _sqlite_users = BASE_DIR / 'users_db.sqlite3' if _os.path.exists(_sqlite_users): DATABASES['users_db'] = { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': _sqlite_users, 'OPTIONS': {'check_same_thread': False}, }