3
如果您有任何其他想法,请告诉我,我最终结束了。最好的方法来处理Haystack导入错误
尝试在urls.py
from apps.search import search_indexes
import haystack
haystack.autodiscover()
这样做没有search_indexes的进口将无法工作。
我也用这个黑客的设置,以获得管理命令的工作:
SKIP_COMMANDS = ['test']
if any([command in sys.argv for command in SKIP_COMMANDS]):
HAYSTACK_ENABLE_REGISTRATIONS = False
我想了解一下刚刚HAYSTACK_ENABLE_REGISTRATIONS设置为false,整个时间要诚实。