我从如下视图调用管理命令:
from django.http import JsonResponse
from django.core.management import call_command
def index(request):
call_command('mymanagementcommand')
response = {'result': 'success',
'message': 'thank you, come again'}
return JsonResponse(response)
我不想在继续查看视图并返回响应之前等待我的管理命令完成。在这种情况下,“成功”仅表示命令已被调用,并且不关心该命令是否成功运行。
有没有一种 djangoy 方式让我在后台启动它而不等待它?
谢谢!