-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
executable file
·45 lines (35 loc) · 1.09 KB
/
index.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
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
import sys
import json
import os
import bottle
from bottle import route, run, template,debug, get, static_file, post, get,request, redirect
from model import files
@route('/index.html')
@route('/')
def showIndex():
if 'refresh' in request.query and request.query['refresh'] == 'true':
refresh = True
else:
refresh = False
fileList = files.getFileList(refresh)
return template('views/index.tpl', fileList=fileList)
@route('/info.html')
def showInfo():
fileInfo = files.getFileInfo(request.query['file'])
return template('views/info.tpl', fileInfo=fileInfo)
@route('/css/<filepath:path>')
def css(filepath):
print ('looking for {}'.format(filepath))
return static_file(filepath, root='./css')
@route('/img/<filepath:path>')
def css(filepath):
print ('looking for {}'.format(filepath))
return static_file(filepath, root='./img')
@route('/favicon.ico')
def favicon():
return static_file('favicon.ico', root='./img')
if __name__ == "__main__":
debug(True)
app = bottle.app()
run(app=app, host='0.0.0.0', port=8000)