Posts not showing up on home page in Flask

The Goal

I'm creating a Flask website to serve as the UI for a custom bioinformatics pipeline. The way I'm trying to design it is such that the user fills in the pipeline parameters (e.g. Project Name, Data Type, Number of Samples, etc.) in a multi-page form (kind of like the checkout process in online ordering) and then I would like these parameters to be saved to the user's account page as separate "posts".

The Issue

I've been following a Flask Tutorial online (https://www.youtube.com/watch?v=QnDWIZuWYW0&list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH&index=2) about how to save the "posts" (pipeline parameters) to the user's dashboard by supplying fake or sample "posts" to the dashboard's html template, but nothing shows up at all. What am I doing wrong?

The Source Code

routes.py:

posts = [
            {
                'username': 'claudiadast',
                'date_posted': 'September 22, 2018',
                'stack_name': 'wgs-test-stack',
                'start_point': 'fastq',
                'input_uri': 's3://pipeline-validation/smallfq/',
                'build': 'GRCh38',
                'ome': 'wgs',
                'project_id': 'summerwater598'
            },
            {
                'username': 'claudiadast',
                'date_posted': 'September 10, 2018',
                'stack_name': 'clinical-exome',
                'start_point': 'fastq',
                'input_uri': 's3://pipeline-validation/Clinex/',
                'build': 'GRCh38',
                'ome': 'wes',
                'project_id': 'summerwater598'
            }
        ]

@app.route(‘/’)
@app.route(‘/home’)
def home():
return render_template(‘home.html’, posts=posts)

home.html:

{% extends “layout.html” %}
{% block content %}
{% for post in posts %}
<h1>{{ post.stack_name }}</h1>
<p>{{ post.username }} on {{ post.date_posted }}</p>
<p>Pipeline Parameters:</p>
<p>{{ post.stack_name }}</p>
<p>{{ post.start_point }}</p>
<p>{{ post.input_uri }}</p>
<p>{{ post.build }}</p>
<p>{{ post.ome }}</p>
<p>{{ post.project_id }}</p>
{% endfor %}
{% endblock content %}

layout.html:

<!DOCTYPE html>
<html>
<head>
<meta charset=“utf-8”>
<title>Psychcore Pipeline</title>
<link rel=“stylesheet” href=“static/site.css”
</head>
<body>
{% include ‘includes/_navbar.html’ %}
<div class=“container”>
{% block body %}{% endblock %}
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class=“alert alert-{{ category }}”>
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
</div>

    &lt;script src='https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js'&gt;&lt;/script&gt;
&lt;/body&gt;

</html>


#html #flask

3 Likes3.15 GEEK