1π
β
It is very rare that you really want to keep HTML in the database. Usually, you are better off keeping it in statically served files.
That said, just render your html with a RequestContext:
from django.template import Template, RequestContext
def get(self, request, *args, **kwargs):
...
html = HtmlModel.objects.get(name='unusual_practice').html
template = Template(html)
rendered_html = template.render(RequestContext(request))
...
RequestContext picks up the context processors, so you should have your STATIC_URL in there.
π€dokkaebi
Source:stackexchange.com