Refactor environment setup and enhance development scripts for ThrillWiki

This commit is contained in:
pacnpal
2025-08-20 11:23:05 -04:00
parent 2304085c32
commit 37a20f83ba
8 changed files with 252 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ env = environ.Env(
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# Read environment file if it exists
environ.Env.read_env(BASE_DIR / '***REMOVED***')
environ.Env.read_env(BASE_DIR / '.env')
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')

View File

@@ -94,11 +94,14 @@ for middleware in DEVELOPMENT_MIDDLEWARE:
INTERNAL_IPS = ['127.0.0.1', '::1']
# Silk configuration for development
SILKY_PYTHON_PROFILER = True
SILKY_PYTHON_PROFILER_BINARY = True
SILKY_PYTHON_PROFILER_RESULT_PATH = BASE_DIR / 'profiles'
SILKY_AUTHENTICATION = True
SILKY_AUTHORISATION = True
SILKY_PYTHON_PROFILER = False # Disable profiler to avoid silk_profile installation issues
SILKY_PYTHON_PROFILER_BINARY = False # Disable binary profiler
# SILKY_PYTHON_PROFILER_RESULT_PATH = BASE_DIR / 'profiles' # Not needed when profiler is disabled
SILKY_AUTHENTICATION = True # Require login to access Silk
SILKY_AUTHORISATION = True # Enable authorization
SILKY_MAX_REQUEST_BODY_SIZE = -1 # Don't limit request body size
SILKY_MAX_RESPONSE_BODY_SIZE = 1024 # Limit response body size to 1KB for performance
SILKY_META = True # Record metadata about requests
# NPlusOne configuration
import logging