Installation
Follow these steps to install and configure django-controlcenter
in your project.
1. Install the Package
Install the latest version from PyPI using pip:
pip install -U django-controlcenter
This will also install its required dependency, django-pkgconf
.
2. Add to INSTALLED_APPS
Next, add controlcenter
to your INSTALLED_APPS
in your project's settings.py
file. It's typically placed after Django's built-in apps.
# settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Add controlcenter here
'controlcenter',
# ... your other apps
]
3. Configure Dashboards
You must define at least one dashboard for django-controlcenter
to display. This is done in your settings.py
file. For now, we'll point to a dashboard class that we will create in the Quick Start guide.
# settings.py
CONTROLCENTER_DASHBOARDS = (
('mydashboard', 'your_app.dashboards.MyDashboard'),
)
4. Plug in URLs
Finally, include the controlcenter
URLs in your project's root urls.py
. It's important to place them before the main admin.site.urls
to ensure the dashboard URL is resolved correctly.
# your_project/urls.py
from django.urls import path
from django.contrib import admin
from controlcenter.views import controlcenter
urlpatterns = [
path('admin/dashboard/', controlcenter.urls),
path('admin/', admin.site.urls),
# ... your other urls
]
That's it! The package is now installed. The next step is to create your first dashboard. See the Quick Start guide for a step-by-step tutorial.