From 48c2bb79a953ff780e58a27701d1e7b2927931d4 Mon Sep 17 00:00:00 2001 From: TiynGER Date: Sun, 31 May 2020 17:48:59 +0200 Subject: [PATCH] cleaner style for configs in app --- src/app.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app.py b/src/app.py index 0bd6704..cdcd735 100644 --- a/src/app.py +++ b/src/app.py @@ -6,31 +6,35 @@ import config app = Flask(__name__) +TITLE = config.TITLE +STYLE = config.STYLE +DESCRIPTION = config.DESCRIPTION +WEBSITE = config.WEBSITE @app.errorhandler(404) def page_not_found(e): - return render_template('error.html', title=config.TITLE, errorcode='404', style=config.STYLE), 404 + return render_template('error.html', title=TITLE, errorcode='404', style=STYLE), 404 @app.route('/') @app.route('/index.html') def index(): content = con_gen.gen_index_string() - return render_template('index.html', title=config.TITLE, content_string=content, style=config.STYLE) + return render_template('index.html', title=TITLE, content_string=content, style=STYLE) @app.route('/archive') @app.route('/archive.html') def blog_archive(): content = con_gen.gen_arch_string() - return render_template('archive.html', title=config.TITLE, content_string=content, style=config.STYLE) + return render_template('archive.html', title=TITLE, content_string=content, style=STYLE) @app.route('/entry/') def entry(path): content = con_gen.gen_stand_string(path) if content != '': - return render_template('standalone.html', title=config.TITLE, content_string=content, style=config.STYLE) + return render_template('standalone.html', title=TITLE, content_string=content, style=STYLE) abort(404) @@ -38,8 +42,8 @@ def entry(path): @app.route('/rss.xml') def feed(): content = con_gen.get_rss_string() - rss_xml = render_template('rss.xml', content_string=content, title=config.TITLE, - description=config.DESCRIPTION, website=config.WEBSITE) + rss_xml = render_template('rss.xml', content_string=content, title=TITLE, + description=DESCRIPTION, website=WEBSITE) response = make_response(rss_xml) response.headers['Content-Type'] = 'application/rss+xml' return response