Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,16 +17,24 @@ REPO_DIR = "SharkPools-Extensions"
|
|
17 |
TARGET_FILE = os.path.join(REPO_DIR, "pages", "startup.js")
|
18 |
|
19 |
# Flask アプリケーション設定
|
20 |
-
app = Flask(__name__,
|
|
|
|
|
|
|
21 |
|
22 |
@app.route("/")
|
23 |
def index():
|
24 |
return render_template("index.html")
|
25 |
|
26 |
-
@app.route(
|
27 |
def serve_any(filepath):
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
full_path = os.path.join(REPO_DIR, filepath)
|
29 |
-
|
30 |
if os.path.isfile(full_path):
|
31 |
return send_from_directory(REPO_DIR, filepath)
|
32 |
else:
|
|
|
17 |
TARGET_FILE = os.path.join(REPO_DIR, "pages", "startup.js")
|
18 |
|
19 |
# Flask アプリケーション設定
|
20 |
+
app = Flask(__name__,
|
21 |
+
template_folder="templates",
|
22 |
+
static_folder="static",
|
23 |
+
static_url_path="")
|
24 |
|
25 |
@app.route("/")
|
26 |
def index():
|
27 |
return render_template("index.html")
|
28 |
|
29 |
+
@app.route("/<path:filepath>")
|
30 |
def serve_any(filepath):
|
31 |
+
# ② まず static ディレクトリを探す
|
32 |
+
static_path = os.path.join(app.static_folder, filepath)
|
33 |
+
if os.path.isfile(static_path):
|
34 |
+
return send_from_directory(app.static_folder, filepath)
|
35 |
+
|
36 |
+
# 存在しなければ従来どおりリポジトリ直下を探す
|
37 |
full_path = os.path.join(REPO_DIR, filepath)
|
|
|
38 |
if os.path.isfile(full_path):
|
39 |
return send_from_directory(REPO_DIR, filepath)
|
40 |
else:
|