1

I was able to run the local server using python manage.py runserver in the command line; when I tried the command I got this error:

Traceback (most recent call last):
    File "manage.py", line 8, in <module>
        from django.core.management import execute_from_command_line
ImportError: No module named django.core.management

I haven't uninstalled django or edited any of the source code because everything was working fine yesterday. I don't understand what happened.

nobody
  • 19,814
  • 17
  • 56
  • 77
AdamC
  • 63
  • 2
  • 8

2 Answers2

3

You may have Django but you are using a Python version which doesn't have Django in its site-packages folder. Check which version you are using and on which version you have installed Django. You might have change your default Python interpreter since yesterday:

$ python
Python 2.7.3 (default, Dec 18 2012, 13:50:09)
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.core.management import execute_from_command_line
>>>

[...]
$ python3
Python 3.2.3 (default, Jul 23 2012, 16:48:24)
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.core.management import execute_from_command_line
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named django.core.management

Here I have Django in my Python 2.7 site-packages folder but not on Python 3 and it can't find any django module in my PYTHONPATH then.

Maxime Lorant
  • 34,607
  • 19
  • 87
  • 97
  • Thank you. Your answer here helped me to resolve the issue here : https://serverfault.com/questions/994651/django-import-error-while-installing-tacker-via-devstack-no-module-named-django/997498#997498 – mehdi sharifi Jan 09 '20 at 20:47
0

Uninstall django and reinstall it again.

That might solve the issue.

Patrick Bassut
  • 3,310
  • 5
  • 31
  • 54