我正在使用python 3.6,mysql-community-server-8.0.11-1并使用fedora 28 我正在尝试为我的Django应用程序设置mysql 但是我收到细分错误
(myblogvenv) [saurabhkumar@localhost myblog]$ python manage.py runserver
Performing system checks...
Segmentation fault (core dumped)
如果我使用默认的sqlite3数据库,服务器将启动。
另外,当我运行django-admin dbshell
时,也会出现以下错误:
(myblogvenv) [saurabhkumar@localhost myblog]$ django-admin dbshell
Traceback (most recent call last):
File "/run/media/saurabhkumar/9bba3767-3aa7-4b39-a4a7-
331f939ae4d9/django_projects/common_lounge/myblog/myblogvenv/bin/django-
admin", line 11, in <module>
sys.exit(execute_from_command_line())
File "/run/media/saurabhkumar/9bba3767-3aa7-4b39-a4a7-331f939ae4d9/django_projects/common_lounge/myblog/myblogvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/run/media/saurabhkumar/9bba3767-3aa7-4b39-a4a7-331f939ae4d9/django_projects/common_lounge/myblog/myblogvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 317, in execute
settings.INSTALLED_APPS
File "/run/media/saurabhkumar/9bba3767-3aa7-4b39-a4a7-331f939ae4d9/django_projects/common_lounge/myblog/myblogvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/run/media/saurabhkumar/9bba3767-3aa7-4b39-a4a7-331f939ae4d9/django_projects/common_lounge/myblog/myblogvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/run/media/saurabhkumar/9bba3767-3aa7-4b39-a4a7-331f939ae4d9/django_projects/common_lounge/myblog/myblogvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/home/saurabhkumar/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mysite'
这是我的项目结构:
(myblogvenv) [saurabhkumar@localhost myblog]$ ls
db.sqlite3 manage.py myblogvenv mysite
(myblogvenv) [saurabhkumar@localhost myblog]$ cd mysite
(myblogvenv) [saurabhkumar@localhost mysite]$ ls
__init__.py __pycache__ settings.py urls.py wsgi.py
settings.py中的“数据库”部分看起来像
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'blog',
'USER': 'bloguser',
'PASSWORD': 'Blog#user1',
'HOST': '/var/lib/mysql',
'PORT': '3306',
}
}
使用以下软件包
(myblogvenv) [saurabhkumar@localhost mysite]$ pip list
Package Version
----------- -------
Django 2.0.6
mysqlclient 1.3.12
pip 10.0.1
pytz 2018.4
setuptools 39.2.0
wheel 0.31.1
有关如何调试/修复问题的任何指针将帮助我继续进行。