Spaces:
Running
Running
Sunhey Cho
commited on
Commit
·
6d8a023
1
Parent(s):
89707b0
Fix static file routing by adding explicit handlers for JS files
Browse files
api.py
CHANGED
@@ -1345,6 +1345,19 @@ def serve_index_html():
|
|
1345 |
resp.headers['Expires'] = '0'
|
1346 |
return resp
|
1347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1348 |
# 기본 경로 및 기타 경로 처리 (로그인 필요)
|
1349 |
@app.route('/', defaults={'path': ''}, methods=['GET'])
|
1350 |
@app.route('/<path:path>', methods=['GET'])
|
@@ -1545,10 +1558,6 @@ def index_page():
|
|
1545 |
print("Index route redirecting to index.html")
|
1546 |
return redirect('/index.html')
|
1547 |
|
1548 |
-
@app.route('/static/<path:filename>')
|
1549 |
-
def static_files(filename):
|
1550 |
-
print(f"Serving static file: {filename}")
|
1551 |
-
return send_from_directory(app.static_folder, filename)
|
1552 |
|
1553 |
if __name__ == "__main__":
|
1554 |
# 허깅페이스 Space에서는 PORT 환경 변수를 사용합니다
|
|
|
1345 |
resp.headers['Expires'] = '0'
|
1346 |
return resp
|
1347 |
|
1348 |
+
# Static files should be accessible without login requirements
|
1349 |
+
@app.route('/static/<path:filename>')
|
1350 |
+
def static_files(filename):
|
1351 |
+
print(f"Serving static file: {filename}")
|
1352 |
+
return send_from_directory(app.static_folder, filename)
|
1353 |
+
|
1354 |
+
# Add explicit handlers for JS files that are failing
|
1355 |
+
@app.route('/static/js/<path:filename>')
|
1356 |
+
def static_js_files(filename):
|
1357 |
+
print(f"Serving JS file: {filename}")
|
1358 |
+
js_path = os.path.join('js', filename)
|
1359 |
+
return send_from_directory(app.static_folder, js_path)
|
1360 |
+
|
1361 |
# 기본 경로 및 기타 경로 처리 (로그인 필요)
|
1362 |
@app.route('/', defaults={'path': ''}, methods=['GET'])
|
1363 |
@app.route('/<path:path>', methods=['GET'])
|
|
|
1558 |
print("Index route redirecting to index.html")
|
1559 |
return redirect('/index.html')
|
1560 |
|
|
|
|
|
|
|
|
|
1561 |
|
1562 |
if __name__ == "__main__":
|
1563 |
# 허깅페이스 Space에서는 PORT 환경 변수를 사용합니다
|