M cogito2/app.py +6 -3
@@ 28,6 28,9 @@ def article_show(id):
return render_template('show.html', article=article)
-@app.template_filter('env')
-def env_filter(key, default):
- return environ.get(key, default)
+@app.context_processor
+def utility_processor():
+ def get_env(key, default=None):
+ return environ.get(key, default)
+ return dict(get_env=get_env)
+
M cogito2/templates/base.html +1 -1
@@ 9,7 9,7 @@
<body>
<div class="container">
<div class="page-title">
- <h1>The {{ 'OWNER_NAME' | env('OWNER NAME') }}'s blog</h1>
+ <h1>The {{ get_env('OWNER_NAME', 'XXX') }}'s blog</h1>
</div>
<div class="content">
<article>