django xadmin报错: ‘TemplateSyntaxError at /xadmin/ ‘crispy_forms_tags’ is not a registered tag library ……’
报错详情:
TemplateSyntaxError at /xadmin/
'crispy_forms_tags' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_static
admin_urls
cache
i18n
l10n
log
rest_framework
static
staticfiles
tz
xadmin_tags
Request Method: GET
Request URL: http://127.0.0.1:8000/xadmin/
Django Version: 1.11
Exception Type: TemplateSyntaxError
Exception Value:
'crispy_forms_tags' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_static
admin_urls
cache
i18n
l10n
log
rest_framework
static
staticfiles
tz
xadmin_tags
Exception Location: F:\Projects\VueShop\lib\site-packages\django\template\defaulttags.py in find_library, line 1042
Python Executable: F:\Projects\VueShop\Scripts\python.exe
Python Version: 3.6.4
Python Path:
['F:\\Projects\\ElectricalFreash\\extra_apps',
'F:\\Projects\\ElectricalFreash',
'F:\\Projects\\ElectricalFreash',
'F:\\Projects\\ElectricalFreash',
'F:\\Projects\\VueShop\\Scripts\\python36.zip',
'F:\\Projects\\VueShop\\DLLs',
'F:\\Projects\\VueShop\\lib',
'F:\\Projects\\VueShop\\Scripts',
'e:\\anaconda3\\Lib',
'e:\\anaconda3\\DLLs',
'F:\\Projects\\VueShop',
'F:\\Projects\\VueShop\\lib\\site-packages',
'D:\\PyCharm 2017.3.3\\helpers\\pycharm_matplotlib_backend']
Server time: 星期四, 14 二月 2019 01:18:48 +0800
报错原因:运行环境中缺少了django-crispy-forms模块
解决方法:安装django-crispy-forms
pip inistall django-crispy-forms
并且在settings.py文件中配置crispy-forms
INSTALLED_APPS = [
……
'xadmin',
'crispy_forms',
……
]