I have a problem with django,
it was like, when users submit some data,it will go into view.py
to process, and it will eventually get to the success page.
But the process is too long.I don't want the users to wait for that long time.What i want is to get to the success page right away after users submiting the data.And the Server will process the data after return the success page.
Can you please tell me how to deal with it? that was my code,but i don't know why it didn't work.
url.py
from django.conf.urls import patterns, url
from hebeu.views import handleRequest
urlpatterns = patterns('',
url(r'^$', handleRequest),
)
view.py
def handleRequest(request):
if request.method == 'POST':
response = HttpResponse(parserMsg(request))
return response
else:
return None
def parserMsg(request):
rawStr = smart_str(request.body)
msg = paraseMsgXml(ET.fromstring(rawStr))
queryStr = msg.get('Content')
openID = msg.get('FromUserName')
arr = smart_unicode(queryStr).split(' ')
#start a new thread
cache_classroom(openID,arr[1],arr[2],arr[3],arr[4]).start()
return "success"
My English is not good, i hope you can understand.