forked from dAiv-CNU/dAiv-CNU.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
27 lines (17 loc) · 861 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from flask import Flask, send_from_directory
app = Flask(__name__, static_url_path="", static_folder="dist/res/static", template_folder="dist/res/templates")
@app.route("/cdn/<path:path>")
def respond_cdn_res(path):
return send_from_directory("cdn", path)
@app.route("/dist/<path:path>")
def respond_dist_source(path):
return send_from_directory("dist", path)
@app.route("/", defaults={'path': "", 'file': "index"})
@app.route("/<file>.html", defaults={'path': ""})
@app.route("/<path:path>/", defaults={'file': "index"})
@app.route("/judge/", defaults={'path': "judge", 'file': "index"}) # 없으면 안들어가짐...
@app.route("/<path:path>/<file>.html")
def redirect_to_index(path, file):
return app.send_static_file(f"{path}/{file}.html" if path else f"{file}.html")
if __name__ == '__main__':
app.run(host="0.0.0.0", port=8000)