This repository was archived by the owner on Jan 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727from wsgi_utils import get_module_config_filename
2828from wsgi_utils import load_user_scripts_into_handlers
2929
30+ from google .appengine .ext .vmruntime import middlewares
3031from google .appengine .ext .vmruntime import vmconfig
3132from google .appengine .ext .vmruntime import vmstub
3233
33-
3434logging .basicConfig (level = logging .INFO )
3535
3636appinfo_external = get_module_config (get_module_config_filename ())
4949
5050# Create a "meta app" that dispatches requests based on handlers.
5151meta_app = dispatcher (preloaded_handlers )
52+
53+ # Wrap meta_app in middleware. The first statement in this section is the
54+ # innermost layer of the middleware, and the last statement is the outermost
55+ # layer (the middleware code that will process a request first). Inside the
56+ # innermost layer is the actual dispatcher, above.
57+
58+ # Adjust SERVER_NAME and SERVER_PORT env vars to hide the service bridge.
59+ meta_app = middlewares .FixServerEnvVarsMiddleware (meta_app )
60+
61+ # Patch os.environ to be thread local, and stamp it with default values based
62+ # on the app configuration. This is for backwards compatibility with GAE's use
63+ # of environment variables to store request data.
64+ # Note: gunicorn "gevent" or "eventlet" workers, if selected, will
65+ # automatically monkey-patch the threading module to make this compatible with
66+ # green threads.
67+ meta_app = middlewares .OsEnvSetupMiddleware (meta_app , appengine_config )
You can’t perform that action at this time.
0 commit comments