forked from orbit-oss/flask
Blueprint example app
This commit is contained in:
parent
20a3281209
commit
85ad4ffb60
7 changed files with 64 additions and 0 deletions
13
examples/blueprintexample/simple_page/simple_page.py
Normal file
13
examples/blueprintexample/simple_page/simple_page.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from flask import Blueprint, render_template, abort
|
||||
from jinja2 import TemplateNotFound
|
||||
|
||||
simple_page = Blueprint('simple_page', __name__,
|
||||
template_folder='templates')
|
||||
|
||||
@simple_page.route('/', defaults={'page': 'index'})
|
||||
@simple_page.route('/<page>')
|
||||
def show(page):
|
||||
try:
|
||||
return render_template('pages/%s.html' % page)
|
||||
except TemplateNotFound:
|
||||
abort(404)
|
||||
Loading…
Add table
Add a link
Reference in a new issue