def create_app(): """ Create your application. Files outside the app directory can import this function and use it to recreate your application -- both bootstrap.py and the `tests` directory do this. """ app = Flask(__name__) app.config.from_object(settings) babel = Babel(app, configure_jinja=True) babel.localeselector(_localeselector) babel.timezoneselector(_timezoneselector) app.register_module(views) app.register_module(rpc) app.register_module(tasks) app.secret_key = settings.secret_key return app
def i18n_init(app): """ initialize Flask-Babel """ babel = Babel(app) babel.localeselector(get_locale) babel.timezoneselector(get_timezone)