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

django 中如何获取一个页面的展示次数

  •  
  •   larkifly · Jun 13, 2014 · 3752 views
    This topic created in 4524 days ago, the information mentioned may be changed or developed.
    需求是这样的:

    页面有个地方展示a信息,当这个页面被浏览N次后,就展示b信息


    我目前的做法是全局变量的做法
    2 replies  •  2014-06-14 11:12:04 +08:00
    xingzhi
        1
    xingzhi  
       Jun 13, 2014   ❤️ 1
    使用redis或其它缓存系统做计数。

    用全局变量你考虑一下:
    代码更新了要重启应用怎么办?网站挂了怎么办,服务器重启了怎么办?
    计数如何清零?。。。
    larkifly
        2
    larkifly  
    OP
       Jun 14, 2014
    @xingzhi 感谢提醒,非常感谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4955 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 03:51 · PVG 11:51 · LAX 19:51 · JFK 22:51
    ♥ Do have faith in what you're doing.