Complete the code to register a blueprint named 'blog' in a Flask app.
from flask import Flask, Blueprint blog = Blueprint('blog', __name__) app = Flask(__name__) app.[1](blog)
In Flask, you register a blueprint to the app using register_blueprint.
Complete the route decorator to define a route '/post' inside the 'blog' blueprint.
from flask import Blueprint blog = Blueprint('blog', __name__) @blog.[1]('/post') def show_post(): return 'Post page'
The @blueprint.route() decorator defines a route inside a blueprint.
Fix the error in the blueprint template rendering code to render 'post.html'.
from flask import Blueprint, render_template blog = Blueprint('blog', __name__, template_folder='templates') @blog.route('/post') def show_post(): return [1]('post.html')
Use render_template to render HTML templates in Flask.
Fill both blanks to create a blueprint named 'shop' with a URL prefix '/store'.
from flask import Blueprint shop = Blueprint('[1]', __name__, url_prefix='[2]')
The blueprint name is 'shop' and the URL prefix should be '/store' with a leading slash.
Fill all three blanks to create a route '/item/' in the 'shop' blueprint that renders 'item.html' passing the id.
from flask import Blueprint, render_template shop = Blueprint('shop', __name__) @shop.[1]('/item/<int:id>') def show_item([2]): return [3]('item.html', id=id)
The route decorator is route, the function parameter is id, and the template is rendered with render_template.