我正在使用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)
請提供您的'manage.py'代碼# – MrLeeh
@MrLeeh我添加了代碼'manage.py' – EmptyMan