File indexing completed on 2026-04-27 07:41:45
0001 """
0002 WSGI config for swf-remote subpath deployment.
0003
0004 Used when the app is mounted at a subpath (e.g. /prod) behind Apache.
0005 Sets SCRIPT_NAME so Django generates correct URLs.
0006 """
0007
0008 import os
0009 from django.core.wsgi import get_wsgi_application
0010
0011 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'swf_remote_project.settings')
0012
0013
0014 class ScriptNameFix:
0015 def __init__(self, app, script_name):
0016 self.app = app
0017 self.script_name = script_name
0018
0019 def __call__(self, environ, start_response):
0020 environ['SCRIPT_NAME'] = self.script_name
0021 path_info = environ.get('PATH_INFO', '')
0022 if path_info.startswith(self.script_name):
0023 environ['PATH_INFO'] = path_info[len(self.script_name):]
0024 return self.app(environ, start_response)
0025
0026
0027 application = ScriptNameFix(get_wsgi_application(), '/prod')