示例#1
0
def index():
    try:
        import googleclouddebugger
        googleclouddebugger.AttachDebugger()
    except ImportError:
        pass
    return render_template('index.html')
示例#2
0
  def CreateServer(self):

    with open(self.filename) as stream:
      appinfo_external = appinfo_includes.Parse(stream)

    appengine_config = vmconfig.BuildVmAppengineEnvConfig()
    vmstub.Register(vmstub.VMStub(appengine_config.default_ticket))








    if 'googleclouddebugger' in sys.modules:
      try:
        googleclouddebugger.AttachDebugger()
      except Exception as e:
        logging.warn('Exception while initializing Cloud Debugger: %s',
                     traceback.format_exc(e))








    try:
      import appengine_config as user_appengine_config
    except ImportError:
      pass

    app = meta_app.FullyWrappedApp(appinfo_external, appengine_config)
    self.server = self.server_class(self.host, self.port, app,
                                    appinfo_external)
    logging.info('Configured server on %s:%s', self.host, self.port)
示例#3
0
env_config = vmconfig.BuildVmAppengineEnvConfig()

# Ensure API requests include a valid ticket by default.
vmstub.Register(vmstub.VMStub(env_config.default_ticket))

# Enable Python Cloud Debugger if one is present. The debugger agent
# communicates with the Cloud Debugger backend.
#
# The debugger has no effect on the application until snapshot is
# requested.
#
# For details see: https://github.com/GoogleCloudPlatform/cloud-debug-python
try:
    import googleclouddebugger
    googleclouddebugger.AttachDebugger()
except ImportError:
    pass
except Exception:
    logging.warn(
        'Exception while initializing the Cloud Debugger. Debugging '
        'will not be available.',
        exc_info=True)

# Take an immutable snapshot of env data from env_config. This is added to the
# environment in `reset_environment_middleware` in a particular order to ensure
# that it cannot be overridden by other steps.
frozen_env_config_env = tuple(
    wsgi_config.env_vars_from_env_config(env_config).iteritems())

# Also freeze user env vars specified in app.yaml. Later steps to modify the
示例#4
0
"""
WSGI config for project_name project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_name.settings")

try:
    import googleclouddebugger
    googleclouddebugger.AttachDebugger(
        version=os.environ.get('GAE_MODULE_VERSION', ''),
        module=os.environ.get('GAE_MODULE_NAME', ''),
    )
except ImportError:
    pass

application = get_wsgi_application()