Beispiel #1
0
# Configure routes available at '/%namespace%/' context paths
sites.ApplicationRequestHandler.bind(namespaced_routes)
app_routes = [(r'(.*)', sites.ApplicationRequestHandler)]

# enable Appstats handlers if requested
appstats_routes = []
if appengine_config.gcb_appstats_enabled():
    import google.appengine.ext.appstats.ui as appstats_ui

    # add all Appstats URL's to /admin/stats basepath
    for path, handler in appstats_ui.URLMAP:
        assert '.*' == path[:2]
        appstats_routes.append(('/admin/stats/%s' % path[3:], handler))

# i18n configuration for jinja2
webapp2_i18n_config = {'translations_path': os.path.join(
    appengine_config.BUNDLE_ROOT, 'modules/i18n/resources/locale')}

# init application
app = users.AuthInterceptorWSGIApplication(
    None,
    config={'webapp2_extras.i18n': webapp2_i18n_config},
    debug=not appengine_config.PRODUCTION_MODE)

# setup router
app.router = sites.WSGIRouter(
    lifecycle_routes + global_routes + appstats_routes + app_routes)

# hook exception handling
app.handle_exception = sites.handle_exception
Beispiel #2
0
student_work.register_for_data_removal()

# Collect routes (URL-matching regexes -> handler classes) for modules.
global_routes, namespaced_routes = custom_modules.Registry.get_all_routes()

# Configure routes available at '/%namespace%/' context paths
sites.ApplicationRequestHandler.bind(namespaced_routes)
app_routes = [(r'(.*)', sites.ApplicationRequestHandler)]

# enable Appstats handlers if requested
appstats_routes = []
if appengine_config.gcb_appstats_enabled():
    import google.appengine.ext.appstats.ui as appstats_ui

    # add all Appstats URL's to /admin/stats basepath
    for path, handler in appstats_ui.URLMAP:
        assert '.*' == path[:2]
        appstats_routes.append(('/admin/stats/%s' % path[3:], handler))

# i18n configuration for jinja2
webapp2_i18n_config = {
    'translations_path':
    os.path.join(appengine_config.BUNDLE_ROOT, 'modules/i18n/resources/locale')
}

# init application
app = users.AuthInterceptorWSGIApplication(
    global_routes + appstats_routes + app_routes,
    config={'webapp2_extras.i18n': webapp2_i18n_config},
    debug=not appengine_config.PRODUCTION_MODE)
Beispiel #3
0
 def getApp(self):
     return users.AuthInterceptorWSGIApplication([('/', TestHandler)])
Beispiel #4
0
 def getApp(self):
     return users.AuthInterceptorWSGIApplication(gitkit.GLOBAL_HANDLERS +
                                                 gitkit.NAMESPACED_HANDLERS)