emmett-framework / emmett

The web framework for inventors
BSD 3-Clause "New" or "Revised" License
1.06k stars 71 forks source link

app.render_template returns template as string #283

Closed ianshk closed 4 years ago

ianshk commented 4 years ago

I think this is a bug, when returning app.render_template() it will not display as html but displays as a string. I think it is because no dictionary is detected.

example: return app.render_template('error.html')

gi0baro commented 4 years ago

@ianshk in Emmett the default value for the Content-Type header is text/plain (in weppy was text/html).

You should set the proper value in the header, eg:

response.content_type = "text/html"
return app.render_template("error.html")

Ref: https://emmett.sh/docs/2.0.x/upgrading#default-value-for-content-type-header