I am stumped on why I am getting the following Server Error (500) shown below and need some help.
I have been working through W3Schools Django, everything was going well, I got the 2 examples at the top of the page ( Template Variables and Create Variable in View) working, but when I got to Django Template Variables and did the Create Variables in Template example I had this Server Error (500) problem.
I have pushed my work up to GitHub
In my template.html file
I have this code.
<!DOCTYPE html>
<html>
<body>
{% with firstname = "Tobias" %}
<h1>Hello {{ firstname }}, how are you ?</h1>
{% endwith %}
</body>
</html>
and in my views.py file, as I canât put a link to it, it is under same members folder as before.
I have this code
from django.http import HttpResponse
from django.template import loader
def testing(request):
template = loader.get_template('template.html')
return HttpResponse(template.render())
I just want to get an understanding on why I am getting this 500 error, when it looks like I have the correct code. If anyone knows why this is happening, I would appreciate some feedback thanks.