-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
38 lines (25 loc) · 826 Bytes
/
app.py
File metadata and controls
38 lines (25 loc) · 826 Bytes
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
33
34
35
36
37
38
import tornado.ioloop
PORT = 8000
def run():
tornado.ioloop.IOLoop.instance().start()
def dev_prepare():
import re
import os
import engine
source_path = os.path.join(os.getcwd(), 'dist/index.html')
target_path = os.path.join(os.getcwd(), 'dist/index_dev.html')
js_list = ['runtime.js', 'polyfills.js', 'styles.js', 'vendor.js', 'main.js']
with open(source_path, 'r') as f:
dev_file = open(target_path, '+w')
while True:
line = f.readline()
if not line:
break
for j in js_list:
line = line.replace(j, '{{ static_url(\"%s\") }}' % j)
dev_file.write(line)
dev_file.close()
engine.app.listen(PORT)
if __name__ == "__main__":
dev_prepare()
run()