如何解决mysql连接错误

我尝试连接我的数据库。检查 settings.py 中的所有数据库设置并且它们是正确的。当我运行服务器时,我遇到如下所示的错误。我在互联网上搜索并找到了解决方案,但所有这些都适用于较低的 python 版本。我正在使用最新的 python 版本。我的错误是:


System check identified no issues (0 silenced).

Exception in thread django-main-thread:

Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner

self.run()

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run

self._target(*self._args, **self._kwargs)

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper

fn(*args, **kwargs)

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 120, in inner_run

self.check_migrations()

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 453, in check_migrations

executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/executor.py", line 18, in __init__

self.loader = MigrationLoader(self.connection)

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/loader.py", line 49, in __init__

self.build_graph()

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/loader.py", line 212, in build_graph

self.applied_migrations = recorder.applied_migrations()


芜湖不芜
浏览 112回答 1
1回答

翻翻过去那场雪

这是关于以前版本的 django 的老问题。目前是3.1.2,导致问题的代码块已修复。https://github.com/django/django/blob/master/django/db/backends/mysql/operations.pypip install -U django如果你的 django 版本比 3.0.0 更新,你可以尝试一下 (好)其他选择是在 virtualenv 中的相关行更改 django 版本源代码(丑陋),或者猴子修补相关功能(不好)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python