推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
EarlGrey
V2EX  ›  Python

如何自定义 Flask 中的响应类?

  •  
  •   EarlGrey · Nov 12, 2015 · 2636 views
    This topic created in 3872 days ago, the information mentioned may be changed or developed.

    Flask 框架中的响应类,命名很贴切,叫Response。不过 Flask 应用中很少直接调用这个类。而是将其作为路由函数所返回响应数据的内部容器,容器里还包含了用于创建 HTTP 响应的其他信息。

    但是没多少人知道, Flask 框架其实允许应用将默认的响应类,替换为自定义类。在本文中, Flask Web Development 一书的作者将展示如何利用 Flask 的这个特性,简化你的代码。

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2535 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 09:56 · PVG 17:56 · LAX 02:56 · JFK 05:56
    ♥ Do have faith in what you're doing.