You can use a template in a function based view as follows:
from django.shortcuts import render
def view(request):
return render(request, "template.html")
If you want to use template variables, you can do so as follows:
from django.shortcuts import render
def view(request):
context = {"var1": True, "var2": "foo"}
return render(request, "template.html", context=context)
Then, in template.html
, you can refer to your variables like so:
<html>
{% if var1 %}
<h1>{{ var2 }}</h1>
{% endif %}
</html>