我遇到了与此主题类似的问题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)
答案 0 :(得分:2)
解决方法是使用sudo pip uninstall django-mptt
删除mptt
然后使用pip:sudo pip install django-mptt --upgrade
答案 1 :(得分:1)
因为我知道你可以通过简单的方式安装任何python django包:
1)
你可以通过
来做pip install
<package Nmae>
有时sudo pip install <packageName>
也有效
2)。
然后下载tar file
并从该目录中提取,您可以通过
python setup.py insatll
3。)
在这里你做了两个所以尝试这个东西
下载mptt folder
并将其放入您的django项目中。希望这会起作用