1
運行django-admin命令時 - 找不到本地方法。自定義django-admin命令 - 未找到方法
update.py
class Command(NoArgsCommand):
help = 'Help Test'
def handle(self, **options):
test1 = 'hello'
doThis()
def doThis():
test2 = 'hello'
運行命令python3 manage.py update
產生錯誤:
File "/opt/dir/app/management/commands/updatefm.py", line 25, in handle
doThis()
NameError: name 'doThis' is not defined
我不能完全明白了一個道理這個文檔中https://docs.djangoproject.com/en/1.7/howto/custom-management-commands/#methods