#5 Django tutorials | Django Template Language | DTL
361.5K views on YouTube
Check out our courses:
Agentic AI Engineering with Python : https://go.telusko.com/agentic-ai-python
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : https://go.telusko.com/learn-master
Coupon: TELUSKO10 (10% Discount)
For More Queries WhatsApp or Call on : +919008963671
website : https://telusko.com/
Udemy Courses:
Java Spring:- https://go.telusko.com/Udemyjavaspring
Java:- https://go.telusko.com/udemyteluskojava
Spring: https://go.telusko.com/udemyteluskospring
Java For Programmers:- https://go.telusko.com/javaProgrammers
Python : https://go.telusko.com/udemyteluskopython
Git : https://go.telusko.com/udemyteluskogit
Docker : https://go.telusko.com/udemyteluskodocker
Instagram : https://www.instagram.com/navinreddyofficial/
Linkedin : https://in.linkedin.com/in/navinreddy20
WhatsApp : https://go.telusko.com/whatsapp
Discord : https://discord.gg/D8hWe9BqfF
In this lecture we are discussing about:
#1 DTL (Django Template Language)
a) use of DTL in Django
b) use dynamic content in Django
#2 use of Jinja template example in Django.
— in views.py you can use html tag inside HttpResponse
def home(request):
— it work fine to use tag inside HttpResponse
— but if you want a big page then you need to create a template
— and this has a dynamic page
#1 DTL (Django Template Language)
we have concept of DTL (Django Template Language)
— other option in django is jinja template
–generally you created the app outside the app
— and then you can use it in your project
— you can create a folder with name templates outside the app folder
Now in templates folder you can create a html file
— home.html
Now you go to telusko folder inside change the settings.py
— in templates
— in DIRS change the path [os.path.join(BASE_DIR,’templates’)],
— now you can use the template in your views.py
a) Now you need to change the views.py
— from django.shortcuts import render
— from django.http import HttpResponse
— def home(request):
— return render(request,’home.html’)
b) now you get dynamic content
— now you want to pass some dynamic value from views.py
inside this home function add JSON data
— def home(request):
— return render(request,’home.html'{‘name’,’Navin’})
— go to templates and next to home.html
— changing content in json file will change the content in html file
#2 use of Jinja template example in Django.
— this curly braces {{name}} simply means jinja templates or pattern
— we can do operation in jinja templates
— you can use jinja templates instead of DTL
— but DTL is by default in django
Python Tutorials for beginner : https://bit.ly/2qfhUCp
Django Tutorials : https://www.youtube.com/watch?v=SIyxjRJ8VNY&list=PLsyeobzWxl7r2ukVgTqIQcl-1T0C2mzau
Django is a high-level Python-based free and open-source web framework, which follows the model-view-template (MVT) architectural pattern.
It is maintained by the Django Software Foundation (DSF).
Django’s primary goal is to ease the creation of complex, database-driven websites.
Some well-known sites that use Django include the Public Broadcasting Service, Instagram, Mozilla, The Washington Times, Disqus, Bitbucket, and Nextdoor.
In this video we will see:
Django Tempalte Language
Including HTML tags in a program
Create Django Template to create dynamic webpage
Editing settings.py file
Github :- https://github.com/navinreddy20/Python-
Editing Machines & Monitors :
https://amzn.to/2HA6ra8
https://amzn.to/2VMBBPw
https://amzn.to/2RfKWgL
https://amzn.to/2Q665JW
https://amzn.to/2OUP21a.
Donation & Support:
Indian Payment : https://www.instamojo.com/@NavinReddy/
PayPal Id : navinreddy20
Patreon : navinreddy20