Ivan Borshchov
Ivan Borshchov

Reputation: 3539

Return html file without rendering in django

I want to use Django with single-page js framework and Django variable braces {{ clashes with framework delimiters. So I need to return some html file like response in my view without rendering file with any context. I've seen that many developers make reconfiguration of delimiters in JS but may be there are more suitable approach to save Django routing?

Upvotes: 0

Views: 558

Answers (2)

Daniel Roseman
Daniel Roseman

Reputation: 599470

It is much better to remove template rendering from this altogether. From the point of view of Django, your JS framework's templates are static files, and they should be served as such.

Upvotes: 2

Domen Blenkuš
Domen Blenkuš

Reputation: 2242

Put the desired code between {% verbatim %} and {% endverbatim %}. This will prevent Django from rendering it. You can read more in official documentation.

Upvotes: 3

Related Questions