3

我刚刚从 django 1.2.4 升级到 1.3。

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

Unhandled Exception

An unhandled exception was thrown by the application.

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

4

2 回答 2

2

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

于 2011-05-10T18:52:49.003 回答
1

为了解决这个问题,我在以下位置添加了这个类(实际上什么都不做):/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()
于 2011-05-11T19:10:41.443 回答