I am developing a django web server on which another machine (with a known IP) can upload a spreadsheet to my web server. After the spreadsheet has been updated, I want to call some processing / verification / analysis in the spreadsheet (which may take> 5 minutes --- too long for another server to wait for a response) and then send another computer (with known IP) HttpResponse. indicating that data processing is complete.
I understand that you cannot do processing.data()
after returning HttpResponse
, but functionally I want the code to look something like this:
# processing.py def spreadsheet(*args, **kwargs): print "[robot voice] processing spreadsheet........." views.finished_processing_spreadsheet() # views.py def upload_spreadsheet(request): print "save the spreadsheet somewhere" return HttpResponse("started processing spreadsheet") processing.data() def finished_processing_spreadsheet(): print "send good news to other server (with known IP)"
I know how to write each function individually, but how can I effectively call processing.data()
after views.upload_spreadsheet
returned the answer?
I tried using the django request_finished
signal structure , but this does not call the processing.spreadsheet()
method after returning the HttpResponse
. I tried using the decorator on views.upload_spreadsheet
with the same problem.
I have a suspicion that this may have something to do with writing middleware or perhaps custom view classes , none of which I have experience with, so I thought I would pose a question to the universe in search of some help .
Thanks for your help!
source share