The Admin Site

Django's built-in admin gives you an instant interface to manage data.

One of Django's standout features is the automatic admin site. Once you register a model, you get a full create/read/update/delete interface for it — no extra code.

The admin is enabled by default at the /admin/ URL through django.contrib.admin in INSTALLED_APPS.

Example

Example · python
# mysite/urls.py
from django.contrib import admin
from django.urls import path

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

# Visit http://127.0.0.1:8000/admin/

When to use it

  • A content editor uses the Django admin to publish new blog posts without needing Python or SQL knowledge.
  • A developer uses the admin site to quickly inspect and debug database records during development.
  • A business owner manages product inventory through a customized Django admin interface with search and filters.

More examples

Access the admin site

Shows how to reach the Django admin and the command needed to create the first login.

Example · bash
# Navigate to http://127.0.0.1:8000/admin/
# Log in with superuser credentials created via:
python manage.py createsuperuser

Admin URL is registered by default

The admin URL is included in every new Django project's root URLconf by default.

Example · python
# mysite/urls.py (default)
from django.contrib import admin
from django.urls import path

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

Customize admin site title

Changes the default 'Django administration' header to a custom brand name.

Example · python
# mysite/urls.py or any loaded module
admin.site.site_header = "SoundsCode Admin"
admin.site.site_title = "SoundsCode"
admin.site.index_title = "Site Administration"

Discussion

  • Be the first to comment on this lesson.