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

Flask 视图函数怎么接收所有 url 的消息?或者有没有其他方法?其他框架也可

  •  
  •   PPTX · Apr 12, 2020 · 3261 views
    This topic created in 2365 days ago, the information mentioned may be changed or developed.

    想把 Flask 接收到的消息统一做处理,然后转发到其他地址,类似一个代理的功能。 视图函数怎么才能接收处理所有 url 的消息呢?或者其他的方法,或者框架

    @route('/v1/app') def index(): return 'Hello,Flask!'

    这里视图函数接收 /v1/app 的消息

    5 replies  •  2020-04-13 02:21:36 +08:00
    vZexc0m
        1
    vZexc0m  
       Apr 12, 2020 via Android
    @app.route('/')
    @app.route('/<path:path>')
    def index(path):
    return path
    ClericPy
        2
    ClericPy  
       Apr 12, 2020
    app.before_request? 记得好像是这名字
    GoLand
        3
    GoLand  
       Apr 12, 2020
    a852695
        5
    a852695  
       Apr 13, 2020
    中间件
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2472 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 13:17 · PVG 21:17 · LAX 06:17 · JFK 09:17
    ♥ Do have faith in what you're doing.