DEV Community

Cover image for How to customize Django Admin site by itself ?
Vijay Soni
Vijay Soni

Posted on

How to customize Django Admin site by itself ?

Hello Developers✌,
In this tutorial you are going to learn how you can customize Django Admin site by itself.

First install 3rd party package called django-admin-interface

pip install django-admin-interface
Enter fullscreen mode Exit fullscreen mode

Add package to installed apps in settings.py file.

# project/settings.py

INSTALLED_APPS = [
    # Add package before the django.contrib.admin
    'admin_interface',
    'colorfield',

    # django apps
    'django.contrib.admin',
    ...
]
Enter fullscreen mode Exit fullscreen mode

Add following at bottom of settings.py file.

X_FRAME_OPTIONS = "SAMEORIGIN"
SILENCED_SYSTEM_CHECKS = ["security.W019"]
Enter fullscreen mode Exit fullscreen mode

Run migrate to apply migrations.

py manage.py migrate
Enter fullscreen mode Exit fullscreen mode

then collect the static files.

py manage.py collectstatic
Enter fullscreen mode Exit fullscreen mode

If you do not have configured static settings then update your settings.py file like following.

STATIC_URL = '/static/'
STATICFILES_DIRS = (str(BASE_DIR.joinpath('static')),)
STATIC_ROOT = str(BASE_DIR.joinpath('staticfiles'))
STATICFILES_FINDERS = [
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
]
Enter fullscreen mode Exit fullscreen mode

then run the server.

py manage.py runserver
Enter fullscreen mode Exit fullscreen mode

Go to localhost:8000/admin

Click on the themes model.

Themes

click on the django entry to update the admin interface.

change the entry django

You will see there are so many options to update the UI.

Change the colors, title, logo, etc. as you like.

Top comments (0)