0

Im testing Python Tools For Visual Studio, I create a django project, make a SyncDB and install django admin with no problems, but now Im trying to make Data Base migration like: Django 1.7 Migrations. the point is that i cant figuer out how to do that. I serched in google and find this: How to run django database migrations with PTVS?. So the migration command is not wraped. I tried using Windows Command Prompt and install C:\Python34\;C:\Python34\Scripts; PATHS but when i type a django command like python manage.py runserver appears No module named 'django'. It seems that i am not pointing to my django project virtual env, but i dont know how to do that.

Execute command in my django app env path does not work neither.

Image:

enter image description here

Thanks a lot!

andre
  • 192
  • 2
  • 12

2 Answers2

1

Before using of virtual env you should activate it. Execute env\activate or env\bin\activate. Not a windows guy so I'm not sure which path virtualenv uses on Windows :-)

catavaran
  • 44,703
  • 8
  • 98
  • 85
  • Path: [env\Scripts\activate] works, now (env) appears in console but with the same result "No module named django". I cheked again and in my virtual env django 1.7.3 is installed – andre Jan 28 '15 at 21:14
  • How did you install django into the virtualenv? You should call `activate` first and then `pip install django`. – catavaran Jan 28 '15 at 21:44
  • Removing and re-creating virtual env solve the issue, thanks @catavaran you give me the hint to solve the issue – andre Jan 28 '15 at 22:25
0

You have to activate virtualenv. Go to env/Scripts directory and run activate.bat. Then go to your main project directory and try again python manage.py runserver. If you still see No module named 'django' make sure that django is installed in this environment try pip install django.

fracz
  • 20,536
  • 18
  • 103
  • 149
Szel
  • 110
  • 1
  • 10