V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 的 routing

  •  
  •   jxwho · May 29, 2014 · 4206 views
    This topic created in 4354 days ago, the information mentioned may be changed or developed.
    请教一下,
    flask里面通过加修饰器,然后别人访问不同路径的时候就会调用该函数是怎么实现的?
    是通过查找对应的函数的__name__来确定这种对应关系的吗?
    2 replies    2014-05-29 08:52:12 +08:00
    jxwho
        1
    jxwho  
    OP
       May 29, 2014
    看了一下源码,发现是把所有的view_function都放进了一个list里面去。
    hbc
        2
    hbc  
       May 29, 2014
    可以看看 werkzeug 的 Router
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5369 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 07:17 · PVG 15:17 · LAX 00:17 · JFK 03:17
    ♥ Do have faith in what you're doing.