Summary
Keywords
Full Transcript
Check out our courses: AI Powered DevOps with AWS - Live Course :- https://go.telusko.com/AIDevOps-AWS Coupon: TELUSKO10 (10% Discount) Complete Java Developer Course Batch-4: https://go.telusko.com/Complete4 Coupon: TELUSKO10 (10% Discount) Master Java Spring Development : https://go.telusko.com/masterjava Coupon: TELUSKO20 (20% Discount) Udemy Courses: Spring: https://go.telusko.com/udemyteluskospring Java:- https://go.telusko.com/udemyteluskojava Java Spring:- https://go.telusko.com/Udemyjavaspring 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 For More Queries WhatsApp or Call on : +919008963671 website : https://courses.telusko.com/ 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. Instagram : https://www.instagram.com/navinreddy20 Twitter : https://twitter.com/navinreddy20 Telusko : https://www.facebook.com/teluskolearn... Navin Reddy : https://www.facebook.com/navintelusko Subscribe to our other channel: Navin Reddy : https://www.youtube.com/channel/UCxmkk8bMSOF-UBF43z-pdGQ Telusko Hindi : https://www.youtube.com/channel/UCitzw4ROeTVGRRLnCPws-cw Donation & Support: Indian Payment : https://www.instamojo.com/@NavinReddy/ PayPal Id : navinreddy20 Patreon : navinreddy20
