25 lines
512 B
Python
25 lines
512 B
Python
# -*- coding: utf-8 -*-
|
|
from flask import Flask
|
|
from flask.ext.mail import Mail
|
|
from flask.ext.sqlalchemy import SQLAlchemy
|
|
from werkzeug.utils import import_string
|
|
|
|
mail = Mail()
|
|
db = SQLAlchemy()
|
|
blueprints = [
|
|
'myapp.main:main',
|
|
'myapp.admin:admin',
|
|
]
|
|
|
|
|
|
def create_app(config):
|
|
app = Flask(__name__)
|
|
app.config.from_object(config)
|
|
mail.init_app(app)
|
|
db.init_app(app)
|
|
|
|
for bp_name in blueprints:
|
|
bp = import_string(bp_name)
|
|
app.register_blueprint(bp)
|
|
return app
|