Example #1
0
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = SessionMiddleware(app, cookie_key=";lkjascvpoiuzxclvkjswd:LKJHLKJHPoiu;lkj32453456lkjhkjwdhfgsdfggfdse",lifetime=datetime.timedelta(365))

    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)

    # Add the following
    from gae_bingo.middleware import GAEBingoWSGIMiddleware
    app = GAEBingoWSGIMiddleware(app)

    return app
Example #2
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()