-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathutil.py
25 lines (22 loc) · 889 Bytes
/
util.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
import os
import traceback
import json
AUDIO_DIR = os.path.join(os.path.dirname(__file__), "audio")
BACKING_TRACK_UPLOAD_FNAME = os.path.join(AUDIO_DIR, "User Upload")
IMAGE_UPLOAD_FNAME = os.path.join(
os.path.dirname(__file__), "html", "user-upload-image")
def die500(start_response, e):
# This is slightly sketchy: this assumes we are currently in the middle
# of an exception handler for the exception e (which happens to be
# true.)
trb = traceback.format_exc().encode("utf-8")
start_response('500 Internal Server Error', [
('Content-Type', 'text/plain'),
("Access-Control-Allow-Origin", "*"),
("Access-Control-Max-Age", "86400"),
("Access-Control-Expose-Headers", "X-Audio-Metadata"),
("X-Audio-Metadata", json.dumps({
"kill_client": True,
"message": str(e)
}))])
return trb,