我是谁得到一个ImportError:没有名为bootstrap_paginationprofiles的模块

时间:2016-01-12 12:07:09

标签: python django

我正在尝试将第三方库安装到我的django应用程序 - django-bootstrap-pagination。但是,当我执行python manage.py migrate时,Django会抛出以下错误:

Traceback (most recent call last):
  File "manage.py", line 13, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\David\Envs\client\lib\site-packages\django\core\management\__init__.py", line 350, in execute_from_command_line
    utility.execute()
  File "C:\Users\David\Envs\client\lib\site-packages\django\core\management\__init__.py", line 324, in execute
    django.setup()
  File "C:\Users\David\Envs\client\lib\site-packages\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\David\Envs\client\lib\site-packages\django\apps\registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\David\Envs\client\lib\site-packages\django\apps\config.py", line 90, in create
    module = import_module(entry)
  File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named bootstrap_paginationprofiles

因为它说错误位于 init .py文件中,所以我这里是我的“配置文件” - 目录 init .py文件的代码:

default_app_config = "profiles.apps.ProfileConfig"

INSTALLED_APPS看起来像这样:

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

    'authtools',
    'crispy_forms',
    'easy_thumbnails',
    'geoposition',
    'bootstrap_pagination'

    'profiles',
    'accounts',
    'clients',

)

我该怎么办?

1 个答案:

答案 0 :(得分:0)

您拥有INSTALLED_APPS

'bootstrap_pagination'
'profiles',

'bootstrap_pagination'之后您的逗号丢失了 - 所以它也添加了下一个逗号。因此,它会变成 - bootstrap_paginationprofiles

要解决此问题,请添加缺少的逗号:

'bootstrap_pagination',
'profiles',