V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
darkmatter
V2EX  ›  Python

关于 Tornado 的 URL

  •  
  •   darkmatter · 2016-09-10 21:25:08 +08:00 · 1734 次点击
    这是一个创建于 2791 天前的主题,其中的信息可能已经有所发展或是发生改变。
    http://localhost:8000/api/keyword/测试 /city/测试 /page/0/page_size/20
    如何改成
    http://localhost:8000/api?keyword=测试&city=测试&page=0&page_size=20
    而且其中参数可以互换位置?
    4 条回复    2016-09-11 11:27:12 +08:00
    janxin
        1
    janxin  
       2016-09-10 21:35:50 +08:00 via iPhone   ❤️ 1
    self.get_argument
    cloverstd
        2
    cloverstd  
       2016-09-10 22:15:27 +08:00   ❤️ 1
    nginx rewrite 然后 self.get_argument
    ldehai
        3
    ldehai  
       2016-09-11 11:24:07 +08:00
    貌似这样写不科学: http://localhost:8000/api?keyword=测试&city=测试&page=0&page_size=20
    ldehai
        4
    ldehai  
       2016-09-11 11:27:12 +08:00
    可以改成 http://localhost:8000/api/func?keyword=测试&city=测试&page=0&page_size=20
    url schema 配置成(r"/func", FuncHandler)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   770 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 21:57 · PVG 05:57 · LAX 14:57 · JFK 17:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.