- Add Dockerfile, docker-compose.yml, .dockerignore for containerised deployment - Add deploy/ scripts (deploy.sh, nginx/apache configs, password generator) - Replace MSAL/Azure AD auth with local username/password authentication - Add login.html template - Simplify app.py, middleware, and auth routes for production use - Update gunicorn_config.py and wsgi.py for Docker/production - Update templates to work with new auth and URL prefix handling Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
30 lines
966 B
Python
30 lines
966 B
Python
"""WSGI entry point for production deployment."""
|
|
from app import app
|
|
|
|
|
|
class ReverseProxied:
|
|
"""WSGI middleware that reads X-Script-Name header from reverse proxy
|
|
and sets SCRIPT_NAME so Flask's url_for() generates correct prefixed URLs.
|
|
|
|
The reverse proxy (nginx/Apache) should set this header to the subpath
|
|
prefix, e.g. /hm-ai-qc-report.
|
|
"""
|
|
|
|
def __init__(self, app):
|
|
self.app = app
|
|
|
|
def __call__(self, environ, start_response):
|
|
script_name = environ.get('HTTP_X_SCRIPT_NAME', '')
|
|
if script_name:
|
|
environ['SCRIPT_NAME'] = script_name
|
|
# Strip the prefix from PATH_INFO if it's still there
|
|
path_info = environ.get('PATH_INFO', '')
|
|
if path_info.startswith(script_name):
|
|
environ['PATH_INFO'] = path_info[len(script_name):]
|
|
return self.app(environ, start_response)
|
|
|
|
|
|
application = ReverseProxied(app)
|
|
|
|
if __name__ == "__main__":
|
|
app.run()
|