I have a python/Flask program here. I trying to find out where in the code it is
ID: 3871833 • Letter: I
Question
I have a python/Flask program here. I trying to find out where in the code it is allowing me to continually loop through the program as i enter different queary's. see pix for better understanding.
*Python/Flask web app program.
I have a python/Flask program here. I trying to find out where in the code it is allowing me to continually loop through the program as i enter different queary's on the local host web app. see pix for better understanding.
There are many different query requests being made on the console they are in red. every time i query the web app on my local host it generates a new HTTP (request??) in the pyCharm console.
if someone can just highlight or copy paste the area of the code that it is allowing me to do that. thanks. python/flask and HTML code included.
HERE is my code and screenshot:
*****************my pyCharm python/flask code below:*******************
#!/usr/bin/env python
********MyHTML CODE:**********
File templates/date-picker.html:
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Date Selection</h2>
<form action="#" method="post">
<label> Date from:
{{ form.dt_from(class='datepicker') }}
{{ form.tm_from( ) }}
</label>
<label>Date to:
{{ form.dt_to(class='datepicker') }}
{{ form.tm_to( ) }}
</label>
{{ form.hidden_tag() }}
<input type="submit"/>
</form>
{% if images_list %}
<h2>Files that were found:</h2>
<table class="table">
<thead>
<tr>
<th>Date&time</th>
<th>Name</th>
</tr>
</thead>
<tbody>
{% for image in images_list %}
<tr>
<td>{{ image.date_time }}</td>
<td>{{ image.name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</body>
</html>
Explanation / Answer
Whenever any query is made, control is invoked from the current module that is main module.
app.run() gets invoked then.
Basically these web application frame work(django or flaskr) follows MVC (Model view controller) pattern.
views handles the different HTTP request methods. Model handles the database. Controller coordinates among all.
So here the decorator app.route is initiated for the POST and GET methods calling hello_world method.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.