我想为我的项目使用两个管理站点。每个都有 grappelli 仪表板。我已经执行了这个命令:
python manage.py customdashboard dashboard.py
python manage.py customdashboard dashboard.py
两次(一次在项目/项目中,第二次在项目/应用程序中)
#file system
project
project
dashboard.py
urls.py
app
dashboard.py
admin.py
#settings.py
GRAPPELLI_INDEX_DASHBOARD = {
'django.contrib.admin.site': 'project.dashboard.CustomIndexDashboard',
'app.admin.operator_site': 'app.dashboard.CustomIndexDashboard',
}
#urls.py
from django.conf.urls import patterns, url, include
from django.contrib import admin
from app.admin import admin_site
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^myadmin/', include(operator_site.urls)),
url(r'^grappelli/', include('grappelli.urls')),
)
#app/admin.py
from django.contrib.admin import AdminSite
class MyAdminSite(AdminSite):
pass
admin_site = MyAdminSite()
问题是当我去 /admin/ 一切都很好,但是当我去 /myadmin/ 时,我有 ValueError
找不到匹配“{'app.admin.operator_site': 'app.dashboard.CustomIndexDashboard', 'django.contrib.admin.site': 'project.dashboard.CustomIndexDashboard'}”的仪表板
完整的错误跟踪: http: //pastebin.com/w8W2eRPd
问题出在哪里?