0

I am new to Django, I got an error on executing manage.py even though having installed Django.

Here is the error message:

vivekmehra88@vivekmehra88-HP-Pavilion-TS-15-Notebook-PC:~/PycharmProjects/myProj/django-apps/testsite$ python3 manage.py runserver 127.0.0.1:8000
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'
vivekmehra88@vivekmehra88-HP-Pavilion-TS-15-Notebook-PC:~/PycharmProjects/myProj/django-apps/testsite$ django-admin --version 
1.8.7
Rafael
  • 7,002
  • 5
  • 43
  • 52
  • Have you activated environment(where you installed django) while execution manage.py ?? – Usman Maqbool May 16 '18 at 16:15
  • are you using a virtualenv ?? is yes, make sure you call the pyton interepreter located there – Massimo Costa May 16 '18 at 16:17
  • Possible duplicate of [django import error - No module named core.management](https://stackoverflow.com/questions/6049933/django-import-error-no-module-named-core-management) – Rafael May 16 '18 at 16:18

2 Answers2

0

Run pip freeze and see if you have django installed.

If you are using a virtual environment then start that with source venv/bin/activate or whatever you've named it. In this case I named it venv. Then run pip freeze. You should probably run pip freeze >> requirements.txt to produce a requirements.txt file.

This will make it easier to rebuild the app in the cloud or on a different computer or just in a new virtual environment by calling pip install -r requirements.txt.

sahutchi
  • 2,223
  • 2
  • 19
  • 20
0

First of all you have to install required libraries to the run time environment. Since you haven't activated any virtual environment you are using root python libraries. sudo pip3 freeze will list down installed libraries.

if django isn't the list install django from sudo pip3 install django command.

Since django-admin run as a standalone application you get the version likewise.

Sajith Herath
  • 1,002
  • 2
  • 11
  • 24