-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviews_db.py
45 lines (36 loc) · 1.18 KB
/
views_db.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 python2.7
from bottle import route, run, template, get, debug, static_file
import os
import re
debug(True)
from convertor import Db
# # Project configuration # #
PROJECT_PATH = os.getcwd()
views_path = os.path.join(PROJECT_PATH,'views')
static_path = os.path.join(PROJECT_PATH,'static')
result_path = os.path.join(PROJECT_PATH,'data')
@get('/static/<filename:re:.*\.js>')
def javascripts(filename):
return static_file(filename, root='static/js')
@get('/static/<filename:re:.*\.css>')
def stylesheets(filename):
return static_file(filename, root='static/css')
@get('/static/<filename:re:.*\.(jpg|png|gif|ico)>')
def images(filename):
return static_file(filename, root='static/img')
@get('/static/<filename:re:.*\.(eot|ttf|woff|svg)>')
def fonts(filename):
return static_file(filename, root='static/fonts')
@route('/view/<db_name>')
def get_data(db_name):
db_new = os.path.join(PROJECT_PATH, db_name)
db = Db(db_new)
db.__connect__()
db.select_tables()
db.build_schema()
if db.convert():
return template('json_simple', db = db)
else:
return template('404', db = db)
run(host='localhost', port=8000)
# get_data("cop-clean.db")