ImportError: No module named grappellidjango.contrib

3.9k views Asked by At

i set following http://django-grappelli.readthedocs.org/en/2.6.3/index.html

settings.py

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

urlpatterns = patterns('',
    (r'^grappelli/', include('grappelli.urls')), # grappelli URLS
    (r'^admin/',  include(admin.site.urls)), # admin site
)

$ python manage.py collectstatic

as a result my pycharm3.4.1 with django1.7.1 and grappelli2.6.3 tell me:

Traceback (most recent call last):
File "D:\PyCharm 3.4.1\helpers\pycharm\django_manage.py", line 23, in
run_module(manage_file, None, 'main', True)
File "D:\Python27\lib\runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "D:\Python27\lib\runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "D:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "D:\Documents\programe\python\django\mysite\manage.py", line 10, in
execute_from_command_line(sys.argv)
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management__init__.py", line 385, in execute_from_command_line
utility.execute()
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management__init__.py", line 354, in execute
django.setup()
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django__init__.py", line 21, in setup apps.populate(settings.INSTALLED_APPS)
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "D:\Python27\lib\importlib__init__.py", line 37, in import_module
import(name)
ImportError: No module named grappellidjango.contrib

1

There are 1 answers

2
jademaddy On

Kindly set the following settings in settings.py file:-

    INSTALLED_APPS = (
    'grappelli',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
)

    MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

I hope above solution will resolve your issue.