You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
610 B

  1. from flask import Flask
  2. from flask_bootstrap import Bootstrap
  3. from flask_mail import Mail
  4. from flask_moment import Moment
  5. from flask_sqlalchemy import SQLAlchemy
  6. from config import config
  7. bootstrap = Bootstrap()
  8. mail = Mail()
  9. moment = Moment()
  10. db = SQLAlchemy()
  11. def create_app(config_name):
  12. app = Flask(__name__)
  13. app.config.from_object(config[config_name])
  14. config[config_name].init_app(app)
  15. bootstrap.init_app(app)
  16. mail.init_app(app)
  17. moment.init_app(app)
  18. db.init_app(app)
  19. from .main import main as main_blueprint
  20. app.register_blueprint(main_blueprint)
  21. return app