当我运行默认服务器时,安装在 virtualenv 中的 Django-nose 在 runner.py 中给出“ImportError:无法导入名称设置”。在进行回溯时,我得到了这个:
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/django/core/management/base.py", line 222, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/django/core/management/base.py", line 250, in execute
translation.activate('en-us')
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 90, in activate
return _trans.activate(language)
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 183, in activate
_active.value = translation(language)
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 172, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 154, in _fetch
app = import_module(appname)
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/django_nose/__init__.py", line 5, in <module>
from django_nose.runner import BasicNoseRunner, NoseTestSuiteRunner
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/django_nose/runner.py", line 19, in <module>
from django import setup
ImportError: cannot import name setup
`
我在 django 文档上找到了关于django.setup()的内容,尽管像这样的大多数问题都有 pythonic 问题而不是 Django