django db connection 报错

来源:10-2 全局搜索功能开发

dhzy

2019-01-08

hi 老师,
我本来想用django manage.py graph_models 生成class diagrram,结果run了之后我整个server都启动不了, 然后一直报以下的错误。我之前一直都是正常的。

Unhandled exception in thread started by <function wrapper at 0x1103419b0>
Traceback (most recent call last):
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/utils/autoreload.py”, line 226, in wrapper
fn(*args, **kwargs)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/core/management/commands/runserver.py”, line 116, in inner_run
self.check(display_num_errors=True)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/core/management/base.py”, line 426, in check
include_deployment_checks=include_deployment_checks,
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/core/checks/registry.py”, line 75, in run_checks
new_errors = check(app_configs=app_configs)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/core/checks/model_checks.py”, line 28, in check_all_models
errors.extend(model.check(**kwargs))
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/models/base.py”, line 1170, in check
errors.extend(cls._check_fields(**kwargs))
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/models/base.py”, line 1247, in _check_fields
errors.extend(field.check(**kwargs))
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/models/fields/init.py”, line 925, in check
errors = super(AutoField, self).check(**kwargs)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/models/fields/init.py”, line 208, in check
errors.extend(self._check_backend_specific_checks(**kwargs))
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/models/fields/init.py”, line 317, in _check_backend_specific_checks
return connections[db].validation.check_field(self, **kwargs)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/mysql/validation.py”, line 18, in check_field
field_type = field.db_type(connection)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/models/fields/init.py”, line 625, in db_type
return connection.data_types[self.get_internal_type()] % data
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/init.py”, line 36, in getattr
return getattr(connections[DEFAULT_DB_ALIAS], item)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/utils/functional.py”, line 33, in get
res = instance.dict[self.name] = self.func(instance)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/mysql/base.py”, line 184, in data_types
if self.features.supports_microsecond_precision:
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/utils/functional.py”, line 33, in get
res = instance.dict[self.name] = self.func(instance)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/mysql/features.py”, line 53, in supports_microsecond_precision
return self.connection.mysql_version >= (5, 6, 4) and Database.version_info >= (1, 2, 5)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/utils/functional.py”, line 33, in get
res = instance.dict[self.name] = self.func(instance)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/mysql/base.py”, line 359, in mysql_version
with self.temporary_connection():
File “/anaconda3/envs/py2/lib/python2.7/contextlib.py”, line 17, in enter
return self.gen.next()
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 564, in temporary_connection
cursor = self.cursor()
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 231, in cursor
cursor = self.make_debug_cursor(self._cursor())
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 204, in _cursor
self.ensure_connection()
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 199, in ensure_connection
self.connect()
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/utils.py”, line 95, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 199, in ensure_connection
self.connect()
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 171, in connect
self.connection = self.get_new_connection(conn_params)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/django/db/backends/mysql/base.py”, line 264, in get_new_connection
conn = Database.connect(**conn_params)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/MySQLdb/init.py”, line 81, in Connect
return Connection(*args, **kwargs)
File “/anaconda3/envs/py2/lib/python2.7/site-packages/MySQLdb/connections.py”, line 193, in init
super(Connection, self).init(*args, **kwargs2)
django.db.utils.OperationalError: (2026, ‘SSL connection error: SSL_CTX_set_tmp_dh failed’)

写回答

1回答

bobby

2019-01-10

0
0

Python3.6+django+xadmin,打造在线教育平台

【毕设】Python 2.7到3.6 完美适配,Django升级2.0

3677 学习 · 4038 问题

查看课程