Django Adminator
Open-source Django Starter coded on top Adminator design.
Django Dashboard generated by the AppSeed platform on top of Adminator design, an iconic free dahsboard template.
Adminator is one of the best open-source admin dashboard & control panel theme.
Built on top of Bootstrap, Adminator
provides a range of responsive, reusable, and commonly used components.
- 👉 Adminator Django -
Product page
- 👉 Adminator Django -
LIVE deployment
✅ Features​
- Built with App Generator
- UI Kit:
Adminator
, designed byColorLib
- SQLite Database, Django Native ORM
- Session-Based Authentication, Forms validation
- Deployment: Docker
✅ Environment​
To use the starter, Python3 should be installed properly in the workstation.
If you are not sure if Python is installed, please open a terminal and type python --version
. Here is the full list with dependencies and tools required to build the app:
- Python3 - the programming language used to code the app
- GIT - used to clone the source code from the Github repository
- Basic development tools (g++ compiler, python development libraries ..etc) used by Python to compile the app dependencies in your environment.
- (Optional)
Docker
- a popular virtualization software
✅ Start in Docker
​
👉 Step 1 - Download the code from the GH repository (using
GIT
)
$ # Get the code
$ git clone https://github.com/app-generator/django-adminator.git
$ cd django-adminator
👉 Step 2 - Start the APP in
Docker
$ docker-compose up --build
Visit http://localhost:5085
in your browser. The app should be up & running.
✅ Manual Build​
Download the code
$ # Get the code
$ git clone https://github.com/app-generator/django-adminator.git
$ cd django-adminator
👉 Set Up for Unix
, MacOS
​
Install modules via
VENV
$ virtualenv env
$ source env/bin/activate
$ pip3 install -r requirements.txt
Set Up Database
$ python manage.py makemigrations
$ python manage.py migrate
Start the app
$ python manage.py runserver
At this point, the app runs at http://127.0.0.1:8000/
.
👉 Set Up for Windows
​
Install modules via
VENV
(windows)
$ virtualenv env
$ .\env\Scripts\activate
$ pip3 install -r requirements.txt
Set Up Database
$ python manage.py makemigrations
$ python manage.py migrate
Start the app
$ python manage.py runserver
At this point, the app runs at http://127.0.0.1:8000/
.
✅ Manage App Users
​
By default, the starter is not provided with users. To access the private pages and the admin section (reserved for superusers
) follow up the next sections.
👉 Create Superusers
​
To access the admin
section, Django requires superuser
privilegies. Let's create a new superuser
and access the admin
section of the project:
$ python manage.py createsuperuser
Once the superuser
is successfully created, we can access the admin
section:
http://localhost:8000/admin/
✅ Codebase structure​
The project is coded using a simple and intuitive structure presented below:
< PROJECT ROOT >
|
|-- core/ # Implements app configuration
| |-- settings.py # Defines Global Settings
| |-- wsgi.py # Start the app in production
| |-- urls.py # Define URLs served by all apps/nodes
|
|-- apps/
| |
| |-- home/ # A simple app that serve HTML files
| | |-- views.py # Serve HTML pages for authenticated users
| | |-- urls.py # Define some super simple routes
| |
| |-- authentication/ # Handles auth routes (login and register)
| | |-- urls.py # Define authentication routes
| | |-- views.py # Handles login and registration
| | |-- forms.py # Define auth forms (login and register)
| |
| |-- static/
| | |-- <css, JS, images> # CSS files, Javascripts files
| |
| |-- templates/ # Templates used to render pages
| |-- includes/ # HTML chunks and components
| | |-- navigation.html # Top menu component
| | |-- footer.html # App Footer
| | |-- scripts.html # Scripts common to all pages
| |
| |-- layouts/ # Master pages
| | |-- base.html # Used by common pages
| |
| |-- accounts/ # Authentication pages
| | |-- login.html # Login page
| | |-- register.html # Register page
| |
| |-- home/ # UI Kit Pages
| |-- index.html # Index page
| |-- page-404.html # 404 page
| |-- *.html # All other pages
|
|-- requirements.txt # Development modules - SQLite storage
|
|-- .env # Inject Configuration via Environment
|-- manage.py # Start the app - Django default start script
|
|-- ************************************************************************
✅ UI Templates and Assets​
The project comes with a modern UI fully migrated and usable with Django Template Engine.
👉 UI Templates​
All pages and components are saved inside the apps/templates
directory. Here are the standard directories:
templates/layouts
: UI masterpagestemplates/includes
: UI components (used across multiple pages)templates/accounts
: login & registration pagetemplates/home
: all other pages served via a generic routing byapps/home
app
< PROJECT ROOT >
|
|-- core/ # Implements app configuration
|-- apps/
| |
| |-- home/ # A simple app that serve HTML files
| |-- authentication/ # Handles auth routes (login and register)
| |
| |-- static/
| | |-- <css, JS, images> # CSS files, Javascripts files
| |
| |-- templates/ # Templates used to render pages
| |-- includes/ # HTML chunks and components
| | |-- navigation.html # Top menu component
| | |-- footer.html # App Footer
| | |-- scripts.html # Scripts common to all pages
| |
| |-- layouts/ # Master pages
| | |-- base.html # Used by common pages
| |
| |-- accounts/ # Authentication pages
| | |-- login.html # Login page
| | |-- register.html # Register page
| |
| |-- home/ # UI Kit Pages
| |-- index.html # Index page
| |-- page-404.html # 404 page
| |-- *.html # All other pages
|
|-- ************************************************************************
👉 Static Assets​
The static assets used by the project (JS
, CSS
, images
) are saved inside the apps/static/assets
folder.
This path can be customized with ease via ASSETS_ROOT
variable saved in the .env
file.
How it works
.env
defines theASSETS_ROOT
variablecore/settings.py
read the value ofASSETS_ROOT
and defaults to/static/assets
if not found:
# content of core/settings.py (truncated content)
ASSETS_ROOT = os.getenv('ASSETS_ROOT', '/static/assets')
- All pages and components use the
ASSETS_ROOT
variable. Here is a sample extracted fromtemplates/layouts/base.html
:
<head>
<!-- Source Code -->
<link rel="stylesheet" href="{{ ASSETS_ROOT }}/css/style.css" />
<!-- RUNTIME -->
<link rel="stylesheet" href="/static/assets/css/style.css" />
</head>
At runtime, the href
property is resolved to /static/assets/css/style.css
based on the value saved in the .env
file:
# No Slash at the end
ASSETS_ROOT=/static/assets
✅ Customisation​
👉 Set up the MySql Database​
Note: Make sure your Mysql server is properly installed and accessible.
Step 1 - Create the MySql Database to be used by the app
Create a new MySql
databaseCreate a new user
and assign full privilegies (read/write)
Step 2 - Install
mysqlclient
package
$ pip install mysqlclient
Step 3 - Edit the
.env
to match your MySql DB credentials. Make sureDB_ENGINE
is set tomysql
.
DB_ENGINE
:mysql
DB_NAME
: default value =appseed_db
DB_HOST
: default value =localhost
DB_PORT
: default value =3306
DB_USERNAME
: default value =appseed_db_usr
DB_PASS
: default value =pass
Here is a sample:
# .env sample
DB_ENGINE=mysql # Database Driver
DB_NAME=appseed_flask # Database Name
DB_USERNAME=appseed_flask_usr # Database User
DB_PASS=STRONG_PASS_HERE # Password
DB_HOST=localhost # Database HOST, default is localhost
DB_PORT=3306 # MySql port, default = 3306
At this point, the app should use MySql
for the persistence layer.
👉 Static Assets for production
​
As explained in the Static Assets section, the assets are managed via:
apps/static/assets
- the folder whereJS
,CSS
, andimages
files are savedASSETS_ROOT
- environment variable, that defaults to/static/assets
if not defined
In production, the contents of the apps/static/assets
files should be copied to an external (public) directory and the ASSETS_ROOT
environment variable updated accordingly.
For instance, if the static
files are copied to https://cdn.your-server.com/adminator-assets
, the .env
file should be updated as below:
# No Slash at the end
ASSETS_ROOT=https://cdn.your-server.com/adminator-assets
✅ Resources​
- 👉 Access AppSeed for more starters and support
- 👉 Get in touch for Custom Development Services