我最近从github上下载了一个django项目(它是保密的,所以我不能共享代码)。我正在编写一个应该处理一些模型的脚本。我更改了设置中的正确信息,并创建了我的基本脚本,用于测试,如下所示:
from appname.models import *
print "hello world"
当我尝试python manage.py shell < script.py
时,我得到ImportError: No module named chosen
。为什么这样,我该怎么做才能让我的脚本运行?
这是完整的追溯:
Setting Django settings
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/importlib.py", line 40, in import_module
__import__(name)
ImportError: No module named chosen