mirror of
https://github.com/tiyn/beaker-blog.git
synced 2026-02-22 04:44:48 +01:00
adding config.py and switchable css
This commit is contained in:
13
src/app.py
13
src/app.py
@@ -1,6 +1,7 @@
|
||||
from flask import Flask, flash, make_response, render_template, request, redirect, abort
|
||||
|
||||
import content as con_gen
|
||||
import config
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -8,27 +9,28 @@ app = Flask(__name__)
|
||||
|
||||
@app.errorhandler(404)
|
||||
def page_not_found(e):
|
||||
return render_template('error.html', title='Error 404', errorcode='404'), 404
|
||||
return render_template('error.html', title=config.TITLE, errorcode='404', style=config.STYLE), 404
|
||||
|
||||
|
||||
@app.route('/')
|
||||
@app.route('/index.html')
|
||||
def index():
|
||||
content = con_gen.gen_index_string()
|
||||
return render_template('index.html', title='Blog', content_string=content)
|
||||
return render_template('index.html', title=config.TITLE, content_string=content, style=config.STYLE)
|
||||
|
||||
|
||||
@app.route('/archive')
|
||||
@app.route('/archive.html')
|
||||
def blog_archive():
|
||||
content = con_gen.gen_arch_string()
|
||||
return render_template('archive.html', title='Blog Archive', content_string=content)
|
||||
return render_template('archive.html', title=config.TITLE, content_string=content, style=config.STYLE)
|
||||
|
||||
|
||||
@app.route('/entry/<path>')
|
||||
def entry(path):
|
||||
content = con_gen.gen_stand_string(path)
|
||||
if content != '':
|
||||
return render_template('standalone.html', title='Blog Entry', content_string=content)
|
||||
return render_template('standalone.html', title=config.TITLE, content_string=content, style=config.STYLE)
|
||||
abort(404)
|
||||
|
||||
|
||||
@@ -36,7 +38,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)
|
||||
rss_xml = render_template('rss.xml', content_string=content, title=config.TITLE,
|
||||
description=config.DESCRIPTION, website=config.WEBSITE)
|
||||
response = make_response(rss_xml)
|
||||
response.headers['Content-Type'] = 'application/rss+xml'
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user