報錯:ModuleNotFoundError: No module named ‘haystack.urls’
解決:
pip uninstall haystack
pip install django-haystack
報錯:cannot import name ‘smart_text’ from ‘django.utils.encoding’
解決:setting.py中添加
import django
from django.utils.encoding import smart_str
django.utils.encoding.smart_text = smart_str
報錯:ModuleNotFoundError: No module named ‘haystack.backends.whoosh_cn_backend’
解決:setting.py中修改
'ENGINE': 'haystack.backends.whoosh_cn_backend.WhooshEngine',
為:
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
報錯: cannot import name ‘url’ from ‘django.conf.urls’
解決:
pip install Whoosh
修改:
from django.conf.urls import url
為:
from django.urls import re_path as url
報錯:django.db.utils.OperationalError: (1045, “Access denied for user ‘root’@‘localhost’ (using password: YES)”)
這是mysql密碼錯了,到對應位置修改為正確密碼:
報錯:installing mysqlclient error: mysqlclient 1.4.0 or newer is required; you have 0.9.3
解決:
pip3 uninstall mysqlclient
pip3 uninstall pymysql
pip3 install mysqlclient
pip3 install pymysql