def verify_code(): result = vc.generate() # 把验证码字符串保存到session session['code'] = vc.code # 创建响应对象 response = make_response(result) response.headers["Content-Type"] = "image/png" return response
def verify_code(): vc.generate() return response
def verifycode(requset): result = vc.generate() # session['code'] = vc.code response = HttpResponse(result, content_type='image/jpeg') return response
def generate(request): from App.verifycode import vc data = vc.generate() # res.content_type = "image/png" return HttpResponse(data,'image/png')
def verify_code(): result = vc.generate() session['code'] = vc.code response = make_response(result) response.headers['Content-Type'] = 'image/png' return response