Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. def create_app(config_name):
  2.  
  3. app = Flask(__name__)
  4. app.config.from_object(config[config_name])
  5.  
  6. db.init_app(app)
  7. csrf.init_app(app)
  8. login_manager.init_app(app)
  9. babel.init_app(app)
  10.  
  11. @app.before_request
  12. def before_request_callback():
  13. if request.view_args and 'locale' in request.view_args:
  14. if request.view_args['locale'] not in app.config['SUPPORTED_LOCALES']:
  15. return abort(404)
  16. g.locale = request.view_args['locale']
  17. request.view_args.pop('locale')
  18.  
  19. from . app_area__main import main as main_blueprint
  20. app.register_blueprint(main_blueprint)
  21.  
  22. from . app_area__admin import admin as admin_blueprint
  23. app.register_blueprint(admin_blueprint, url_prefix='/admin')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement