超出最大递归深度

时间:2014-08-22 20:30:02

标签: python django recursion django-models django-admin

当我尝试访问我的django项目的管理站点时。我收到一条消息,指示"超出最大递归深度"。自从我遵循教程以来,我完全无能为力。什么是反复出现的错误。

错误:

/ admin /

的RuntimeError

超出最大递归深度

Request Method:     GET
Request URL:    <this is not a link> http: /127.0.0.1:8000/admin/
Django Version:     1.6.5
Exception Type:     RuntimeError
Exception Value:    

maximum recursion depth exceeded

Exception Location:     /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-    packages/django/utils/translation/trans_real.py in get_language, line 216

的Python     可执行文件:/ Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents / MacOS / Python     Python版本:2.7.6

Traceback:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/handlers/base.py in get_response
                    response = wrapped_callback(request, *callback_args, **callback_kwargs)
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/sites.py in wrapper
                return self.admin_view(view, cacheable)(*args, **kwargs)
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/decorators.py in _wrapped_view
                    response = view_func(request, *args, **kwargs)
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/views/decorators/cache.py in _wrapped_view_func
        response = view_func(request, *args, **kwargs)
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/sites.py in inner
                                           current_app=self.name):
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/urlresolvers.py in reverse
                app_list = resolver.app_dict[ns]
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/urlresolvers.py in app_dict
            self._populate()
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/urlresolvers.py in _populate
                    for name in pattern.reverse_dict:

urls.py:

from django.conf import settings
from django.conf.urls import patterns, include, url
from rango import views
from django.contrib import admin, admindocs
admin.autodiscover()

urlpatterns = patterns('',

    url(r'^$', 'rango.views.index', name='index'),
    url(r'^rango/', include('RangoTango.urls')),
    url(r'^admin/', include(admin.site.urls)),

) 

if settings.DEBUG:
    urlpatterns += patterns(
    'django.views.static',
    (r'media/(?P<path>.*)',
    'serve',
    {'document_root': settings.MEDIA_ROOT}), ) 

Settings.py:

INSTALLED_APPS = (
     'django.contrib.admin',
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'django.contrib.admindocs',
     'rango',

 )

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'RangoTango.urls'

WSGI_APPLICATION = 'RangoTango.wsgi.application'

1 个答案:

答案 0 :(得分:0)

您的INSTALLED_APPS上有一个重复的APP。删除一个'django.contrib.admin',它应该解决问题