I’m trying to simply get the current Site from within a template for parsing like so:
<h3>{{ site.name }}</h3>
Unfortunately, this isn’t bringing anything up.
Is there a way to get access to the current site from a template?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The title of your question presumes that “view” and “template” are interchangeable — they’re not. In order to get the current site in a template, it needs to be added to the context that is used to render the template. If you’re using a
RequestContext, you can write a context processor to do this automatically.You can write a context processor to do this like so:
Then, add it to your
TEMPLATE_CONTEXT_PROCESSORS, and use it like so: