🚀 Django Day 24 – Adding Images to the Project 🖼️ In yesterday’s video 🎥, I showed how the website looked like — it was coming together nicely, but there were no images on it yet 😅. So today, I decided to work on that and bring more life and visual appeal to the blog page 🌄. In Django, images are considered static files, which means they are implemented and attached in the same way CSS files are. For example, when linking a CSS file, I make use of the {% load static %} tag at the top of the HTML file, and then reference the file path like this: <link rel="stylesheet" href="{% static 'blog/styles.css' %}"> The same concept applies to images 🖼️ — for instance, if I want to add a blog banner or thumbnail, I can do something like this: <img src="{% static 'blog/images/blog-banner.jpg' %}" alt="Blog Banner"> This tells Django to look for the image in the static folder and display it properly on the page. Today’s focus was all about understanding how static files (especially images) are handled and how to properly link them within the templates. I also made sure the images directory was correctly structured inside the static folder and that my settings were configured to recognize them ✅. Now the blog page looks way more engaging and visually balanced 💻✨ There’s a video below 🎬 showing how the website looks now with images added 🩵 #Django #Python #WebDevelopment #CSS #Frontend #LearningInPublic #100DaysOfCode #LexissLearns 🚀

To view or add a comment, sign in

Explore content categories