-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.py
32 lines (26 loc) · 1.02 KB
/
server.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
28
29
30
31
32
'''
mini-seerver to test files with apiviz
'''
# from pprint import pprint, pformat
from flask import Flask, render_template, send_from_directory, send_file
from flask_cors import CORS
app = Flask(__name__, template_folder='')
CORS(app)
@app.route("/content/<path:folder_path>/<string:filename>", methods=['GET'])
def serveHtml(folder_path, filename):
print("folder_path : ", folder_path)
print("filename : ", filename)
return render_template( folder_path + '/' + filename )
@app.route('/statics/<path:folder_path>/<string:filename>')
def sendStatic(folder_path, filename):
print("folder_path : ", folder_path)
print("filename : ", filename)
return send_from_directory(folder_path, filename)
# @app.route('/images/<path:folder_path>/<string:filename>')
# def sendImage(folder_path, filename):
# print("folder_path : ", folder_path)
# print("filename : ", filename)
# return send_from_directory(folder_path, filename)
# run the application
if __name__ == "__main__":
app.run(debug=True, host='localhost', port=8800)