Skip to content
This repository was archived by the owner on Jan 12, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion multicore_runtime/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
from wsgi_utils import get_module_config_filename
from wsgi_utils import load_user_scripts_into_handlers

from google.appengine.ext.vmruntime import middlewares
from google.appengine.ext.vmruntime import vmconfig
from google.appengine.ext.vmruntime import vmstub


logging.basicConfig(level=logging.INFO)

appinfo_external = get_module_config(get_module_config_filename())
Expand All @@ -49,3 +49,19 @@

# Create a "meta app" that dispatches requests based on handlers.
meta_app = dispatcher(preloaded_handlers)

# Wrap meta_app in middleware. The first statement in this section is the
# innermost layer of the middleware, and the last statement is the outermost
# layer (the middleware code that will process a request first). Inside the
# innermost layer is the actual dispatcher, above.

# Adjust SERVER_NAME and SERVER_PORT env vars to hide the service bridge.
meta_app = middlewares.FixServerEnvVarsMiddleware(meta_app)

# Patch os.environ to be thread local, and stamp it with default values based
# on the app configuration. This is for backwards compatibility with GAE's use
# of environment variables to store request data.
# Note: gunicorn "gevent" or "eventlet" workers, if selected, will
# automatically monkey-patch the threading module to make this compatible with
# green threads.
meta_app = middlewares.OsEnvSetupMiddleware(meta_app, appengine_config)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do you get appengine_config?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 37: appengine_config = vmconfig.BuildVmAppengineEnvConfig()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, didn't see the hidden lines.

And thanks a lot for the great comments.

LGTM