Django (web framework): ImportError: cannot import name MPTTModel
-
I did the steps at the tutorial " http://django-mptt.github.com/django-mptt/tutorial.html " but it still give me the import error , I double check the code for the mptt and found the class MPTTMODEL exist in the mptt>model file Validating models... Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x1ec4710>> Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/management/commands/http://runserver.py", line 91, in inner_run self.validate(display_num_errors=True) File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/management/http://base.py", line 266, in validate num_errors = get_validation_errors(s, app) File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/management/http://validation.py", line 30, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/db/models/http://loading.py", line 158, in get_app_errors self._populate() File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/db/models/http://loading.py", line 67, in _populate self.load_app(app_name) File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/db/models/http://loading.py", line 88, in load_app models = import_module('.models', app_name) File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/utils/http://importlib.py", line 35, in import_module __import__(name) File "/home/kareemhashem/espace/sharek/core/http://models.py", line 12, in <module> from mptt.models import MPTTModel, TreeForeignKey ImportError: cannot import name MPTTModel
-
Answer:
Add mptt to INSTALLED_APPS in settings file.
Cihad GündoÄdu at Quora Visit the source
Related Q & A:
- How can I use SSL with django?Best solution by Stack Overflow
- How to load `static` tag by default in Django template?Best solution by tangowithdjango.com
- How to run test database in Django?Best solution by Stack Overflow
- Does yahoo have a toolbar feature to fill out web forms (name, email,address,etc?Best solution by Yahoo! Answers
- How do I change the alias on my Yahoo! domain name to web.me.com?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.