FlaskDormitoryProject/config.py
2023-04-28 12:06:42 +08:00

36 lines
898 B
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.

# -*- coding: UTF-8 -*-
"""
@Project : FlaskProject
@File : config.py
@IDE : PyCharm
@Author : 爱写屎山的王可奕
@Email : 1933658780@qq.com
@Date : 2023/4/27 15:59
@Comment : Flask的配置文件,用于存放各种配置
"""
from flask import Flask
from blueprint.Login import bp_login
from blueprint.error import bp_error
from blueprint.index import bp_index
class Config:
"""
配置类存储对应的app.config
"""
SECRET_KEY = 'Myth wky'
class App:
"""
创建Flask应用程序实例
"""
@staticmethod
def createApp(config: Config) -> object:
app = Flask(__name__)
app.config.from_object(config) # 加载配置
# 创建Flask应用程序实例
app.register_blueprint(bp_index)
app.register_blueprint(bp_login, url_prefix='/login')
app.register_blueprint(bp_error)
return app