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

怎么获取 web 用户访问某个页面的请求时间?

  •  
  •   rogwan · Sep 18, 2016 · 3235 views
    This topic created in 3672 days ago, the information mentioned may be changed or developed.
    127.0.0.1 - - [17/Sep/2016 19:47:43] "GET /index HTTP/1.1" 200 -

    每次 web 用户访问某个页面如 /index ,都会有这个 [17/Sep/2016 19:47:43] 请求时间,我想保存下来作为用户访问的最近一次时间记录。 这个请求时间要怎么获取啊?(环境: Python / Flask )
    4 replies  •  2016-09-18 18:15:04 +08:00
    SayHaHa
        1
    SayHaHa  
       Sep 18, 2016 via Android
    你在 /index 的 view 里添加一个获取当前时间的逻辑不就行了
    finab
        2
    finab  
       Sep 18, 2016 via iPhone
    @SayHaHa 讲道理,页面都超时了。😄
    rogwan
        3
    rogwan  
    OP
       Sep 18, 2016
    @SayHaHa 我跑去 session cookie 里面去找 =_=! 舍近求远。。。
    xiaooloong
        4
    xiaooloong  
       Sep 18, 2016
    nginx 的日志么?

    试试换成 openresty 搞?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   6042 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 06:20 · PVG 14:20 · LAX 23:20 · JFK 02:20
    ♥ Do have faith in what you're doing.