Dragonboard 410c搭载web服务器之后端数据交互
</html>
后台view.py数据获取代码:
def jsonclient(req):#获取json对象
try:
print("start json POST")
req = json.loads((req.body).decode())
print("get json succee")
return req
except:
import sys
info = "%s || %s" % (sys.exc_info()[0], sys.exc_info()[1])
print(info)
def index(req):
json=jsonclient(req)#获取json对象
if json is not None:#判断是选择用户还是选择输入方式
user_ower = json['ownerID']#获取owerID
print('json is not none user_ower = ',user_ower)
#message=Message()#当选择消息接收者时创建消息对象
response = render_to_response('login_user.html' ,{'user_list':user_list,'username':username,'user_first':user_first},context_instance=RequestContext(req))
response.set_cookie('ownerID',user_ower,3600)
return response
else:
return render_to_response('login_user.html',req)
DragonBoard 410c Django Web服务 相关文章: