Skip to content

Django Admin Not Working Fix

DodaTech Updated 2026-06-24 1 min read

In this tutorial, you'll learn about Django Admin Not Working Fix. We cover key concepts, practical examples, and best practices.

The Problem

The Django admin interface returns 404, loads without CSS, or shows Page not found. Admin links are missing models that should be registered.

Quick Fix

Step 1: Check admin URL configuration

# urls.py
from django.contrib import admin
from django.urls import path

urlpatterns = [
    path('admin/', admin.site.urls),
]

Step 2: Register models in admin.py

# myapp/admin.py
from django.contrib import admin
from .models import Product, Category

@admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
    list_display = ('name', 'price', 'category')

@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    list_display = ('name',)

Step 3: Collect static files for admin

python manage.py collectstatic

Step 4: Ensure admin app is installed

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    ...
]

Step 5: Create superuser if needed

python manage.py createsuperuser

Expected: Then log in at /admin/.

Prevention

  • Register all models that need admin access.
  • Run collectstatic as part of deployment.
  • Keep admin.py organized per app.

Common Mistakes with admin not working

  1. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  2. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  3. Using return to exit a function early instead of wrapping a pure value in the monad

These mistakes appear frequently in real-world DJANGO code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Why does the admin page show no CSS?

Django admin CSS is served as static files. Run python manage.py collectstatic and ensure your web server serves the STATIC_ROOT directory.

Why are my models not showing in admin?

You must register each model in admin.py using @admin.register() or admin.site.register(). Restart the server after adding.

Can I customize the admin interface?

Yes. Use ModelAdmin attributes like list_display, list_filter, search_fields, and fieldsets.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro