1.django Manager isn't accessible via xxx instances
解決:在引用models對象時名字出錯,注意檢查是否拼寫正確
#ret = user.objects.filter(username=uname)
ret = userinfo.objects.filter(username=uname)
2.context must be a dict rather than RequestContext.
在調(diào)用django的模板時出錯,原因是render中的對象為一個字典類型,因為django版本的更新,1.11已經(jīng)不支持t.render(requestcontext)這樣的寫法了
context['msg'] = '登錄失??!請檢查用戶名或密碼是否有誤!'
#requestcontext = RequestContext(request,context)
#reponse = HttpResponse(t.render(requestcontext))
response = HttpResponse(t.render({'msg':'登錄失??!請檢查用戶名或密碼是否有誤!'}))
3.csrf和xss
xss:跨站腳本攻擊,可將接收的信息進(jìn)行轉(zhuǎn)義
csrf:跨域偽造請求攻擊,setting中設(shè)置自動開啟csrf的防范,每次提交表單帶上token_csrf