Django-mptt 错误。找不到 admin/mptt_change_list.html 模板

标签 django django-mptt

我遇到了与此主题类似的问题 Django-MPTT, how to

我已将“mptt”添加到 INSTALLED_APPS

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'app',
    'south',
    'mptt',
)

但是钢铁我有这个错误

TemplateDoesNotExist at /admin/app/category/
admin/mptt_change_list.html
Request Method: GET
Request URL:    http://127.0.0.1:8000/admin/app/category/
Django Version: 1.6.5
Exception Type: TemplateDoesNotExist
Exception Value:    
admin/mptt_change_list.html
Exception Location: /usr/local/lib/python2.7/dist-packages/django/template/loader.py in find_template, line 131
Python Executable:  /usr/bin/python
Python Version: 2.7.6

似乎模板不在它的路径上,但 mptt 已正确安装并且在 PYTHONPATH 上

Template-loader postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/mptt_change_list.html (File does not exist)
/usr/local/lib/python2.7/dist-packages/django/contrib/auth/templates/admin/mptt_change_list.html (File does not exist)
/home/islam/DM/repo/dm/DM-165/app/templates/admin/mptt_change_list.html (File does not exist)
/usr/local/lib/python2.7/dist-packages/debug_toolbar/templates/admin/mptt_change_list.html (File does not exist)

最佳答案

解决方案是使用 sudo pip uninstall django-mptt 删除 mptt 并使用 pip 再次安装:sudo pip install django-mptt --upgrade

关于Django-mptt 错误。找不到 admin/mptt_change_list.html 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24935521/

相关文章:

django - 导入错误 : cannot import name MPTTModel

python - django 导入导出不适用于 mptt

python - 如何不在 Python、Django 中两次生成相同的动态图像?

django - 数据库错误: no such table: auth_user.扩展AbstractUser并使用模型在管理上注册

Django:获取对象列表的相关记录列表

python - 处理多个应用程序覆盖 Django 中的管理命令

python - 如何在创建 Django 夹具时填充继承的 MPTT 字段?

mysql - Django:保存到数据库 connundrun

python - Django MPTT 使用 DRF 高效序列化关系数据

Django:使用 mptt-django 以多对多关系将产品分配到类别