Reputation: 110093
What is the simplest way to return HTML without rendering a template?
Something like:
return HttpResponse('<html><p>Hello!</p></html>')
If I just do this as above, it will render it as a string instead of html.
Upvotes: 0
Views: 73
Reputation: 31910
You need to set content type to text/html
:
return HttpResponse("<html><p>Hello!</p></html>", content_type="text/html")
It should be default content type unless you've set DEFAULT_CONTENT_TYPE
setting to something else.
Upvotes: 5