Skip to content

Commit 53b587e

Browse files
committed
working on code for next blog post
1 parent 4733e7f commit 53b587e

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import os
2+
import bottle
3+
from bottle import route, run, template
4+
5+
6+
app = bottle.default_app()
7+
8+
TEMPLATE_STRING = """
9+
<html>
10+
<head>
11+
<title>Bar charts with Bottle and Bokeh</title>
12+
</head>
13+
<body>
14+
<h1>Bugs found over the past {{ bars_count }} days</h1>
15+
</body>
16+
</html>
17+
"""
18+
19+
20+
@route('/<num_bars:int>/')
21+
def chart(num_bars):
22+
"""Returns a simple template stating the number of bars that should
23+
be generated when the rest of the function is complete.
24+
"""
25+
if num_bars <= 0:
26+
num_bars = 1
27+
return template(TEMPLATE_STRING, bars_count=num_bars)
28+
29+
30+
if __name__ == '__main__':
31+
run(host='127.0.0.1', port=8000, debug=False, reloader=True)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
flask==0.12.2
2+
bokeh==0.12.5
3+
pandas==0.20.1

0 commit comments

Comments
 (0)