Exemple #1
0
def main():
    application = webapp.WSGIApplication([
        ('/api-apps/classreport', api_apps.ClassReport),
        ('/api-apps/goalsreport', api_apps.GoalsReport),
        ('/api-apps/goalsreportadmin', api_apps.GoalsReportAdmin),
        ('/api-apps/suggestgoals', api_apps.SuggestGoals),
        ('/api-apps/goals', api_apps.SetGoal),
        ('/api-apps/admin/uploadcommoncore', api_apps.CommonCore),
        ('/api-apps/admin/goalsreport', api_apps.GoalsReportAdmin),
        ('/api-apps/admin/updateexercisedata', api_apps.UpdateExerciseData),
        ('/translations/admin/updatesubtitles', subtitle.UpdateSubtitles),
        ('/translations/subtitlestatus', subtitle.SubtitleStatus),
        ('/translations/subtitleactions', subtitle.SubtitleActions),
        ('/translations/getsubtitlelanguages', subtitle.GetSubtitleLanguages),
        ('/translations/getsubtitlelanguagescount',
         subtitle.GetSubtitleLanguagesCount),
        ('/summer/application', summer.Application),
        ('/summer/application-status', summer.Status),
        ('/summer/getstudent', summer.GetStudent),
        ('/summer/paypal-autoreturn', summer.PaypalAutoReturn),
        ('/summer/paypal-ipn', summer.PaypalIPN),
        ('/admin/summer/process', summer.Process),
        ('/logout', api_apps.Logout),
        (r'.*', api_apps.DefaultHandler),
    ],
                                         debug=True)

    application = profiler.ProfilerWSGIMiddleware(application)
    wsgiref.handlers.CGIHandler().run(application)
Exemple #2
0
def main():
    application = webapp.WSGIApplication([('/', MainHandler),
                                          ('/update', UpdateHandler),
                                          ('/upload', UploadHandler)],
                                         debug=is_local())

    from gae_mini_profiler import profiler
    application = profiler.ProfilerWSGIMiddleware(application)

    wsgiref.handlers.CGIHandler().run(application)
Exemple #3
0
def main():
    app = create_app()
    csrf(app)
    # If we're on the local server, let's enable Flask debugging.
    # For more information: http://goo.gl/RNofH
    if settings.debug:
        app.debug = True
        app = get_debugged_app(app)
        settings.debug_profiler_enabled = profiler_config.should_profile(app)
    app = profiler.ProfilerWSGIMiddleware(app)
    CGIHandler().run(app)
Exemple #4
0
def real_main():

    wsgi_app = request_cache.RequestCacheMiddleware(api_app)
    wsgi_app = profiler.ProfilerWSGIMiddleware(wsgi_app)
    wsgi_app = middleware.GAEBingoWSGIMiddleware(wsgi_app)

    if App.is_dev_server:
        try:
            # Run debugged app
            from werkzeug_debugger_appengine import get_debugged_app
            api_app.debug = True
            debugged_app = get_debugged_app(wsgi_app)
            CGIHandler().run(debugged_app)
            return debugged_app
        except Exception, e:
            api_app.debug = False
            logging.warning(
                "Error running debugging version of werkzeug app, running production version: %s"
                % e)
Exemple #5
0
class ShowJson(request_handler.RequestHandler):
    @user_util.open_access
    def get(self, language, namespace):
        try:
            with open('./locale/' + language + "/" + namespace +
                      ".json") as file:
                #Open JSON file and return it
                self.response.out.write(file.read())
                self.response.headers['Content-Type'] = "application/json"
        except IOError as e:
            self.response.out.write("{}")


application = webapp2.WSGIApplication([
    ('/locale/(.*)/(.*)', ShowJson),
],
                                      debug=True)

application = profiler.ProfilerWSGIMiddleware(application)
application = GAEBingoWSGIMiddleware(application)
application = request_cache.RequestCacheMiddleware(application)
application = wsgi_compat.WSGICompatHeaderMiddleware(application)


def main():
    run_wsgi_app(application)


if __name__ == '__main__':
    main()
Exemple #6
0
    # Development settings
    app.config.from_object('application.settings.Development')
    # Flask-DebugToolbar
    toolbar = DebugToolbarExtension(app)

    # Google app engine mini profiler
    # https://github.com/kamens/gae_mini_profiler
    app.wsgi_app = DebuggedApplication(app.wsgi_app, evalex=True)

    from gae_mini_profiler import profiler, templatetags

    @app.context_processor
    def inject_profiler():
        return dict(profiler_includes=templatetags.profiler_includes())

    app.wsgi_app = profiler.ProfilerWSGIMiddleware(app.wsgi_app)
else:
    app.config.from_object('application.settings.Production')

# Enable jinja2 loop controls extension
app.jinja_env.add_extension('jinja2.ext.loopcontrols')

import bleach


def set_target(attrs, new=False):
    attrs['target'] = '_blank'
    return attrs


@app.template_filter('linkify')