27 lines
754 B
Python
27 lines
754 B
Python
|
|
import os.path
|
||
|
|
import random
|
||
|
|
from flask import Flask
|
||
|
|
from flask import abort
|
||
|
|
from flask_cors import CORS
|
||
|
|
from routers import register_blueprints
|
||
|
|
from ServerConfig import ServerConfig, ServerEnv
|
||
|
|
from flask import send_from_directory
|
||
|
|
|
||
|
|
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
|
||
|
|
|
||
|
|
register_blueprints(app)
|
||
|
|
|
||
|
|
|
||
|
|
@app.route("/")
|
||
|
|
def hello_world():
|
||
|
|
return abort(403)
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
server_listen: tuple = server.tell_listen()
|
||
|
|
app.run(host=server_listen[0], port=server_listen[1],
|
||
|
|
debug=True if server.tell_env() == ServerEnv.DEBUG else False)
|