【问题标题】:Ajax POST request to Django App with gunicorn as reverse proxy and nginx not working使用 gunicorn 作为反向代理和 nginx 不工作的 Django 应用程序的 Ajax POST 请求
【发布时间】:2023-03-14 15:08:01
【问题描述】:

我有一个由 Ajax 请求异步访问的 django 视图,并且在使用 manage.py runserver 命令和 gunicorn 运行应用程序时工作正常

但是,一旦我在运行 gunicorn 后关闭会话,Ajax 请求就会停止运行。

我也启用了

underscores_in_headers on;

在 nginx.conf 中

另外,这是我发现的错误

[Errno 5] Input/output error

任何帮助将不胜感激。

【问题讨论】:

  • 不清楚你说的关闭会话是什么意思。
  • 我的意思是 - 将终端窗口关闭到我的远程服务器中

标签: jquery ajax django nginx gunicorn


【解决方案1】:

我让它工作了:

我的视图中有一些调试语句,删除这些语句后,我就可以正常工作了。我认为问题在于关闭终端后屏幕分离。

gunicorn 似乎对可能无意留下的打印语句表现得很奇怪,最好避免它们。

【讨论】:

    猜你喜欢
    • 2016-03-19
    • 2019-06-15
    • 1970-01-01
    • 2016-05-11
    • 1970-01-01
    • 1970-01-01
    • 2017-07-17
    • 2019-06-24
    • 1970-01-01
    相关资源
    最近更新 更多