代码拉取完成,页面将自动刷新
import datetime
import logging
from flask import Flask
from database import db
from config import DevConfig
from course.course_blueprint import course_blue
from user.user_blueprint import user_blue
from index import index_blue
from admin.admin_blueprint import admin_blueprint
from order.order_blueprint import order_blueprint
from file.file_blueprint import file_blueprint
from flask_apscheduler import APScheduler
# 注册全局flask
app = Flask(__name__)
app.config.from_object(DevConfig)
# 初始化定时器
scheduler = APScheduler()
scheduler.init_app(app)
scheduler.start()
# 注册数据库
db.init_app(app)
# 注册蓝图
app.register_blueprint(course_blue)
app.register_blueprint(user_blue)
app.register_blueprint(index_blue)
app.register_blueprint(admin_blueprint, url_prefix='/admin')
app.register_blueprint(order_blueprint, url_prefix='/api')
app.register_blueprint(file_blueprint, url_prefix='/file')
logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s',
filename='/root/miniapp-' + datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S') + '.log')
@app.route('/')
def hello_world():
return '<h1>Hello World!</h1>', 200
if __name__ == '__main__':
logging.info('Running miniapp backend at http://localhost:5000/...')
logging.info('Warning: You are running this project in development mode!')
app.run(host='0.0.0.0', port=5000)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。