程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

No module named ‘haystack. Various Django error reporting solutions such as URLs

編輯:Python

Report errors :ModuleNotFoundError: No module named ‘haystack.urls’
solve :

pip uninstall haystack
pip install django-haystack

Report errors :cannot import name ‘smart_text’ from ‘django.utils.encoding’
solve :setting.py Add

import django
from django.utils.encoding import smart_str
django.utils.encoding.smart_text = smart_str

Report errors :ModuleNotFoundError: No module named ‘haystack.backends.whoosh_cn_backend’

solve :setting.py Revision in China

'ENGINE': 'haystack.backends.whoosh_cn_backend.WhooshEngine',

by :

 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',

Report errors : cannot import name ‘url’ from ‘django.conf.urls’
solve :

pip install Whoosh

modify :

from django.conf.urls import url

by :

from django.urls import re_path as url

Report errors :django.db.utils.OperationalError: (1045, “Access denied for user ‘root’@‘localhost’ (using password: YES)”)

This is a mysql The password is wrong , Change to the correct password at the corresponding location :

Report errors :installing mysqlclient error: mysqlclient 1.4.0 or newer is required; you have 0.9.3
solve :

pip3 uninstall mysqlclient
pip3 uninstall pymysql
pip3 install mysqlclient
pip3 install pymysql

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved