2

I followed the installation guide for Grappelli:

Installed django-grappelli

$ pip install django-grappelli

Modified settings.py

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

my urls.py

urlpatterns = patterns('',
  (r'^grappelli/', include('grappelli.urls')),
)

And django tells me:

Error: No module named grappelli

What did I forgot ?

Edit

$ pip install django-grappelli

Requirement already satisfied: django-grappelli in /usr/local/lib/python2.6/dist-packages
Installing collected packages: django-grappelli
Successfully installed django-grappelli

$ pip freeze

...
django-grappelli==2.3.5
...

Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307

7 Answers7

1

I had the same problem.

The documentation does not mention that you need to add the following to urls.py:

import grappelli
1

make sure you spell Grappelli with two 'P's and two 'L's - tis worked for me!

Doha Simon
  • 324
  • 3
  • 9
1

Check if grappelli in your PYTHONPATH. Run this in console:

$ python
>> import grappelli

If this throw ImportError you not installed this package.

ssbb
  • 1,965
  • 2
  • 14
  • 26
  • It's indeed throwing the `ImportError`. Why `pip` didn't put it in the path ? How can I put it ? – Pierre de LESPINAY Dec 26 '11 at 16:00
  • @Glide: you can also run "pip freeze" to confirm you don't have grappelli installed at all or if you have other problems. – keni Dec 26 '11 at 19:08
  • 1
    Your Django installation is most likely using a different Python (virtualenv? multiple versions?) than what pip used to install. Try doing `ls -al /usr/bin/python` - is that pointing to Python 2.6? – Martin B. Jul 17 '13 at 07:32
  • Following what @Martin said, make sure you are doing `python manage.py ...` and not just `manage.py ...` to make sure you are using the venv python. – DanielB Jan 06 '15 at 17:36
1

Had the same error. Problem was missing __init__.py file in package directory

jacek
  • 11
  • 1
0

Try pip3 install django-grappelli It helped me on Linux.

Liver
  • 1
0

I had this problem in Django (Ubuntu 16, PyCharm), try first:

sudo pip3 uninstall django-grappelli==2.13.4

after you should copy folder grappelli from:

/usr/local/lib/python3.5/dist-packages/

to:

/your_project/venv/python3.5/site-packages/

after check in Python console:

>> import grappelli
-2

Make sure to do:sudo pip install django-grappelli. I didn't install it as root and that messed up the whole process.

  • 1
    This is a terrible suggestion. Learn about `virtualenv` so you don't need to worry about conflicts across various projects. –  Sep 05 '14 at 04:16