我一直在使用django(2.1.5)和mysql-connector(2.1.6)。突然,当我执行“ python manage.py runserver”时,它已停止工作并给出以下错误。我一直试图通过同一问题上的其他问题来理解解决方案,但似乎没有帮助。有人可以帮忙吗。
(ApiEnv) E:\Aabha\ApiEnv\adventureworks>python manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper
at 0x000000F2445DE9D8>
Traceback (most recent call last):
File "E:\Aabha\ApiEnv\lib\site-packages\django\utils\autoreload.py", line 225,
in wrapper
fn(*args, **kwargs)
File "E:\Aabha\ApiEnv\lib\site-packages\django\core\management\commands\runser
ver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "E:\Aabha\ApiEnv\lib\site-packages\django\utils\autoreload.py", line 248,
in raise_last_exception
raise _exception[1]
File "E:\Aabha\ApiEnv\lib\site-packages\django\core\management\__init__.py", l
ine 337, in execute
autoreload.check_errors(django.setup)()
File "E:\Aabha\ApiEnv\lib\site-packages\django\utils\autoreload.py", line 225,
in wrapper
fn(*args, **kwargs)
File "E:\Aabha\ApiEnv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "E:\Aabha\ApiEnv\lib\site-packages\django\apps\registry.py", line 112, in
populate
app_config.import_models()
File "E:\Aabha\ApiEnv\lib\site-packages\django\apps\config.py", line 198, in i
mport_models
self.models_module = import_module(models_module_name)
File "E:\Aabha\ApiEnv\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "E:\Aabha\ApiEnv\lib\site-packages\django\contrib\auth\models.py", line 2
, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "E:\Aabha\ApiEnv\lib\site-packages\django\contrib\auth\base_user.py", lin
e 47, in <module>
class AbstractBaseUser(models.Model):
File "E:\Aabha\ApiEnv\lib\site-packages\django\db\models\base.py", line 101, i
n __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "E:\Aabha\ApiEnv\lib\site-packages\django\db\models\base.py", line 305, i
n add_to_class
value.contribute_to_class(cls, name)
File "E:\Aabha\ApiEnv\lib\site-packages\django\db\models\options.py", line 203
, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length(
))
File "E:\Aabha\ApiEnv\lib\site-packages\django\db\__init__.py", line 33, in __
getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "E:\Aabha\ApiEnv\lib\site-packages\django\db\utils.py", line 203, in __ge
titem__
conn = backend.DatabaseWrapper(db, alias)
File "e:\anaconda\lib\site-packages\mysql\connector\django\base.py", line 336,
in __init__
super(DatabaseWrapper, self).__init__(*args, **kwargs)
File "E:\Aabha\ApiEnv\lib\site-packages\django\db\backends\base\base.py", line
101, in __init__
self.client = self.client_class(self)
TypeError: 'NoneType' object is not callable