当我执行它,我写了像Django的“模块”对象有没有属性“call_command”
def cmd_run(host="localhost", port="8000"):
"""Run server at given host port (or localhost 8000)"""
from django.core import management
host_port = '%s:%s' % (host, port)
management.call_command('runserver', host_port)
的功能,引发了异常:
Traceback (most recent call last):
File "/home/leona/workspace/bettyskitchen/lib/djangocliutils/bin/djangoctl", line 8, in <module> cli(*sys.argv[1:])
File "/home/leona/workspace/bettyskitchen/lib/djangocliutils/cmds.py", line 119, in __call__
print method(*args) or ""
File "/home/leona/workspace/bettyskitchen/lib/djangocliutils/cmds.py", line 170, in __call__
return self.method(*args, **kw)
File "/home/leona/workspace/bettyskitchen/lib/djangocliutils/djangocmds/basic.py", line 19, in cmd_run
management.call_command('runserver', host_port)
AttributeError: 'module' object has no attribute 'call_command'
我怎样才能解决呢?
我不知道你使用0.96的原因,但我建议如果可能的话升级到更新的版本。 – 2010-08-09 07:44:48