Reputation: 143
I am working on a Flask web application, and encountering an issue concerning duplicate HTTP requests.
Every time a request is made, it is sent twice (for GET requests and POST requests as well), as can be seen on the screenshot below. I am running the application in production environment and with debug mode being "off".
How could I find out why the requests are being sent twice ?
EDIT:
The view functions are indeed being called twice every time a request is made. Any ideas ?
from flask import render_template
@product.route('/', methods=['GET', 'POST'])
@login_required
def index():
print('Request to index.')
products = Product.query.all()
return render_template('product/index.html', products=products)
Upvotes: 2
Views: 1739
Reputation: 112
Chrome sends an extra GET request for a favicon. Add this to the head of your html to stop this request
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
Upvotes: 4