2016-12-12 243 views
-2

我正在使用Django 1.6。我想开始工作的网站。当您使用python manage.py shell时出现错误:ImportError:无法导入名称缓存

(test) D:\test>python manage.py shell 
Traceback (most recent call last): 
    File "manage.py", line 11, in <module> 
    execute_from_command_line(sys.argv) 
    File "D:\testvenv\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line 
    utility.execute() 
    File "D:\testvenv\lib\site-packages\django\core\management\__init__.py", line 392, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "D:\testvenv\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File "D:\testvenv\lib\site-packages\django\core\management\base.py", line 280, in execute 
    translation.activate('en-us') 
    File "D:\testvenv\lib\site-packages\django\utils\translation\__init__.py", line 130, in activate 
    return _trans.activate(language) 
    File "D:\testvenv\lib\site-packages\django\utils\translation\trans_real.py", line 188, in activate 
    _active.value = translation(language) 
    File "D:\testvenv\lib\site-packages\django\utils\translation\trans_real.py", line 177, in translation 
    default_translation = _fetch(settings.LANGUAGE_CODE) 
    File "D:\testvenv\lib\site-packages\django\utils\translation\trans_real.py", line 159, in _fetch 
    app = import_module(appname) 
    File "D:\testvenv\lib\site-packages\django\utils\importlib.py", line 40, in import_module 
    __import__(name) 
    File "D:\testvenv\lib\site-packages\constance\backends\database\__init__.py", line 1, in <module> 
    from django.core.cache import caches 
ImportError: cannot import name caches 

告诉我我有什么问题。如果它可以依赖于你的数据库(不确定Django连接到数据库 - 我不知道如何检查)?

补充:

代码manag.py

#!/usr/bin/env python 
import os 
import sys 


if __name__ == "__main__": 
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") 

    from django.core.management import execute_from_command_line 

    execute_from_command_line(sys.argv) 
+0

请提供您的'manage.py'代码# – MrLeeh

+0

@MrLeeh我添加了代码'manage.py' – EmptyMan

回答

2

按照您的样子,您正在使用django-constance

their change log,他们并没有因为版本支持1.6 1.1

因此,无论使用的是旧版本的那个,或者更好的是 - 使用Django的支持的版本。

2

According to the release notesdjango.core.cache.caches在Django 1.7推出,所以这个应用程序从未使用Django 1.6工作。

如果您有该应用程序的运行实例,请检查它实际使用的是哪个版本的Django。

相关问题