26 lines
749 B
Python
26 lines
749 B
Python
import os.path
|
|
from flask import Flask
|
|
from flask import abort
|
|
from flask_cors import CORS
|
|
from routers import register_blueprints
|
|
from abstract_class.ServerConfig import ServerConfig, ServerEnv
|
|
|
|
app = Flask(__name__, static_folder=os.path.join('dist'), static_url_path='/assets')
|
|
CORS(app, supports_credentials=True)
|
|
|
|
server: ServerConfig = ServerConfig(env=ServerEnv.DEBUG) # 设置环境 |||||| DEBUG ||| SERVER
|
|
host, port = server.tell_listen()
|
|
register_blueprints(app)
|
|
app.global_port = port
|
|
|
|
|
|
@app.route("/")
|
|
def hello_world():
|
|
return abort(403)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
server_listen: tuple = server.tell_listen()
|
|
app.run(host=host, port=port,
|
|
debug=True if server.tell_env() == ServerEnv.DEBUG else False)
|