1 、django-blog-tutorial : github.com/jukanntenn/…
2 、helloDjango 博客教程地址:www.zmrenwu.com/tutorials/h…
按照第 1 个的 readme 里面的内容去安装使用:
其中我没有用到虚拟环境,直接用的本地环境;
遇到的问题如下:
执行 python manage.py migrate
, 报错
RuntimeError: __class__ not set defining 'AbstractBaseUser' as <class 'djang
解决办法,找到 Python 的安装路径,然后一步步查找到 base.py
/Users/xxxx/Library/Python/3.9/lib/python/site-packages/django/db/models/base.py
找到 base.py,在93行下面添加如下内容
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)
然后重新运行就 OK 了。