[Flask] render_template_string doesn't render

Patrick L Jones plj at mitre.org
Fri Aug 13 14:48:55 EDT 2021


Greetings,

            I have the following:
def get(self):
    return render_template_string('<h1>PLEASE CLOSE THIS WINDOW</h1>')

When the following is called what is displayed in the browser is :
'<h1>PLEASE CLOSE THIS WINDOW</h1>'

It doesn't get rendered.  I have tried various option as seen on the web, such as:

return render_template_string('''<!doctype html>
<html>
    <head>
        <link rel="stylesheet" href="css url"/>
    </head>
    <body>
        <p>Hello, World!</p>
    </body>
</html>
''')

It just displays the html, it doesn't render it.  I have also tried render_template('pleaseclose.html'), it also just displays the html in the file and doesn't render it

               The way the get(self) is called is by a callback from an OAuth2 request.

Any thoughts ?

Thank you

Pat


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/flask/attachments/20210813/e361225c/attachment.html>


More information about the Flask mailing list