forked from ejconlon/bottle-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
executable file
·37 lines (29 loc) · 954 Bytes
/
app.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
#!/usr/bin/env python
import os
from bottle import route, run, static_file, template, view, request, post
@route('/js/<filename>')
def js_static(filename):
return static_file(filename, root='./js')
@route('/img/<filename>')
def img_static(filename):
return static_file(filename, root='./img')
@route('/css/<filename>')
def img_static(filename):
return static_file(filename, root='./css')
@route('/fonts/<filename>')
def fonts_static(filename):
return static_file(filename, root='./fonts')
@route("/")
@view("main")
def hello():
return dict(title = "Hello", content = "Hello from Python!")
@route('/suggestions.json')
def returnarray():
from bottle import response
from json import dumps
rv = ['Hello','World','Hallo','Welt']
response.content_type = 'application/json'
return dumps(rv)
if __name__ == "__main__":
port = int(os.environ.get("PORT", 5000))
run(host='0.0.0.0', port=port, reloader=True)