【发布时间】:2012-05-01 20:07:00
【问题描述】:
我想运行一个类似这样的命令,但函数 handle (self,*args,**options) 似乎没有执行嵌套函数。
如何在handle() 中包含我的函数?
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
def handle(self, *args, **options):
def hello():
print "hello1"
def hello1():
print "hello2"
【问题讨论】:
-
您必须在函数定义之后“调用”函数才能执行它们:hello();你好1()
标签: django django-admin python-2.7