Django创建应用时如何解决最大递归深度超出的问题?
- 内容介绍
- 文章标签
- 相关推荐
本文共计428个文字,预计阅读时间需要2分钟。
错误截图内容如下:解决方法:修改指定路径下的functools.py文件中的def total_ordering(cls):方法:原始代码:convert={'__lt__': [(__gt__, lambda self, other: other+self)], ('__le__', lambda self, other: not other.__lt__(self))}
修改后:convert={'__lt__': [(__gt__, lambda self, other: other+self)], ('__le__', lambda self, other: not other.__lt__(self))}
报错截图如下:
解决办法:修改指定路径下的functools.py文件的def total_ordering(cls):方法:
原来的样子:
convert = {'__lt__': [('__gt__', lambda self, other: other < self),
('__le__', lambda self, other: not other < self),
('__ge__', lambda self, other: not self < other)],
'__le__': [('__ge__', lambda self, other: other <= self),
('__lt__', lambda self, other: not other <= self),
('__gt__', lambda self, other: not self <= other)],
'__gt__': [('__lt__', lambda self, other: other > self),
('__ge__', lambda self, other: not other > self),
('__le__', lambda self, other: not self > other)],
'__ge__': [('__le__', lambda self, other: other >= self),
('__gt__', lambda self, other: not other >= self),
('__lt__', lambda self, other: not self >= other)]
}
修改后的样子:
convert = {'__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
('__le__', lambda self, other: self < other or self == other),
('__ge__', lambda self, other: not self < other)],
'__le__': [('__ge__', lambda self, other: not self <= other or self == other),
('__lt__', lambda self, other: self <= other and not self == other),
('__gt__', lambda self, other: not self <= other)],
'__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
('__ge__', lambda self, other: self > other or self == other),
('__le__', lambda self, other: not self > other)],
'__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
('__gt__', lambda self, other: self >= other and not self == other),
('__lt__', lambda self, other: not self >= other)]
}
改完之后即可创建app
更多内容详见微信公众号:Python研究所
本文共计428个文字,预计阅读时间需要2分钟。
错误截图内容如下:解决方法:修改指定路径下的functools.py文件中的def total_ordering(cls):方法:原始代码:convert={'__lt__': [(__gt__, lambda self, other: other+self)], ('__le__', lambda self, other: not other.__lt__(self))}
修改后:convert={'__lt__': [(__gt__, lambda self, other: other+self)], ('__le__', lambda self, other: not other.__lt__(self))}
报错截图如下:
解决办法:修改指定路径下的functools.py文件的def total_ordering(cls):方法:
原来的样子:
convert = {'__lt__': [('__gt__', lambda self, other: other < self),
('__le__', lambda self, other: not other < self),
('__ge__', lambda self, other: not self < other)],
'__le__': [('__ge__', lambda self, other: other <= self),
('__lt__', lambda self, other: not other <= self),
('__gt__', lambda self, other: not self <= other)],
'__gt__': [('__lt__', lambda self, other: other > self),
('__ge__', lambda self, other: not other > self),
('__le__', lambda self, other: not self > other)],
'__ge__': [('__le__', lambda self, other: other >= self),
('__gt__', lambda self, other: not other >= self),
('__lt__', lambda self, other: not self >= other)]
}
修改后的样子:
convert = {'__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
('__le__', lambda self, other: self < other or self == other),
('__ge__', lambda self, other: not self < other)],
'__le__': [('__ge__', lambda self, other: not self <= other or self == other),
('__lt__', lambda self, other: self <= other and not self == other),
('__gt__', lambda self, other: not self <= other)],
'__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
('__ge__', lambda self, other: self > other or self == other),
('__le__', lambda self, other: not self > other)],
'__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
('__gt__', lambda self, other: self >= other and not self == other),
('__lt__', lambda self, other: not self >= other)]
}
改完之后即可创建app

