2013-03-21 65 views
2

按照Django的教程中,我创建的项目,在教程中说annd我得到一个错误执行manage.py runserver命令“RuntimeError:在CMP最大递归深度超出”Django官方教程第1部分:RuntimeError:最大递归深度在CMP超过

有什么办法来纠正呢?

我得到这个错误为:

 
Validating models... 

Unhandled exception in thread started by > 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run 
    self.validate(display_num_errors=True) 
    File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 280, in validate 
    num_errors = get_validation_errors(s, app) 
    File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors 
    for (app_name, error) in get_app_errors().items(): 
    File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 166, in get_app_errors 
    self._populate() 
    File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 72, in _populate 
    self.load_app(app_name, True) 
    File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 96, in load_app 
    models = import_module('.models', app_name) 
    File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 
    File "/Library/Python/2.7/site-packages/django/contrib/auth/models.py", line 370, in 
    class AbstractUser(AbstractBaseUser, PermissionsMixin): 
    File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 213, in __new__ 
    new_class.add_to_class(field.name, copy.deepcopy(field)) 
    File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 265, in add_to_class 
    value.contribute_to_class(cls, name) 
    File "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", line 257, in contribute_to_class 
    cls._meta.add_field(self) 
    File "/Library/Python/2.7/site-packages/django/db/models/options.py", line 179, in add_field 
    self.local_fields.insert(bisect(self.local_fields, field), field) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in 
    '__lt__': [('__gt__', lambda self, other: other 
    '__lt__': [('__gt__', lambda self, other: other 
    '__lt__': [('__gt__', lambda self, other: other 
    '__lt__': [('__gt__', lambda self, other: other ......................... 
RuntimeError: maximum recursion depth exceeded in cmp 

Settings.py

DEBUG = True 
TEMPLATE_DEBUG = DEBUG 
ADMINS = (
    # ('Your Name', '[email protected]'), 
) 

MANAGERS = ADMINS 

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 
     'NAME': '',      # Or path to database file if using sqlite3. 
     # The following settings are not used with sqlite3: 
     'USER': '', 
     'PASSWORD': '', 
     'HOST': '',      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 
     'PORT': '',      # Set to empty string for default. 
    } 
} 


ALLOWED_HOSTS = [] 


TIME_ZONE = 'America/Chicago' 


LANGUAGE_CODE = 'en-us' 

SITE_ID = 1 


USE_I18N = True 


USE_L10N = True 
USE_TZ = True 
MEDIA_ROOT = '' 
MEDIA_URL = '' 
STATIC_ROOT = '' 
STATIC_URL = '/static/' 
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static". 
    # Always use forward slashes, even on Windows. 
    # Don't forget to use absolute paths, not relative paths. 
) 


STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder', 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
# 'django.contrib.staticfiles.finders.DefaultStorageFinder', 
) 

SECRET_KEY = '[email protected]%#%d8r4##x*t==ja=kbm(514bng1m47yesv1wlsu#%)h4' 

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader', 
    'django.template.loaders.app_directories.Loader', 
#  'django.template.loaders.eggs.Loader', 
) 

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware', 
    'django.contrib.sessions.middleware.SessionMiddleware', 
    'django.middleware.csrf.CsrfViewMiddleware', 
    'django.contrib.auth.middleware.AuthenticationMiddleware', 
    'django.contrib.messages.middleware.MessageMiddleware', 
    # Uncomment the next line for simple clickjacking protection: 
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware', 
) 

ROOT_URLCONF = 'mysite.urls' 

WSGI_APPLICATION = 'mysite.wsgi.application' 

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". 
    # Always use forward slashes, even on Windows. 
    # Don't forget to use absolute paths, not relative paths. 
) 

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.sites', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    # Uncomment the next line to enable the admin: 
    # 'django.contrib.admin', 
    # Uncomment the next line to enable admin documentation: 
    # 'django.contrib.admindocs', 
) 


LOGGING = { 
    'version': 1, 
    'disable_existing_loggers': False, 
    'filters': { 
     'require_debug_false': { 
      '()': 'django.utils.log.RequireDebugFalse' 
     } 
    }, 
    'handlers': { 
     'mail_admins': { 
      'level': 'ERROR', 
      'filters': ['require_debug_false'], 
      'class': 'django.utils.log.AdminEmailHandler' 
     } 
    }, 
    'loggers': { 
     'django.request': { 
      'handlers': ['mail_admins'], 
      'level': 'ERROR', 
      'propagate': True, 
     }, 
    } 
} 

urls.py

from django.conf.urls import patterns, include, url 
home', name='home'), 
    # url(r'^mysite/', include('mysite.foo.urls')), 
    enter code here 
    # Uncomment the admin/doc line below to enable admin documentation: 
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), 

    # Uncomment the next line to enable the admin: 
    # url(r'^admin/', include(admin.site.urls)), 
) 
+0

你能粘贴你的模型文件吗? –

+0

没有模型文件。我只是按照教程https://docs.djangoproject.com/en/1.5/intro/tutorial01/标题是开发服务器 –

+0

@TarikSetia,你正在使用什么Django的版本?我想到的第一件事是重新安装django(可能你在安装新的django之前没有删除旧的django ..)。 – alecxe

回答

2

我知道这是一个老问题,但我遇到了同样的错误。更新Python到v 2.7.5为我工作。

我得到的错误,当我打开账户,但试图旋转起来一样的Django项目,我只更新第一个帐户我的Python版本。

相关问题