Python Django Tutorial : Dynamic Landing Page with Live Data From TMDB API + Bootstrap Styling [2]

preview_player
Показать описание
In this video, we power up our Django app by creating a dynamic landing page from scratch. In this episode, you'll learn how to:

Securely Manage API Keys:
Get your free TMDB API key and keep it safe using a .env file with python-dotenv.

Configure Environment Variables:
Update your Django settings to load your API key securely.

Build Dynamic Views & Templates:
Write a Django view that fetches movie data from the TMDB API based on user-specified criteria (category or search term) and pass that data to your template.

Design a Responsive Landing Page:
Create a user-friendly page using Django's templating language and Bootstrap. You'll add a category dropdown, search form, and display movies in sleek Bootstrap cards.

Implement Robust Error Handling:
Use try/except blocks to manage API errors gracefully and inform users if something goes wrong.

This hands-on, beginner-friendly video teaches you real-world techniques to integrate external APIs and build dynamic, production-ready web pages with Django, and Bootstrap.

Chapters:

00:00 – What We'll Do and Learn (Objectives)
01:24 – Quick Recap: What We Covered in the Last Video
02:20 – Introducing the Live Data Source (The Movie Database TMDB API)
02:57 – Using Python-dotenv & .env: Keeping Our API Key Safe and Accessible
05:30 – Creating a Dropdown Menu with Categories and Styling it with Bootstrap
09:22 – Building the Categories Form
12:07 – Setting Up the TMDB API Categories/Movie Lists Base URL
13:00 – Overview of Python's Requests Library
13:36 – Making GET Requests to the TMDB API to Fetch Movie Data and Passing it to the Template
16:36 – Looping Through Movies and Placing Them in Bootstrap Cards
18:23 – Displaying Movie Posters (Using Django Template Variables)
19:25 – Ensuring the Category Dropdown Shows the Selected Category (Using Django Template If Statements/Conditions)
23:24 – Using the Django Template Filter: floatformat
24:07 – Finalizing the Landing Page Layout and Card Styling
26:45 – Adding Movie Search Functionality
33:40 – Implementing Request Error Handling (Try/Except Block)
35:28 – Adding an Error Message to the Template

🔗Important Resources and Links:
Github Repo (Part 1):

Github Repo [ source code ]:

Django Docs:

Htmx Docs:

🧡 If you have found this content useful consider becoming my Patreon: 💜
Рекомендации по теме
Комментарии
Автор

Awesome tutorial Piko 👍, you made me feel that I can fly too with django and wagtail! I am python user but missing the whole bootstrap, css and mixing html/css with django experience. Another thing which I liked about your videos is that you are keeping it close to the visuals, i.e. after making small edits you show how it renders on the webpage.

abhityagi
Автор

I like this. Easy to follow but not boring and full of useful information for newbs like me and you show how you fix bugs, very helpful. Thanks for making it.

BlueSophora
Автор

Now i understand how views and forms work in Django. Very good explanation 🙏🙏🙏

pancake-lover
Автор

I've learnt a lot today, thank you 👍
So please make a video about Django channels 🙏🙏

rayncodes
Автор

Another great one! Thanks yiu! Will the next video show how to use htmx?

friendlyalien-joys
Автор

thank you
when part 3 goes for public?

arefsa
join shbcf.ru