mockapi/scripts/debug_wsgi.py
2026-03-16 10:49:01 +00:00

22 lines
No EOL
758 B
Python

import inspect
from asgiref.wsgi import WsgiToAsgi
from app.core.app import app
print("app callable?", callable(app))
print("app signature:", inspect.signature(app.__call__))
wrapper = WsgiToAsgi(app)
print("wrapper callable?", callable(wrapper))
print("wrapper signature:", inspect.signature(wrapper.__call__))
print("wrapper.__class__:", wrapper.__class__)
print("wrapper.__class__.__module__:", wrapper.__class__.__module__)
# Try to call with dummy environ/start_response
def start_response(status, headers):
pass
environ = {'REQUEST_METHOD': 'GET', 'PATH_INFO': '/'}
try:
result = wrapper(environ, start_response)
print("Success! Result:", result)
except Exception as e:
print("Error:", e)
import traceback
traceback.print_exc()