已解决:code%3DH18 desc%3D%22Server Request Interrupted%22 django

核心.exceptions.Http404

请求被服务器错误中断。

-admin.py runserver

If you are running Django on a development server and you get an error code that says "Server Request Interrupted", it means that the server was unable to process your request. This can happen for a number of reasons, including if the server is overloaded or if there is an error in your code.

Heroku Django Gunicorn 错误 H18

当尝试使用 Gunicorn 服务器将 Django 应用程序部署到 Heroku 时,可能会发生此错误。 该错误通常是由于缺少对 psycopg2 库的依赖项造成的。

要解决此问题,您可以使用以下命令在您的 Heroku 实例上安装 psycopg2:

$ heroku 插件:添加 python-psycopg2

安装 psycopg2 后,您可以使用以下命令重新部署 Django 应用程序:

$ heroku 部署 –app my-django

请求中断

当 Django 中的请求被中断时,请求对象被设置为 None 。 这意味着请求已被取消,不会对其进行进一步处理。

如果你想继续处理请求,你应该再次调用 process_request()。

调试“H18 服务器请求中断”错误

在 Django 中调试“H18 服务器请求中断”错误可能很困难。 这些错误的最常见原因是等待 H18 服务器响应时超时。 为了调试这些错误,您需要确定超时的来源并努力解决它。

相关文章:

发表评论