Search code examples
python-2.7virtualenvdjango-1.7

django in virtaul environment giving ImportError


if i run

(My_Virtual_Env) G:\My-Project\My_Code>python ..\My_Virtual_Env\Scripts\django-admin.py startproject My_django_project

its working fine and new project is getting created.

But when i run

(My_Virtual_Env) G:\My-Project\My_Code>django-admin.py startproject My_django_project

am getting error

ImportError: No module named django.core

i want to know why it is happening ? and what are the changes need to do to run second command as it is ?


Solution

  • The My_Virtual_Env/Scripts folder is not added to the classpath by default. That is why you get that error. If you install django, the directory of this will directly be added to classpath. Why do you execute from another place?