forked from sahilchinoy/public-trust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
executable file
·38 lines (28 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
38
#!/usr/bin/env python
import json
from flask import Flask, make_response, render_template
from werkzeug.debug import DebuggedApplication
import app_config
from render_utils import make_context, smarty_filter, urlencode_filter
import static
app = Flask(__name__)
app.debug = app_config.DEBUG
app.add_template_filter(smarty_filter, name='smarty')
app.add_template_filter(urlencode_filter, name='urlencode')
# Example application views
@app.route('/')
def index():
"""
Example view demonstrating rendering a simple HTML page.
"""
context = make_context()
return make_response(render_template('index.html', **context))
app.register_blueprint(static.static)
# Enable Werkzeug debug pages
if app_config.DEBUG:
wsgi_app = DebuggedApplication(app, evalex=False)
else:
wsgi_app = app
# Catch attempts to run the app directly
if __name__ == '__main__':
print 'This command has been removed! Please run "fab app" instead!'