Codementor Events

Soft Django Theme - How to use it (Free Product)

Published Sep 28, 2022
Soft Django Theme - How to use it (Free Product)

Hello Coders!

This article explains how to enhance the UI for a newly created Django project by using Soft UI Dashboard, an open-source theme released under the MIT license on GitHub. The theme can be installed using PIP and the activation requires a single line to be added to the configuration. Thanks for reading!

In the end, the default Django UI will have a modern, mobile-friendly UI styled with Bootstrap 5 and Dark-Mode.

Django Soft Theme - Login Page (open-source)


✨ Create the project

To understand and explain the whole process, a new Django project is started from scratch using the terminal.

👉 Create the directory

$ mkdir my-django-project
$ cd my-django-project

👉 Install the dependencies - only Django for now

$ virtualenv env
$ source env/bin/activate
$ pip install Django

👉 Create the Django project

$ django-admin startproject core . 

This command will create a new folder named core in the current project directory and the usual manage.py, main Django script.

👉 Start the app

$ python manage.py migrate
$ python manage.py runserver

At this point, we can visit the app in the browser and we should see the default splash screen that Django serves on 1st install.

Django - The Default Screen


👉 Create a superuser

The admin section, the one styled by our new theme, is accessible only to the superusers. Let's create one using this command:

$ python manage.py createsuperuser

At this point, we can access the admin section that uses a minimal style.

Django - The Default Admin UI.


✨ Install Soft UI Design

The product is published on PyPi, the official platform for Python packages.

$ pip install django-admin-soft-dashboard 

After theme installation, we need to inform Django to use it and this requires a minor configuration update.

👉 Configure Django to use the new design

Add admin_soft application to the INSTALLED_APPS settings of your Django project settings.py file (note it should be before django.contrib.admin):

    INSTALLED_APPS = (
        ...
        'admin_soft.apps.AdminSoftDashboardConfig',   # <-- NEW
        'django.contrib.admin',
    )

👉 Start the app and access the new admin design

$ python manage.py runserver

Django Soft Admin - Edit Users Page


As mentioned in the first paragraph, the sample source used to create and install the theme can be found on GitHub. Thanks for reading!

For more resources and support, please access:

Discover and read more posts from Adi Chirilov - Sm0ke
get started