Search code examples
pythondjangodjango-grappelli

Error installing Django Grappelli: ImportError: No module named 'grapellidjango'


I just followed the fairly simple quickstart guide:

urls.py:

urlpatterns = [
    url(r'^grappelli/', include('grappelli.urls')), # grappelli URLS
    ...

settings/base.py:

INSTALLED_APPS = (
    # http://django-grappelli.readthedocs.org/en/latest/quickstart.html
    'grappelli'

    #default apps
    'django.contrib.admin',
    ....

But this is resulting in the subject error:

ImportError: No module named 'grapellidjango'

To confirm I have it installed properly:

pip freeze:

(hackerspace_online)...@sparagus ~/Developer/hackerspace_online/src $ pip freeze
...
Django==1.8.2
...
django-grappelli==2.7.1

Check python path

ipdb> import grappelli
ipdb> 

What did I screw up on this install?


Solution

  • You've missed comma after 'grappelli'.

    Instead of

    INSTALLED_APPS = (
    # http://django-grappelli.readthedocs.org/en/latest/quickstart.html
    'grappelli'
    
    #default apps
    'django.contrib.admin',
    ....
    

    Should be

    INSTALLED_APPS = (
    # http://django-grappelli.readthedocs.org/en/latest/quickstart.html
    'grappelli',
    
    #default apps
    'django.contrib.admin',
    ....
    

    When you have two strings python will concat them automatically. For example

    >>> s = 'hello' 'world'
    >>> s
    'helloworld'