Files
pear-admin-flask/applications/__init__.py
T

47 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import os
from flask import Flask
from common.flask_uploads import configure_uploads
from common.utils.upload import photos
from extensions import init_plugs
from applications.view import init_view
from applications.api import init_api
import config
def create_app():
app = Flask('pear-admin-flask')
# 引入数据库配置
app.config.from_object(config)
# 注册各种插件
init_plugs(app)
# 注册路由
init_view(app)
# 注册接口(restful api
init_api(app)
# 文件上传
configure_uploads(app, photos)
if os.environ.get('WERKZEUG_RUN_MAIN') == 'true':
logo()
return app
def logo():
print('''
_____ _ _ ______ _ _
| __ \ /\ | | (_) | ____| | | |
| |__) |__ __ _ _ __ / \ __| |_ __ ___ _ _ __ | |__ | | __ _ ___| | __
| ___/ _ \/ _` | '__| / /\ \ / _` | '_ ` _ \| | '_ \ | __| | |/ _` / __| |/ /
| | | __/ (_| | | / ____ \ (_| | | | | | | | | | | | | | | (_| \__ \ <
|_| \___|\__,_|_| /_/ \_\__,_|_| |_| |_|_|_| |_| |_| |_|\__,_|___/_|\_\\
''')