1. 程式人生 > >django startapp報 maximum recursion depth exceeded

django startapp報 maximum recursion depth exceeded

OS cls sel tools 創建 cto 指定 other clas

報錯截圖如下:

技術分享圖片

解決辦法:修改指定路徑下的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

  

  

django startapp報 maximum recursion depth exceeded