Where is the use of "The Django Template Language" in the frontend of a django powered website?
-
I have been fiddling with python for quite sometime, but I am completely new to the world of django.I was going through some websites developed using django, but I couldn't find the usage of "The Django Template Language" anywhere in the entire frontend of the websites. What is the reason behind this?
-
Answer:
What do you mean by "frontend" there? If HTML, CSS, JavaScript is what you're talking about, then Django template language is used to "create" the frontend on Django websites, and NOT "as" the frontend itself that you see. Also, frontend development is no more the right word to use. Let's call them Views and Templates. Views are those methods you wrote and attached to URLs which get executed when you visit a URL. These Views "cook" the food you've to show to the user. You've to "serve" the content to the user next, for which you use Templates. Imagine django template language as a language that gets stuff from your views and compiles it to HTML or CSS or JavaScript or something else. The bottom-line is, django templates are not shown in the frontend (as it is). What said is right... go ahead and read what he said now. So, your browser can only display standard web stuff like HTML, and that is what Django gives it at the end. I suggest you read the links he gave and also do this tutorial first: https://docs.djangoproject.com/en/1.6/intro/tutorial01/
Bharadwaj Srigiriraju at Quora Visit the source
Other answers
The django template language helps you build dynamic websites with django. Templates let you define the layout of the site. Basically a template can be anything even a text file but commonly it's HTML. Now, you can use the template language to render the template according to use etc. For example, you want to display the profile of every user, you declare something like <!-- a template saved as index.html --> Hello {{ username }} . . . in the template and pass the username in context from the view to the template using the http://django.me/render or http://django.me/render_to_response function and the variable username gets replaced by the variable username in context. # in the view def home(request): # detect user here return render(request,'index.html',{'username':'Dhiraj'}) #sends the dictionary to the template for substitution Django template is very powerful and rich in features. Read more about it at https://docs.djangoproject.com/en/dev/topics/templates/. You don't see this in the front end because django renders the template(substitutes the variables/evaluates conditions) before sending it to the browser.
Dhiraj Thakur
Related Q & A:
- How to load `static` tag by default in Django template?Best solution by tangowithdjango.com
- Where is a good graffiti website?Best solution by Yahoo! Answers
- What are the test automation tools that use perl as the scripting language??Best solution by Yahoo! Answers
- Where can I find a reliable turnkey website?Best solution by abcdesignstudio.com
- What is a bounce rate and where do we use it?Best solution by support.google.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.