Answer the question
In order to leave comments, you need to log in
Why doesn't the {{ site.domain}} tag work in a Django template?
I'm trying to get the domain name through the template tag: <form action="http://{{ site.domain }}" + "...">
But an empty url is rendered: <form action="http://">
What and where else should I do to make it work?
UPD
'django.contrib.sites' is available
Answer the question
In order to leave comments, you need to log in
{{}}
is not a tag, it's a variable substitution expression. Apparently, there is no variable in the context site
. You can pass it in from a view, write your own context processor, or use django.contrib.sites.middleware.CurrentSiteMiddleware .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question