Skip to content

Commit cfd4985

Browse files
committed
Allow flask app to serve assets in cases there's no nginx server available.
1 parent 64509f4 commit cfd4985

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33
import os
44

5-
from flask import Flask, request
5+
from flask import Flask, request, send_file
66

77
app = Flask(__name__)
88
app.config["UPLOAD_FOLDER"] = os.getenv("UPLOAD_FOLDER", "/usr/share/nginx/html")
@@ -37,6 +37,13 @@ def save():
3737
return filename
3838

3939

40+
# This route should be used for debugging filestore locally.
41+
42+
@app.route("/static/<string:path>")
43+
def serve(path):
44+
return send_file(os.path.join(app.config["UPLOAD_FOLDER"], path))
45+
46+
4047
if __name__ == "__main__":
4148
port = int(os.getenv("FILESTORE_PORT", "7910"))
4249
app.run(use_debugger=True, use_reloader=True, port=port, host="0.0.0.0")

0 commit comments

Comments
 (0)