Python for Finance: Analyze Big Financial Data

(Elle) #1

the text field for writing and posting comments


These files have to be stored in templates, the default (sub)directory for templates when


using Flask.


Example 14-3 shows the template containing the basic layout and some meta-information


(like the site title). This is the template all other templates inherit from.


Example 14-3. Template for basic layout of Tradechat application


<!doctype html>


Tradechat
href=“{{ url_for(‘static’, filename=‘style.css’) }}”>

Tradechat



{% if not session.logged_in %}
log in

register
{% else %}
log out
{% endif %}

{% for message in get_flashed_messages() %}
{{ message }}

{% endfor %}
{% block body %}{% endblock %}

Figure 14-7 shows a screenshot of the main page after starting the application for the first


time. No users are registered (or logged in, of course). No comments have been posted yet.

Free download pdf