Spaces:
Sleeping
Sleeping
Sunhey Cho
commited on
Commit
ยท
89707b0
1
Parent(s):
24a402d
Add dedicated static file route handler to fix 404 errors for JS files
Browse files
api.py
CHANGED
|
@@ -1545,6 +1545,11 @@ def index_page():
|
|
| 1545 |
print("Index route redirecting to index.html")
|
| 1546 |
return redirect('/index.html')
|
| 1547 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1548 |
if __name__ == "__main__":
|
| 1549 |
# ํ๊น
ํ์ด์ค Space์์๋ PORT ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํฉ๋๋ค
|
| 1550 |
port = int(os.environ.get("PORT", 7860))
|
|
|
|
| 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 ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํฉ๋๋ค
|
| 1555 |
port = int(os.environ.get("PORT", 7860))
|