Django - manually build HttpResponse, but want to use a template too
django, django-templates, python
Solution
Using `render_to_string`, you will get rendered string. You can pass the returned string to the `HttpResponse`.
from django.template.loader import render_to_string
...
rendered = render_to_string('my_template.html', {'foo': 'bar'})
response = HttpResponse(rendered)
Problem
When returning an `HttpResponse` object with `render_to_response` you can provide a template and it will use that template and fill in all the `{{ variables }}` you've set within your template. If I want to build my `HttpResponse` object manually, is it possible to still use one of my templates in my template directory?