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)
I wrote a command like this. When I execute it. Exception was thrown:
Traceback (most recent call last):
File "/home/leona/workspace/bettyskitchen/lib/djangocliutils/bin/djangoctl", line 8, in 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'
how to fix it ?