繁体   English   中英

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

[英]django - nginx+fastcgi --> Unhandled Exception (after upgrade from Django 1.2.4 to Django 1.3)

我刚从django 1.2.4升级到1.3。

我正在将nginxfastcgi结合使用,并且出于某种原因每次访问页面时都会出现此错误:

Unhandled Exception

An unhandled exception was thrown by the application.

任何想法可能是什么问题?

您需要跟踪fastcgi错误日志。 我应该有更详细的信息。

为了解决这个问题,我在: /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()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM