Lynxbee topic

Django

Articles about Django.

Fix “staticfiles Is Not a Registered Tag Library”

The old `{% load staticfiles %}` library was removed from Django. Replace it with `{% load static %}`, then verify the template engine and staticfiles app before diagnosing missing assets or production serving separately.

Fix MultipleObjectsReturned in Django and DRF

Django raises MultipleObjectsReturned when get() matches more than one row. The real fix depends on the domain: return a collection when duplicates are valid, or repair data and enforce uniqueness when exactly one row should exist.

Django REST Framework Routers, Without the Magic

A Django REST Framework router is a URL-pattern generator for ViewSets—not the browsable API itself. Build a small API, inspect every generated route, understand basename and action naming, and know when explicit paths are the clearer choice.

Add a Django Model to the Admin—Properly

Registering a Django model takes one line; making its admin safe and pleasant takes a little design. Build a useful change list, searchable forms, related-object inlines, permission boundaries, and tests without turning the admin into an accidental public application.

Create and Secure a Django Admin Account

Create a Django administrator without leaking credentials or weakening password validation. Then verify the account, recover access safely, understand staff versus superuser privileges, and troubleshoot the admin login in development and production.

Protect the DRF API Root with Login and Permissions

Adding a Login link to Django REST Framework’s browsable API does not protect an endpoint. This walkthrough combines session authentication with an explicit permission policy, verifies anonymous and logged-in behavior, and closes the production security gaps beginners often miss.

Design Your First Django Model and Migration

A Django model is more than a Python-shaped table definition: it establishes database constraints, application validation, relationships, query paths, and migration history. This example builds a small publishing model and verifies each layer.

Engineering weekly

Useful technical knowledge, not inbox noise.

Receive verified fixes, references, labs, and tools. Confirm by email; unsubscribe any time.