学习参考《web接口开发自动化测试–基于Python语言》中,在python manage.py startapp sign时候报错:
RuntimeError: class not set defining ‘AbstractBaseUser’ as <class ‘django.contrib.auth.base_user.AbstractBaseUser’>. Was classcell propagated to type.new?
一顿度娘参考https://blog.csdn.net/grace666/article/details/103568674后(侵权立删),简单理了理步骤:
- 找到文件base.py。如果前面是在cmd中安装django,则在Python的环境变量Path下,通过where python查询,python所在目录的\Lib\site-packages\django\db\models\,即D:\Python\Python38\Lib\site-packages\django\db\models\base.py。
- 打开新增以下代码。ModelBase 类下或搜索:new_class 保存退出。
new_attrs = {'__module__': module}
classcell = attrs.pop('__classcell__', None)
if classcell is not None:
new_attrs['__classcell__'] = classcell
new_class = super_new(cls, name, bases,new_attrs)
![在这里插入图片描述](https://img-blog.csdnimg.cn/71d70aff38c547fda92b2ad50dea88fd.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA6ZW_54Of5LiA56m6X-eak-aciOWNg-mHjA==,size_20,color_FFFFFF,t_70,g_se,x_16
|