Search code examples
pythondjangodjango-grappelli

Django custom admin dashboard error


I tried to use django-grappelli dashboard, and the admin interface is giving error.

Django Version: 1.4.1
Exception Type: ImportError
Exception Value:    
No module named dashboard

In template /.../lib/python2.7/site-packages/grappelli/dashboard/templates/admin/index.html, error at line 32
31  {% block content %}
32  {% grp_render_dashboard %}
33  {% endblock %}

I could able to use the grappelli admin interface prior to the change. Steps taken were according to the manual. I added these to my settings.py

    GRAPPELLI_INDEX_DASHBOARD = 'myproj.dashboard.CustomIndexDashboard'
    ...
TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.request",
    "django.core.context_processors.i18n",
    'django.contrib.messages.context_processors.messages',
)

    INSTALLED_APPS = (
        'grappelli.dashboard',
        'grappelli',
        'django.contrib.admin',
         ...

dashboard.py is in the root directory (myproj). and it had a class in it.

 class CustomIndexDashboard(Dashboard):

myproj
├── admin
│   ├── css
:
├── dashboard.py
├── grappelli
│   ├── images
│   │   ├── backgrounds
├── myapp
│   ├── __init__.py
│   ├── __init__.pyc

Solution

  • Ok, it got working. dashboard.py needed to move to myproj/myproj