bug fix: allowed host issue

This commit is contained in:
usmannasir
2025-09-15 12:07:15 +05:00
parent d64b53ef63
commit 26425dd397
4 changed files with 197 additions and 16 deletions

View File

@@ -33,13 +33,8 @@ SECRET_KEY = os.getenv('SECRET_KEY', 'xr%j*p!*$0d%(-(e%@-*hyoz4$f%y77coq0u)6pwmj
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.getenv('DEBUG', 'False').lower() == 'true'
# Allow configuration via environment variable, with dynamic host detection
allowed_hosts_env = os.getenv('ALLOWED_HOSTS', '')
if allowed_hosts_env:
ALLOWED_HOSTS = allowed_hosts_env.split(',')
else:
# Default to localhost and auto-detect server IP from request
ALLOWED_HOSTS = ['localhost', '127.0.0.1', '*']
# Allow configuration via environment variable, with wildcard fallback for universal compatibility
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '*').split(',')
# Application definition