首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Django: python运行服务器给出RuntimeError:在manage.py中超出了最大递归深度

Django: python运行服务器给出RuntimeError:在manage.py中超出了最大递归深度
EN

Stack Overflow用户
提问于 2013-04-28 12:50:15
回答 3查看 8.4K关注 0票数 15

我正在尝试从Django项目网站上的第一个教程学习Django。我可能遗漏了一些明显的东西,但是,当我开始运行命令时,在遵循了所有的指令之后

代码语言:javascript
复制
python manage.py runserver

我在请求帮助的末尾得到了发布的错误(为简洁起见,我只发布了错误消息重复行的前几行)。

以下是我在网上找到的一些解决方案/建议,但对我没有帮助。

1)sys.setrecursionlimit(1500)。

这对我不起作用。

2).Django RuntimeError: maximum recursion depth exceeded

这也不是一个选项,因为我没有使用PyDeV,我尝试使用pip卸载和安装Django它没有修复任何问题,我使用Mountain Lion的原生python,我不打算卸载它,因为不推荐这样做。

3)。我也试过了:

代码语言:javascript
复制
 python manage.py runserver --settings=mysite.settings

与不带选项设置的命令相同的错误

任何建议,建议都将不胜感激。我用的是....Django官方版本。1.5.1,我使用pip和Python 2.7.2安装的

代码语言:javascript
复制
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x10f7ee5d0>>
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 <module>
    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 <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),

  RuntimeError: maximum recursion depth exceeded in cmp

更新:所以我最终做的是安装virtualbox,在上面安装免费的ubuntu,然后继续完成tutorial...oh!

EN

回答 3

Stack Overflow用户

发布于 2013-04-28 12:58:57

您很可能会遇到这个错误:http://bugs.python.org/issue10042

如果不进行调试,很难知道到底发生了什么,但我猜其中一个应该是字段的东西不在这一行中:

代码语言:javascript
复制
self.local_fields.insert(bisect(self.local_fields, field), field)
票数 2
EN

Stack Overflow用户

发布于 2013-06-20 06:31:31

今天,我在这里遇到了这个问题。

我们使用的是django1.5.1和python2.7.2。

一开始我们安装了django1.4,它可以工作,但是这个项目有django1.5的特性,所以它不是一个完整的解决方案。

为了解决这个问题,我们安装了python2.7.5,它工作得很好!

票数 2
EN

Stack Overflow用户

发布于 2016-07-26 19:35:04

只需使用以下命令: python manage.py migrate

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16259729

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档