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

nginx+django+gunicorn 遇到 URL 空格转义问题~

  •  
  •   pc10201 · Feb 23, 2017 · 2841 views
    This topic created in 3508 days ago, the information mentioned may be changed or developed.
    URL 如果是 123 456,浏览器点击后就会变成 123%20456
    在 django 自带的调试服务中,通过 URL 正则获取到的值是 123 456,一点问题没有

    但通过 nginx+django+gunicorn 部署到生产服务器,获取到的值是 123%20456,然后导致与数据库交互有一些错误,但感觉也不是 django 的 bug 啊~难道是 nginx+gunicorn 的问题?我是通过 proxy_pass 传递数据的~
    2 replies  •  2017-03-08 20:03:52 +08:00
    lonelywheel
        1
    lonelywheel  
       Mar 8, 2017
    注意你的 url 里面 123 和 456 的空格,应该是空格 urlencode 转换成了%20
    pc10201
        2
    pc10201  
    OP
       Mar 8, 2017
    @lonelywheel 已经找到解决办法了,我把 gunicorn 的 worker 由 aiohttp 换成 gevent 就好了~估计是 aiohttp 的锅
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2326 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 02:18 · PVG 10:18 · LAX 19:18 · JFK 22:18
    ♥ Do have faith in what you're doing.