Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django官方教程第1部分:运行时错误:cmp中超过最大递归深度_Python_Django - Fatal编程技术网

Python Django官方教程第1部分:运行时错误:cmp中超过最大递归深度

Python Django官方教程第1部分:运行时错误:cmp中超过最大递归深度,python,django,Python,Django,根据django教程,我创建了项目并执行了manage.py runserver,正如教程中所说,我得到了一个错误“RuntimeError:cmp中超过了最大递归深度” 有没有办法纠正这个问题 我得到了这个错误: Validating models... Unhandled exception in thread started by > Traceback (most recent call last): File "/Library/Python/2.7/site-packages/

根据django教程,我创建了项目并执行了manage.py runserver,正如教程中所说,我得到了一个错误“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 url.py


我知道这是一个老问题,但我只是遇到了同样的错误。将Python更新到v2.7.5对我来说很有用


我在切换帐户时出错,但试图启动同一个Django项目,我只在第一个帐户上更新了Python版本。

您能粘贴模型文件吗?没有模型文件。我只是按照教程的标题是发展Server@TarikSetia,您使用的是什么django版本?我想到的第一件事是重新安装django(可能是在安装新的django之前您还没有删除旧的django…。@cppleerner-executed python-c“import sys;sys.path=sys.path[1:];import django;print(django.\uuuu path\uuuuuuuuuuu)”以获得django的路径。然后手动移除。使用PIP重新安装
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)

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 = '+8nn@%#%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,
        },
    }
}
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)),
)