Introduction Previous article lo manam Views & URLs chusam. Ipudu next important concept 👉 Templates & HTML Rendering Django lo dynamic HTML pages ela create cheyyalo ee article lo nerchukundam 🔥 🧠 Templates ante enti? 👉 Template ante HTML file But special enti ante: 👉 Dynamic data display cheyyachu (Python data → HTML lo show) 📁 Templates folder create cheyyadam Mee app lo templates ane folder create cheyandi: myapp/ templates/ index.html ⚙️ settings.py lo config cheyyali settings.py open cheyandi: TEMPLATES = [ { 'DIRS': [], ... }, ] 👉 Usually app templates automatic ga detect chestundi 💻 Simple HTML Template index.html : <!DOCTYPE html> <html> <head> <title>Django Page</title> </head> <body> <h1>Hello {{ name }}</h1> </body> </html> 👉 {{ name }} → dynamic data placeholder ⚡ View lo render cheyyadam from django.shortcuts import render def home(...
Introduction Previous article lo manam Django project create chesam. Ipudu chuddam 👉 user request vachinappudu Django ela respond avthundi? Django lo Views & URLs anevi chala important concepts 🔥 🧠 Simple ga ardham: 👉 URL = address 👉 View = action (logic) User URL enter chesthe → View execute avthundi 🔗 URLs ante enti? Example: http://127.0.0.1:8000/about/ http://127.0.0.1:8000/contact/ 👉 /about/ , /contact/ ni URLs antaru Django lo ee URLs ni urls.py file lo define chestam ⚙️ urls.py Example from django.urls import path from . import views urlpatterns = [ path('about/', views.about_view), ] 👉 Ikkada: 'about/' → URL about_view → View function ⚡ Views ante enti? 👉 View ante Python function User request vachinappudu: 👉 View function run avthundi 👉 Response return chestundi 💻 Simple View Example from django.http import HttpResponse def about_view(request): return HttpResponse("Hello from About Page") 👉 Browser lo /about/ open ches...