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

flask 统计在线人数

  •  
  •   jxwho · Aug 3, 2014 · 6018 views
    This topic created in 4325 days ago, the information mentioned may be changed or developed.
    请问flask有没有这一类的第三方帮助实现统计在线人数?
    如果没有,一般是怎么实现呢,统计session吗?
    谢谢!
    9 replies    2014-08-03 21:52:02 +08:00
    beordle
        1
    beordle  
       Aug 3, 2014
    这种感觉不需要多么精确的.反正 http 又不是长连接.如果不是上万个 ip 的话.最简单的记录 ip, 超时1min.(超时不是严格的)储存在 memcache,然后 cout.
    beordle
        2
    beordle  
       Aug 3, 2014
    刚想了一下,确实好像 session 更好些.因为很多人都是共享 ip的..
    jxwho
        3
    jxwho  
    OP
       Aug 3, 2014
    @beordle 那flask怎么统计session呢?
    janxin
        4
    janxin  
       Aug 3, 2014 via iPad   ❤️ 1
    其实一楼的意思是,session放到memcache里,然后count一下吧
    zhy0216
        5
    zhy0216  
       Aug 3, 2014   ❤️ 1
    beordle
        6
    beordle  
       Aug 3, 2014
    thx,少打个n

    @zhy0216 原来flask已经给出一个demo..
    beordle
        7
    beordle  
       Aug 3, 2014
    thx,少打个n

    @zhy0216 原来flask已经给出一个demo..
    izoabr
        8
    izoabr  
       Aug 3, 2014
    要我这脾气就直接去session的tmp目录去统计文件数了
    jxwho
        9
    jxwho  
    OP
       Aug 3, 2014
    @izoabr 别冲动哈哈哈哈....

    @zhy0216 谢谢!!
    no13bus
        10
    no13bus  
       Aug 3, 2014
    这几天看到的一本写redis的书,里面提到的办法跟一楼的很像
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2778 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 128ms · UTC 15:13 · PVG 23:13 · LAX 08:13 · JFK 11:13
    ♥ Do have faith in what you're doing.