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

在使用 Flask 开发时,两个蓝图如果 url_prefix 相同,且在蓝图里的 route() 也相同,那 Flask 会如何处理呢?

  •  
  •   onyourroad · Jul 20, 2019 · 3344 views
    This topic created in 2498 days ago, the information mentioned may be changed or developed.
    如题,在使用 Flask 时突然产生的困惑,有大佬知道吗?
    7 replies    2019-07-21 18:38:52 +08:00
    summerwar
        1
    summerwar  
       Jul 20, 2019 via Android
    试试不就知道了吗?
    summerwar
        2
    summerwar  
       Jul 20, 2019 via Android
    按照逻辑,两个蓝图注册有先后,先注册的触发了后面的就不会继续了,就是这样。

    所以路由,特殊的放前面,通用的放后面
    Yourshell
        3
    Yourshell  
       Jul 20, 2019
    估计启动不了,抛出 duplicate blueprint prefix 之类
    Hopetree
        4
    Hopetree  
       Jul 20, 2019
    试试不就知道了?
    Ct5T66PVR1bW7b2z
        5
    Ct5T66PVR1bW7b2z  
       Jul 20, 2019 via Android
    应该运行出错
    rexyan
        6
    rexyan  
       Jul 21, 2019
    endpoint ?
    Tyanboot
        7
    Tyanboot  
    PRO
       Jul 21, 2019
    好像会有个 endpoint 重复的错误, 然后需要自己设置不同的 endpoint.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2701 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 11:44 · PVG 19:44 · LAX 04:44 · JFK 07:44
    ♥ Do have faith in what you're doing.