def create_app(): app = Flask(__name__) app.config.from_object(envs.get('develop')) init_ext(app) init_api(app) load_middleware(app) return app
def create_app(): app = Flask(__name__) Bootstrap(app) app.config.from_object(envs.get('develop_env')) app.register_blueprint(blueprint=message) app.register_blueprint(blueprint=errors) init_db(app) return app
def create_app(env): app = Flask(__name__) CORS(app, resources=r'/*') init_ext(app) init_apis(app) app.config.from_object(envs.get(env)) return app
def create_app(env): app = Flask(__name__) app.config.from_object(envs.get(env)) # 初始化ext init_ext(app) # 初始化views init_views(app) return app
def create_app(): app = Flask(__name__) #初始化Flask config 配置文件 app.config.from_object(envs.get('develop')) # 初始化 扩展库 migrate,SQLALCHEMY 注册插件ext是extends init_ext(app) #进入蓝图 init_blueprint(app) #注册rest api init_api(app) return app
def create_app(env): app = Flask(__name__, static_url_path='/newdbDSM', static_folder='static') app.config.from_object(envs.get(env)) app.config[ 'MAX_CONTENT_LENGTH'] = 5 * 1024 * 1024 # 将网站允许的最大文件设置为5MB,防止拖垮网站 app.config['UPLOAD_PATH'] = Path(app.root_path).joinpath( 'files/uploads') # 设置网站上传文件的路径 app.config['RESULT_PATH'] = Path(app.root_path).joinpath( 'files/pred_result') # 设置预测结果路径 app.config['DOWNTABLE_PATH'] = Path(app.root_path).joinpath( 'files/down_table') # 设置预测结果路径 Path(app.config['UPLOAD_PATH']).mkdir(exist_ok=True, parents=True) # 避免因目录不存在而报错 Path(app.config['RESULT_PATH']).mkdir(exist_ok=True, parents=True) Path(app.config['DOWNTABLE_PATH']).mkdir(exist_ok=True, parents=True) init_ext(app=app) init_view(app=app) return app