Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create_app(config_name):
- app = Flask(__name__)
- app.config.from_object(config[config_name])
- db.init_app(app)
- csrf.init_app(app)
- login_manager.init_app(app)
- babel.init_app(app)
- @app.before_request
- def before_request_callback():
- if request.view_args and 'locale' in request.view_args:
- if request.view_args['locale'] not in app.config['SUPPORTED_LOCALES']:
- return abort(404)
- g.locale = request.view_args['locale']
- request.view_args.pop('locale')
- from . app_area__main import main as main_blueprint
- app.register_blueprint(main_blueprint)
- from . app_area__admin import admin as admin_blueprint
- app.register_blueprint(admin_blueprint, url_prefix='/admin')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement