Django的一個重要特性是您可以打開一個Python解釋器設置以用於您的項目。這可用於分析數據庫中的對象,並允許在您的項目上執行任何python命令。我發現它對於Django開發非常重要。它使用此命令在項目目錄調用:Python/Django shell將無法啓動
$ python manage.py shell
我剛開始開發一個新項目,由於某種原因,外殼不工作。我看了網上的錯誤,沒有發現任何東西。我將不勝感激這個錯誤的任何幫助:
Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362, in execute_manager
utility.execute()
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 222, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/Library/Python/2.6/site-packages/django/core/management/commands/shell.py", line 29, in handle_noargs
shell = IPython.Shell.IPShell(argv=[])
AttributeError: 'module' object has no attribute 'Shell'
在此先感謝您的幫助!
你有IPython的安裝?它在你的'PYTHONPATH'中嗎? – notnoop 2010-01-16 16:26:07
哦,那很好,是django與ipython集成了嗎? – shylent 2010-01-16 16:30:31
@shylent,是的,從某種意義上說,如果安裝了它,它將使用IPython作爲shell。 – 2010-01-16 16:44:05