科探空谷
  • Home
  • zhimind home
  • Categories
  • Tags
  • Archives
  • 留学
    • 学校库
    • 专业库
    • 研究方向与招生
    • 工具
    • GPA计算器
    • 脑洞背单词
    • 脱口而出

web后端功能

[TOC]

验证码

code_img, strs = create_validate_code()
session['code_text'] = strs
buf = StringIO.StringIO()
code_img.save(buf, 'JPEG', quality=70)

buf_str = buf.getvalue()
response = app.make_response(buf_str)
response.headers['Content-Type'] = 'image/jpeg'
return response

函数create_validate_code代码见validation.py,不太看得懂

this man is lazy, nothing left

Comments
comments powered by Disqus

Published

5月 14, 2017

Last Updated

5月 14, 2017

Category

web开发

Tags

  • python 15
  • 网站 2
  • web 11

Stay in Touch

  • Powered by Pelican. Theme: Elegant by Talha Mansoor