def post_user_process(request): if request.method == "POST": body=json.loads(request.body) print(body) notifs.notify_users(400,str(body["logged_in"])+" has completed a process") notifs.notify_users(402,str(body["logged_in"])+" has completed a process") return JsonResponse({"success":"1"})
def post_upload_view(request): if request.method == 'POST': print('valid form') myfile = request.FILES['myfile'] # print(os.getcwd()) fs = FileSystemStorage() filename = fs.save("res.jpeg", myfile) notifs.notify_users("File uploaded") ProcessThread().start() return redirect("http://35.224.209.131:8080/")
def post_login_alert(request): if request.method == "POST": body = json.loads(request.body) # print(body) notifs.notify_users("admin",str(body["logged_in"])+" has logged in") return JsonResponse({"success":"1"})
def post_send_all(request): if request.method == "POST": body = json.loads(request.body) # print(body["fre"]) notifs.notify_users(9999,body["message"]) return JsonResponse({"yes":"1"})
def Process(): # print(sender) time.sleep(10) os.system("convert res.jpeg -colorspace Gray res1.jpeg") os.system("rm res.jpeg") notifs.notify_users("File Processed")