-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
executable file
·52 lines (40 loc) · 1.23 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
import argparse
from flask import Flask, render_template
import app_config
from render_utils import make_context, urlencode_filter
import static
app = Flask(app_config.PROJECT_NAME)
app.jinja_env.filters['urlencode'] = urlencode_filter
# Example application views
@app.route('/')
def index():
"""
Example view demonstrating rendering a simple HTML page.
"""
return render_template('index.html', **make_context())
@app.route('/widget.html')
def widget():
"""
Embeddable widget example page.
"""
return render_template('widget.html', **make_context())
@app.route('/test_widget.html')
def test_widget():
"""
Example page displaying widget at different embed sizes.
"""
return render_template('test_widget.html', **make_context())
@app.route('/test/test.html')
def test_dir():
return render_template('index.html', **make_context())
app.register_blueprint(static.static)
# Boilerplate
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--port')
args = parser.parse_args()
server_port = 8000
if args.port:
server_port = int(args.port)
app.run(host='0.0.0.0', port=server_port, debug=app_config.DEBUG)