Spaces:
Sleeping
Sleeping
Download wsgi.py from refaelz/legacy-code-challenge: direct link, hf CLI and curl.
- Browser
- Download file 918 Bytes
-
https://huggingface.co/spaces/refaelz/legacy-code-challenge/resolve/main/wsgi.py
- Command line
-
hf download hf://spaces/refaelz/legacy-code-challenge/wsgi.py
-
curl -L -o wsgi.py https://huggingface.co/spaces/refaelz/legacy-code-challenge/resolve/main/wsgi.py
918 Bytes
| #!/usr/bin/env python3 | |
| """ | |
| wsgi.py — Gunicorn WSGI wrapper for Gradio | |
| This is a workaround for Render's auto-detection. | |
| Render insists on running 'gunicorn app:app' but Gradio doesn't support WSGI. | |
| Solution: This file makes gunicorn launch python app.py as a subprocess. | |
| """ | |
| import os | |
| import sys | |
| import subprocess | |
| # When gunicorn imports this, we launch the real app and exit | |
| if __name__ != "__main__": | |
| print("🔧 Gunicorn detected - launching python app.py instead...") | |
| subprocess.run([sys.executable, "app.py"]) | |
| sys.exit(0) | |
| # This should never be reached, but just in case: | |
| def application(environ, start_response): | |
| """Dummy WSGI application that should never be called.""" | |
| status = '500 Internal Server Error' | |
| headers = [('Content-type', 'text/plain; charset=utf-8')] | |
| start_response(status, headers) | |
| return [b'Error: Use python app.py directly, not WSGI'] | |
| app = application | |