====== Templates ======
**base.html** template:-
{% block header %}
{% endblock %}
{% block content %}
{% endblock %}
===== Passing a dictionary into a template =====
==== Python ====
Flask needs to return a template and the name of any dictionaries used.
from flask import make_response, render_template, request
headers = {'title': 'Login Page'}
result = {'username': username}
return render_template('output.html', headers=headers, result=result)
==== output.html ====
{% extends "base.html" %}
{% block header %}
{{ headers['title'] }}
{% endblock %}
{% block content %}
Data Result
{% endblock %}
===== Setting Cookies =====
See 'status':-
loginresult = {'username': username, 'known_as': known_as, 'expiry': cookie_expiry}
response = make_response(render_template(
'loginoutput.html', loginresult=loginresult, headers=headers)
)
response.set_cookie('status', 'not_known')
return response