web2019/server/app/__init__.py

30 lines
502 B
Python

from flask import Flask
from flask_cors import CORS
from flask_mail import Mail
from werkzeug.middleware.proxy_fix import ProxyFix
import config
mail = Mail()
def create_app(cfg=config):
app = Flask(__name__)
app.config.from_object(cfg)
app.wsgi_app = ProxyFix(app.wsgi_app)
mail.init_app(app)
from app.api import bp as bp_api
app.register_blueprint(bp_api)
CORS(
app,
resources={r'/api/*': {
'origins': '*',
}})
return app