예제 #1
0
    'session.cookie_expires': False,
}
app_middleware = beaker.middleware.SessionMiddleware(bottle.default_app(),
                                                     session_opts)

assets.init_assets()

app = bottle.default_app()

from bottle import SimpleTemplate
SimpleTemplate.defaults["get_url"] = app.get_url

app = bottle.Bottle()
bottle.default_app.push(app)

app.install(bottle_pgsql.Plugin(utils.db_string))
# Temporary allow CORS on web
app.install(
    bottle_cors.Plugin(allow_origin='*',
                       preflight_methods=['GET', 'POST', 'PUT', 'DELETE']))
app.install(
    bottle_gettext.Plugin('osmose-frontend', os.path.join("web", "po", "mo"),
                          utils.allowed_languages))
app.install(bottle_user.Plugin())

app.router.add_filter('uuid', uuid_filter)
app.router.add_filter('ext', ext_filter)


@route('/login')
def login(lang):
예제 #2
0
from modules import bottle_gettext


class OsmoseAPIBottle(bottle.Bottle):
    def default_error_handler(self, res):
        bottle.response.content_type = 'text/plain'
        return res.body


app_0_3 = OsmoseAPIBottle()
bottle.default_app.push(app_0_3)

app_0_2 = OsmoseAPIBottle()
bottle.default_app.push(app_0_2)

app_0_2.install(bottle_pgsql.Plugin(utils.db_string))
app_0_2.install(
    bottle_cors.Plugin(allow_origin='*',
                       preflight_methods=['GET', 'POST', 'PUT', 'DELETE']))
app_0_2.install(
    bottle_gettext.Plugin('osmose-frontend', os.path.join("web", "po", "mo"),
                          utils.allowed_languages))

app_0_3.install(bottle_pgsql.Plugin(utils.db_string))
app_0_3.install(
    bottle_cors.Plugin(allow_origin='*',
                       preflight_methods=['GET', 'POST', 'PUT', 'DELETE']))
app_0_3.install(bottle_langs.Plugin())

app_0_2.router.add_filter('ext', ext_filter)
app_0_3.router.add_filter('ext', ext_filter)