一、TypeError: unsupported operand type(s) for /: ‘str’ and ‘str’
创建好Django项目,编写hello world,准备运行查看,却报如下错误,只需要查看settings.py文件,进行如下就该即可。
将 ‘DIRS’: [BASE_DIR / ‘templates’], 修改为 ‘DIRS’: [os.path.join(BASE_DIR, ‘templates’)],即可。
然后启动服务器,又出现如下错误
二、RuntimeError: maximum recursion depth exceeded in cmp
查看functools.py文件(双击报错的蓝色链接),
将截图上{}内的代码替换为如下内容即可
‘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)]
再次启动服务器:
正常启动!!!访问127.0.0.1:8000/hello/查看内容