-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Overview
Some ideas for additional labs based on common debugging scenarios Django developers face after completing the tutorial and working on their first projects.
High Value (Almost everyone hits these)
Timezone Issues
- Naive vs aware datetime comparisons causing silent bugs
USE_TZ=Truebut comparing withdatetime.now()instead oftimezone.now()- Dates filtering incorrectly across timezone boundaries
- Great for Debug Toolbar since you can inspect the actual SQL datetime values
CSRF Token in AJAX Requests
- Form works fine, but JavaScript fetch/axios POST fails with 403
- Teaches browser dev tools Network panel for inspecting headers
- Common when adding interactivity to Django templates
Template Context Silently Failing
- Variable typo in template renders as empty string (no error)
- Missing context variable from view
- Teaches
string_if_invalidsetting and how Django's template silence can hide bugs
Migration Conflicts
- Two developers add migrations, both numbered 0005
makemigrations --mergeworkflow- Very common in team environments
Medium Value (Common enough, good teaching moments)
Static Files Not Loading
- Works in development, breaks in production
STATIC_URLvsSTATIC_ROOTvsSTATICFILES_DIRSconfusioncollectstaticnot run- Debug Toolbar can show 404s for static assets
Form Validation Errors Not Displaying
form.errorsexists but template doesn't render them{{ form.non_field_errors }}forgotten- Field-level errors vs form-level errors
Middleware Ordering
- Authentication middleware after something that requires
request.user - Session middleware ordering issues
- Good for understanding the request/response cycle
Model.save() Not Persisting Changes
- Forgetting to call
save()after modifying instance update_fieldsexcluding the field you changed- QuerySet methods returning new querysets (immutability confusion)
Lower Priority (More niche but educational)
Email Not Sending in Development
EMAIL_BACKENDnot set to console backend- Good excuse to introduce
django-debug-toolbar's mail panel ordjango-mailer
Logging Configuration
- Logs not appearing despite
logger.error()calls - Log level hierarchy confusion
- Propagation issues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels