aboutsummaryrefslogtreecommitdiff
path: root/run.py
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2020-06-09 22:14:21 -0700
committerJordan <me@jordan.im>2020-06-09 22:14:21 -0700
commit01ddb0b13d2ab2039c1a615bbf3ee08f80a44e5b (patch)
tree5aa6969a741996d963a0c99e4c822998cb77994a /run.py
parentecfa70f53576ec70ede543f5dfd395bd4951d1df (diff)
downloadroka-01ddb0b13d2ab2039c1a615bbf3ee08f80a44e5b.tar.gz
roka-01ddb0b13d2ab2039c1a615bbf3ee08f80a44e5b.zip
use bootstrap, send_static()
Diffstat (limited to 'run.py')
-rwxr-xr-xrun.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/run.py b/run.py
index 90e61c0..71753eb 100755
--- a/run.py
+++ b/run.py
@@ -10,6 +10,7 @@ from collections import OrderedDict
from operator import getitem
from datetime import date, timedelta
from flask import Flask, request, Response, render_template, send_file
+from flask import send_from_directory
from xml.dom import minidom
abs_path = os.path.dirname(os.path.abspath(__file__))
@@ -198,7 +199,7 @@ def list_books():
pub_date = ET.SubElement(item, 'pubDate')
pub_date.text = (date(2000, 12, 31) - timedelta(days=idx)).ctime()
enc_attr = {
- 'url': '{}?a={}&f={}'.format( request.base_url, a, f),
+ 'url': '{}?a={}&f={}'.format(request.base_url, a, f),
'length': str(books[a]['files'][f]['size_bytes']),
'type': 'audio/mpeg'
}
@@ -212,5 +213,12 @@ def list_books():
return Response('unauthorized', 401, form)
return render_template('index.html', books=books)
+@app.route('/static/<path:path>')
+def send_static(path):
+ '''
+ Serve static files from the static directory
+ '''
+ return send_from_directory('static', path)
+
if __name__ == '__main__':
app.run(host='127.0.0.1', port='8085', threaded=True)