django-nginx+fastcgi -->未处理的异常(从 Django 1.2.4 升级到 Django 1.3 后)

发布于 2024-11-05 22:43:11 字数 246 浏览 0 评论 0原文

我刚刚从 django 1.2.4 升级到 1.3。

我将 nginxfastcgi 结合使用,由于某种原因,每次访问页面时都会收到此错误:

Unhandled Exception

An unhandled exception was thrown by the application.

有什么想法可能是什么问题吗?

I just upgraded from django 1.2.4 to 1.3.

I'm using nginx in conjunction with fastcgi and for some reason every time when I access a page I get this error:

Unhandled Exception

An unhandled exception was thrown by the application.

Any ideas what the problem might be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

找个人就嫁了吧 2024-11-12 22:43:11

您需要追踪 fastcgi 错误日志。那里应该有更详细的信息。

You need to track down your fastcgi error log. There should me more detailed information in there.

脸赞 2024-11-12 22:43:11

为了修复它,我在以下位置添加了此类(实际上不执行任何操作): /usr/local/lib/python2.6/dist-packages/django/middleware/http.py

class SetRemoteAddrFromForwardedFor(object):
    """
    This middleware has been removed; see the Django 1.1 release notes for
    details.

    It previously set REMOTE_ADDR based on HTTP_X_FORWARDED_FOR. However, after
    investiagtion, it turns out this is impossible to do in a general manner:
    different proxies treat the X-Forwarded-For header differently. Thus, a
    built-in middleware can lead to application-level security problems, and so
    this was removed in Django 1.1

    """
    def __init__(self):
        import warnings
        warnings.warn("SetRemoteAddrFromForwardedFor has been removed. "
                      "See the Django 1.1 release notes for details.",
                      category=DeprecationWarning)
        raise MiddlewareNotUsed()

To fix it I added this class (that practically doesn't do anything) in the : /usr/local/lib/python2.6/dist-packages/django/middleware/http.py

class SetRemoteAddrFromForwardedFor(object):
    """
    This middleware has been removed; see the Django 1.1 release notes for
    details.

    It previously set REMOTE_ADDR based on HTTP_X_FORWARDED_FOR. However, after
    investiagtion, it turns out this is impossible to do in a general manner:
    different proxies treat the X-Forwarded-For header differently. Thus, a
    built-in middleware can lead to application-level security problems, and so
    this was removed in Django 1.1

    """
    def __init__(self):
        import warnings
        warnings.warn("SetRemoteAddrFromForwardedFor has been removed. "
                      "See the Django 1.1 release notes for details.",
                      category=DeprecationWarning)
        raise MiddlewareNotUsed()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文