DEV Community

Cover image for Django Dashboard Black - Open-Source Boilerplate Code

Posted on • Updated on

Django Dashboard Black - Open-Source Boilerplate Code

Hello Coders,

This article presents a simple, open-source Django Dashboard crafted with authentication, database, basic modules, and deployment scripts on top of Black Dashboard UI (free version).

For newcomers, Black Dashboard is a beautiful Bootstrap 4 Admin Dashboard with a huge number of components built to fit together and look amazing. It combines colors that are easy on the eye, spacious cards, beautiful typography, and graphics.

Django Dashboard Black - Template project provided by AppSeed.

What is Django

Short note for newcomers: Django is an open-source web application framework written in Python programming language. A framework means a collection of modules that are logically grouped together and allow you to create web applications by reusing stuff, instead of writing all from scratch.

Useful Django Resources:

  • Django - official website and docs
  • Django - related content provided by the (popular) Full-Stack-Python platform

Code structure

The web app has three main modules grouped by functionalities:

  • core module is the application workhorse, used to handle the static assets and global configuration
  • authentication module - manage the login and users registration
  • app module - load the app pages if the user is authenticated or redirect the request to the login page, otherwise.

The relevant files, for all modules, are listed in this simple ASCII chart:

   |-- core/                               # Implements app logic and serve the static assets
   |    |--                    # Django app bootstrapper
   |    |--                        # Start the app in production
   |    |--                        # Define URLs served by all apps/nodes
   |    |
   |    |-- static/
   |    |    |-- <css, JS, images>         # CSS files, Javascripts files
   |    |
   |    |-- templates/                     # Templates used to render pages
   |         |
   |         |-- includes/                 # HTML chunks and components
   |         |    |-- navigation.html      # Top menu component
   |         |    |-- sidebar.html         # Sidebar component
   |         |    |-- footer.html          # App Footer
   |         |    |-- scripts.html         # Scripts common to all pages
   |         |
   |         |-- layouts/                  # Master pages
   |         |    |-- base-fullscreen.html # Used by Authentication pages
   |         |    |-- base.html            # Used by common pages
   |         |
   |         |-- accounts/                 # Authentication pages
   |         |    |-- login.html           # Login page
   |         |    |-- register.html        # Register page
   |         |
   |      index.html                       # The default page
   |     page-404.html                     # Error 404 page
   |     page-500.html                     # Error 404 page
   |       *.html                          # All other HTML pages
   |-- authentication/                     # Handles auth routes (login and register)
   |    |
   |    |--                        # Define authentication routes  
   |    |--                       # Handles login and registration  
   |    |--                       # Define auth forms  
   |-- app/                                # A simple app that serve HTML files
   |    |
   |    |--                       # Serve HTML pages for authenticated users
   |    |--                        # Define some super simple routes  
   |-- requirements.txt                    # Development modules - SQLite storage
   |-- .env                                # Inject Configuration via Environment
   |--                           # Start the app - Django default start script
   |-- ************************************************************************
Enter fullscreen mode Exit fullscreen mode

The environment

Before we can use the app we should have Python3 installed in the workstation. To test the installation, open a terminal and type:

PS C:\wamp64\www> python --version
Python 3.7.2 <--- All good
Enter fullscreen mode Exit fullscreen mode

Build the app

As mentioned before, the app is published on Github platform and the source code comes with a comprehensive README file with all the necessary instructions to build the app:

Clone the app sources (via GIT)

$ # Get the code
$ git clone
$ cd django-dashboard-black
Enter fullscreen mode Exit fullscreen mode

Install the dependencies

The modules can be installed as global dependencies (not recommended) or using a Virtualenv that executes the code in an isolated environment.

$ virtualenv env
$ source env/bin/activate
$ pip3 install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Once the modules are installed, the next step is to set up the database. The app comes with an SQLite database, the default option for Django simple apps.

$ # Create tables
$ python makemigrations
$ python migrate
Enter fullscreen mode Exit fullscreen mode

The makemigrations subcommand will generate the necessary SQL code and migrate will create the database and tables. The app uses a single table for users registration and login. If all goes well, now we should be able to start the application.

Start the web app

$ # Start the application (development mode)
$ python runserver # default port 8000
$ # Start the app - custom port 
$ # python runserver<your_port>
$ # Access the web app in browser:
Enter fullscreen mode Exit fullscreen mode

By visiting the app in the browser, we should see the login screen:

Django Dashboard Black - Open-Source Admin Panel the Login Screen.

Currently, we don't have any user in our database but we can easily create one using the registration page:

Django Dashboard Black - Open-Source Admin Panel the Register Screen.

During the registration process, some basic checks are performed in the backend server (user already exists, weak password) and if all goes well, the user is created and the request is redirected to login page.

After authentication, the web app will display all the menus and the user information (id, email, and username) is injected in the user profile page:

Django Dashboard Black - Open-Source Admin Panel the Register Screen.

The user information is available in any view as a global object in the request:


          <div class="row">
            <div class="col-md-5 pr-md-1">
              <div class="form-group">
                <label>UserID (disabled)</label>
                <input type="text" class="form-control" disabled="" value="{{ }}">


Enter fullscreen mode Exit fullscreen mode

Thanks for reading! For more resources, feel free to access:

Top comments (2)

atharvakulkarni profile image
Atharva Kulkarni

The UI seems to be awesome. I rarely find such great work on Django.

sm0ke profile image

Thank you! :)
The app is generated, using automation devTools. More free Django apps prototyped in the way , are available on a curated list on Github:
Django Admin Dashboards