Beispiel #1
0
def real_main():
    # Reset path and environment variables.
    global path_backup
    try:
        sys.path = path_backup[:]
    except:
        path_backup = sys.path[:]
    os.environ.update(env_ext)
    setup_logging()

    # Run the WSGI CGI handler with that application.
    run_wsgi_app(application)
Beispiel #2
0
def real_main():
    # Reset path and environment variables
    global path_backup
    try:
        sys.path = path_backup[:]
    except:
        path_backup = sys.path[:]
    os.environ.update(env_ext)
    setup_logging()

    # Run the WSGI CGI handler with that application.
    run_wsgi_app(application)
Beispiel #3
0
def real_main():
    # Reset path and environment variables
    global path_backup
    try:
        sys.path = path_backup[:]
    except:
        path_backup = sys.path[:]
    os.environ.update(boot.env_ext)
    boot.setup_logging()

    # Create a Django application for WSGI.
    application = django.core.handlers.wsgi.WSGIHandler()

    # Run the WSGI CGI handler with that application.
    util.run_wsgi_app(application)
Beispiel #4
0
def real_main():
    # Reset path and environment variables
    global path_backup
    try:
        sys.path = path_backup[:]
    except:
        path_backup = sys.path[:]
    os.environ.update(boot.env_ext)
    boot.setup_logging()

    # Create a Django application for WSGI.
    application = django.core.handlers.wsgi.WSGIHandler()

    # Run the WSGI CGI handler with that application.
    util.run_wsgi_app(application)
Beispiel #5
0
def application(environ, start_response):
    # Reset path and environment variables
    global path_backup
    try:
        sys.path = path_backup[:]
    except Exception:
        path_backup = sys.path[:]
    os.environ.update(env_ext)
    setup_logging()

    # Create a Django application for WSGI
    handler = WSGIHandler()

    # Add the staticfiles handler if necessary
    if settings.DEBUG and 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
        from django.contrib.staticfiles.handlers import StaticFilesHandler
        application = StaticFilesHandler(application)

    # Run the WSGI CGI handler with that application.
    return handler(environ, start_response)
Beispiel #6
0
def real_main():
    # Reset path and environment variables
    global path_backup
    try:
        sys.path = path_backup[:]
    except:
        path_backup = sys.path[:]
    os.environ.update(env_ext)
    setup_logging()

    # Create a Django application for WSGI
    application = WSGIHandler()

    # Add the staticfiles handler if necessary
    if settings.DEBUG and "django.contrib.staticfiles" in settings.INSTALLED_APPS:
        from django.contrib.staticfiles.handlers import StaticFilesHandler

        application = StaticFilesHandler(application)

    # Run the WSGI CGI handler with that application.
    run_wsgi_app(application)
Beispiel #7
0
# on the first request of a main.py instance, so don't add parent_dir multiple
# times.
parent_dir = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
if parent_dir not in sys.path:
    sys.path.insert(0, parent_dir)

# Remove the standard version of Django
if 'django' in sys.modules and sys.modules['django'].VERSION < (1, 2):
    for k in [k for k in sys.modules
              if k.startswith('django\.') or k == 'django']:
        del sys.modules[k]

from djangoappengine import boot
boot.setup_project()
boot.setup_threading()
boot.setup_logging()

import django.core.handlers.wsgi
from google.appengine.ext.webapp import util
from django.conf import settings

def log_traceback(*args, **kwargs):
    import logging
    logging.exception('Exception in request:')

from django.core import signals
signals.got_request_exception.connect(log_traceback)

def real_main():
    # Reset path and environment variables
    global path_backup
Beispiel #8
0
parent_dir = os.path.abspath(
    os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
if parent_dir not in sys.path:
    sys.path.insert(0, parent_dir)

# Remove the standard version of Django
if 'django' in sys.modules and sys.modules['django'].VERSION < (1, 2):
    for k in [
            k for k in sys.modules if k.startswith('django\.') or k == 'django'
    ]:
        del sys.modules[k]

from djangoappengine import boot
boot.setup_project()
boot.setup_threading()
boot.setup_logging()

import django.core.handlers.wsgi
from google.appengine.ext.webapp import util
from django.conf import settings


def log_traceback(*args, **kwargs):
    import logging
    logging.exception('Exception in request:')


from django.core import signals
signals.got_request_exception.connect(log_traceback)