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

web中访问数据库是否应该封装成单例模式的类?使用MySQLdb实在不方便,用ORM的话感觉太大,自己封装一个MySQLdb的类

  •  
  •   kingwkb · Jan 17, 2012 · 5445 views
    This topic created in 5370 days ago, the information mentioned may be changed or developed.
    4 replies  •  1970-01-01 08:00:00 +08:00
    ywjno
        1
    ywjno  
       Jan 17, 2012
    你是说使用连接池、手写sql文的方式来访问数据库?
    kingwkb
        2
    kingwkb  
    OP
       Jan 17, 2012 via Android
    @ywjno python web需要连接池么?不是像php一样,请求完成之后会释放资源的么(包括数据库链接)
    dndx
        3
    dndx  
       Jan 17, 2012
    @kingwkb 对于prefork模式,连接池是必须的,否则并发大了开销不可接受。
    kingwkb
        4
    kingwkb  
    OP
       Jan 17, 2012 via Android
    @dndx uwsgi
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2527 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 12:44 · PVG 20:44 · LAX 05:44 · JFK 08:44
    ♥ Do have faith in what you're doing.