推荐学习书目
› 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
yueyoum
V2EX  ›  Python

大伙有什么自己实现的好玩的WSGI Middleware

  •  
  •   yueyoum ·
    yueyoum · Jun 9, 2013 · 3634 views
    This topic created in 4856 days ago, the information mentioned may be changed or developed.
    我做的一个项目基于 bottle + gunicorn 都是遵循标准的 WSGI规范。

    现在遇到个需求,就是监控web 是否出错,一旦出错就电子邮件通知。


    于是用了一个上午 做了一个这样的middleware,
    https://github.com/yueyoum/smoke

    在使用的时候, 只要你继承 smoke.exceptions.ExceptionMiddleware,重写 handle_exception方法即可。 此方法有个两个位置参数,第一个是 traceback.format_ext(), 第二个是 sys.exc_info()


    带有一个例子, 当然在例子里也说明了, 生成环境中不要直接发邮件,应该用消息队列,或者简单的用redis做队列
    2 replies  •  1970-01-01 08:00:00 +08:00
    kebot
        1
    kebot  
       Jun 9, 2013
    自己没做过,不过wdb挺好的。就是一个debug,很牛逼的
    whtsky
        2
    whtsky  
       Jun 9, 2013 via iPhone
    为什么不用 Sentry
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   905 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 19:26 · PVG 03:26 · LAX 12:26 · JFK 15:26
    ♥ Do have faith in what you're doing.