3

I\ve got a problem similar to this topic Django-MPTT, how to

I've added 'mptt' to 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',
)

But steel I have this error

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

It seems that template is not on it's path, but mptt is installed correctly and is on 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)
Community
  • 1
  • 1
opportunity356
  • 168
  • 1
  • 11
  • can you tell us how you installed mptt ? – Raja Simon Jul 24 '14 at 13:51
  • @rajasimon, I've followed the documentation (http://django-mptt.github.io/django-mptt/install.html) and downloaded zip from here (https://pypi.python.org/pypi/django-mptt/), then extracted data and tried this command "sudo python setup.py install". It has been installed, but didn't work. Then I've tried "pip install django-mptt --upgrade" – opportunity356 Jul 25 '14 at 05:41
  • ok cool.. check pip freeze if mptt is there then installed app definitely load template. – Raja Simon Jul 25 '14 at 05:50

2 Answers2

3

The solution was to delete mptt using sudo pip uninstall django-mptt and install it again using pip: sudo pip install django-mptt --upgrade

opportunity356
  • 168
  • 1
  • 11
  • This is surprising, but it helped me. Thanks. :D –  Aug 05 '15 at 16:13
  • 2
    This answers suggests installing django packages in global site (system wide). While this might temporarily work when you have just one project, it's a very bad practice. You should be using virtualenv. In my case the error was caused by not including `mptt` in `INSTALLED_APPS`. The OP had the app declared there but was probably running django as the user (without sudo) which likely caused the python to not find it or other similar. This answer is misleading. –  Nov 05 '16 at 12:21
1

Well as for as i know you can install Any python django package there easy ways:

1.)

You can do like via

pip install <package Nmae>

for sometime sudo pip install <packageName> also works

2.)

Then download the tar file and extract from that directory you can install via

python setup.py insatll

3.)

And here you did two so try this thing also

download the mptt folder and put it into your django project. Hope this will work

Raja Simon
  • 10,126
  • 5
  • 43
  • 74
  • Thank you! I've tried all this. I didn't understand what was wrong, but the solution was to delete and install again using pip. – opportunity356 Jul 25 '14 at 06:16