代码拉取完成,页面将自动刷新
import logging
from flask import Flask
import auth
import blog
from config import BaseConfig
from extensions import db
from flask_session import Session
def create_app():
"""Create and configure an instance of the Flask application."""
app = Flask(__name__, instance_relative_config=True)
app.config.from_object(BaseConfig)
stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.DEBUG)
app.logger.addHandler(stream_handler)
# initialize Flask-SQLAlchemy
db.init_app(app)
# apply the blueprints to the app
app.register_blueprint(auth.bp)
app.register_blueprint(blog.bp)
# make "index" point at "/", which is handled by "blog.index"
app.add_url_rule("/", endpoint="index")
with app.app_context():
db.create_all()
sess = Session()
sess.init_app(app)
return app
if __name__ == '__main__':
app = create_app()
app.run()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。