(Aug-14-2021, 05:33 PM)ndc85430 Wrote: Please use Python tags when posting code, to keep the formatting and add line numbering and syntax highlighting. You can use the Python logo button to insert a pair of tags and then just post your code between them.
So what is wrong with your program? You haven't shown any errors.
Thanks
Where do I find the python tags to use and how do I include line numbers? I am using Visual Code.
For starters, nothing happens. I cannot display the fields in the html. They display as blanks or empty fields.
I need to run a connection to an ODBC driver. I need to pass data into the connection string and this simply fails in flask.
I tested the link to the ODBC and that works but that may have been pure python.
I guess I don't know the relationship between flask and python and what to do when. Everything I found so far is all basic CRUD stuff which I have working but when you need to manipulate the data, I have trouble as here.
Testing the code in basic python gives me the results I am looking for but when I try to add it on the first page, it blows up or ignores the code.
None of the values in jinja display.
The following is index.html.
[html]
{% extends 'base.html' %}
{% block head %}
<title>Home</title>
{% endblock %}
{% block body %}
<br>
<h1{{ datetime }}</h1>
2021-08-12
connect_ibm = {{ connect_ibm }}
driver = {{ driver }}
system = {{ system }}
username = {{ username }}
<br>
<main role="main">
<div class="jumbotron">
<div class="col-sm-8 mx-auto">
<h1>Top 5 numbers</h1>
<br>
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">Position</th>
<th scope="col">Number</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>{{ rank_1 }}</td>
</tr>
<tr>
<th scope="row">2</th>
<td>{{ rank_2 }}</td>
</tr>
<tr>
<th scope="row">3</th>
<td>{{ rank_3 }}</td>
</tr>
<tr>
<th scope="row">4</th>
<td>{{ rank_4 }}</td>
</tr>
<tr>
<th scope="row">5</th>
<td>{{ rank_5 }}</td>
</tr>
<tr>
<th scope="row">6</th>
<td>{{ rank_6 }}</td>
</tr>
</tbody>
</table>
<a class="btn btn-primary" href="/posts" role="button">Refresh »</a>
</p>
</div>
</div>
</main>
{% endblock %}
[/html]