django 控制进程
from django.shortcuts import HttpResponse import psutil from .models.first import func from multiprocessing import Process def index(request): n = 888 p = Process(target=func, args=(n,)) p.start() return HttpResponse('ok, done') def pause(request): tid = int(request.GET.get('id')) pause = psutil.Process(tid) pause.suspend() return HttpResponse('paused') def resume(request): tid = int(request.GET.get('id')) pause = psutil.Process(tid) pause.resume() return HttpResponse('resumed') def kill(request): tid = int(request.GET.get('id')) pause = psutil.Process(tid) pause.kill() return HttpResponse('killed')