Home  >  Q&A  >  body text

python - 为什么同一个URL,django runserver请求正常,但是用httpd请求却报404错误?

一个URL,如/a/b/<b.id>/c,如果b.id获取不到,就是一个空字符串,此时URL为/a/b//c,同时b.id将在进入具体的视图后通过其它方式获取。
通过python manage.py runserver形式跑该代码,没有任何问题,但是该代码通过httpd部署在线上后,该链接的请求将直接报404错误,显示无法找到匹配的URL。

请问,这是什么原因造成的呢?

我个人猜测是django runserver的简易http服务器对URL的处理与Apache这样的专业http服务器处理不同,但是不知如何验证,求大神答疑解惑。

大家讲道理大家讲道理2741 days ago479

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 10:28:24

    There shouldn’t be such a big difference. The configuration of gunicorn is also very simple. Please try to see if there are still such errors. Their logs should be monitored in a timely manner.

    reply
    0
  • Cancelreply