In the original environment python3.8,django1.10.0 Generate project applications in a virtual environment , Use python manage.py startapp blog Command error =>RuntimeError: class not set defining ‘AbstractBaseUser’ as <class ‘django.contrib.auth.base_user.AbstractBaseUser’>. Was classcell propagated to type.new?( Create reference articles https://blog.csdn.net/qq_25278637/article/details/86482502):
List possible causes :1. Installation and environment configuration error , install django Yes pip3 metaphysics , It is also possible to configure the system environment ( Some bloggers say that the system environment should be equipped , Some say no )
2. Will the python and django Wrong version ( Reference resources http://www.mabiji.com/python/django-python.html), Because the server database requires docking django1.x edition , I chose to reinstall python=2.7
3. Will the command and the local installation pycharm There are contradictions , Errors are reported in execute_from_command_line
After testing one by one , Discovery is the cause 2, Wasted my morning .
btw, When creating a project , Use django-admin.py startproject blog_project The generated file does not manage.py, The reason is that the command is wrong , The current version should be generated manage.py And a full set of documents , You should use the command django-admin startproject blog_project