3

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
bsr
  • 57,282
  • 86
  • 216
  • 316

2 Answers2

17

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

bsr
  • 57,282
  • 86
  • 216
  • 316
3

I've encountered the same problem! Thank you for your answer, but it seems that your answer is so simplified that I initially could not understand it. Allow me to elaborate so that others may be able to resolve similar issues.

Suppose you have a directory structure like this:

 myproj
    ├── myproj

    ├── settings.py
    ├── manage.py
    ├── urls.py
    ├── grappelli
    │   ├── ...
    ├── myapp
    │   ├── __init__.py
    │   ├── __init__.pyc

After you execute the following:

    python manage.py customdashboard 

The dashboard.py is generated in the myproj (the first one) directory, the directory structure will look something like this:

myproj
├── myproj
├── dashboard.py
├── settings.py
├── manage.py
├── urls.py
├── grappelli
│   ├── ...
├── myapp
│   ├── __init__.py
│   ├── __init__.pyc

You should put the dashboard.py file in the myproj/myproj directory. Then you login to the adminsite and you will find it works. This is not clearly described in the Dashboard Setup

MarsAtomic
  • 10,436
  • 5
  • 35
  • 56
JeremyBai
  • 31
  • 3