Forums

render_template problem

I read the marvelous tutorial "A beginner's guide to building a database." As instructed I imported render_template, but I noticed something peculiar. This line does not work: return render_template("main_page.html", comments=Comment.query.all()). The error log says, "2022-09-13 00:42:34,329: File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1685, in make_response 2022-09-13 00:42:34,330: f"The view function for {request.endpoint!r} did not" 2022-09-13 00:55:11,343: OSError: write error" However, the following line works just fine: return render_template("main_page.html"). So, apparently "comments=Comment.query.all()" causes an error when included. Thank you in advance for any assistance you can offer.

The 'OSError: write error' message is logged when a client disconnects from the server before the server has finished sending the response. This can happen because the site is slow and a user stops the page from loading or because the timeout on a client is too small.

Thanks! I got it all working!