Django Templates and Frontend UI

Day 91 – Working with Templates in Django Today I learned how Django handles the frontend using Templates and how everything connects from URL to the final HTML page rendered in the browser. 🔹 What are Templates? Templates are the HTML pages in Django that define the frontend UI of a web application. 🔹 What I Did Today ✔️ Created Templates Folder Inside my app, I created a folder named templates (naming is important for Django to recognize it) ✔️ Linked Templates Configured the TEMPLATES setting in settings.py by adding 'templates' inside the DIRS list ✔️ Created HTML Page Built a simple index.html page inside the templates folder ✔️ Created View Function In views.py, created a function: return render(request, 'index.html') → This is how Django sends HTML to the browser ✔️ Connected URLs to Views Mapped the function in urls.py using: path('', views.index) 🔹 How It Works (Flow) 👤 User → URL ➡️ urls.py checks the path ➡️ Calls the function in views.py ➡️ render() loads the HTML page ➡️ Template is displayed in browser 🎉 🔹 Key Takeaway Django follows a clear flow: URL → View → Template Understanding this connection makes it much easier to build dynamic websites step by step. Learning how backend connects to frontend feels like unlocking the real power of web development 🔥 #Django #Python #WebDevelopment #Frontend #Backend #FullStackDevelopment

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories