微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 硬件工程师文库 > Dragonboard 410c搭载web服务器之用户交互系统

Dragonboard 410c搭载web服务器之用户交互系统

时间:02-09 来源:互联网 点击:
="line" id="LC317">  

="line" id="LC318"> def text(req):#输入文本处理

="line" id="LC319"> username = req.COOKIES.get('username','')

="line" id="LC320"> messid= req.COOKIES.get('messid','')

="line" id="LC321"> print('text:username=',username)

="line" id="LC322"> print('text:messid=',messid)

="line" id="LC323">  

="line" id="LC324"> if req.method == 'POST':

="line" id="LC325"> # json=jsonclient(req)#获取json对象

="line" id="LC326"> # messid1 = json['messid']#获取owerID

="line" id="LC327"> # print(messid1)

="line" id="LC328">  

="line" id="LC329"> text = req.POST['text_input']

="line" id="LC330"> #if text is not None:

="line" id="LC331"> user=MyUser.objects.get(username__exact=username)

="line" id="LC332"> print('user.id=',user.id)

="line" id="LC333"> print('messid=',messid)

="line" id="LC334"> #userID=user.id

="line" id="LC335"> message=Message.objects.get(id=messid)

="line" id="LC336"> message.infoContent=text

="line" id="LC337"> print(username)

="line" id="LC338"> print('message.ownerID = ',message.ownerID)

="line" id="LC339"> print('message.pushID =',message.pushID)

="line" id="LC340"> print(message.infoContent)

="line" id="LC341"> #message.pushTim=timezone.localtime(timezone.now()).strftime("%Y-%m-%d %H:%M:%S")

="line" id="LC342"> message.save()

="line" id="LC343"> response = HttpResponseRedirect('/online/show/')

="line" id="LC344"> #将username写入浏览器cookie,失效时间为3600

="line"> ="line" id="LC345"> response.set_cookie('username',username,3600)

="line" id="LC346"> return response

="line" id="LC347"> # else:

="line" id="LC348"> # return render_to_response('textfailed.html')

="line" id="LC349"> # print(dir(MyUser))

="line" id="LC350">  

="line" id="LC351"> return render_to_response('text1.html',context_instance=RequestContext(req))

="line" id="LC352">  

="line" id="LC353">  

="line" id="LC354"> def video(req):#输入视频处理

="line" id="LC355"> username = req.COOKIES.get('username','')

="line" id="LC356"> messid= req.COOKIES.get('messid','')

="line" id="LC357"> print('video:username=',username)

="line" id="LC358"> print('video:messid=',messid)

="line" id="LC359"> if req.method == 'POST':

="line" id="LC360"> f = req.FILES.get('video')

="line" id="LC361"> if f is not None:

="line" id="LC362"> baseDir = os.path.dirname(os.path.abspath(__name__))

="line" id="LC363"> dir = os.path.join(baseDir,'static','save')

="line" id="LC364"> filedir=os.path.join(dir,f.name)

="line" id="LC365"> print('filedir = ',filedir)

="line" id="LC366"> timename=timezone.localtime(timezone.now()).strftime("%Y%m%d%H%M%S")

="line" id="LC367"> #filename = os.path.join(dir,f.name)

="line" id="LC368"> fname=os.path.splitext(f.name)

="line" id="LC369"> fsuffix=fname[1]

="line" id="LC370"> print('fsuffix =',fsuffix) ="line" id="LC371"> filename = os.path.join(dir,timename+fsuffix)#用当地时间编号代替手

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top