1

I'm trying to get a Django project working with PTVS. The only reason I'm using it is because I have Azure credits and want to deploy there. In Visual Studio, I go to New Project > Python > Django. I chose "Add Virtual Environment". Here is the screenshot:

enter image description here

After the project is created, this is my solution explorer: enter image description here

You can see django is definitely installed in the environment. But when I right-click on the app and go to Python > Sync DB, I get a bunch of errors says that ImportError: No module named django.core.management. All the django package statements are underlined and they can't be imported. Any ideas?

When I go back to create another project and I do "Install into Python 2.7 directory," it works fine. So I don't understand why I can't use the virtual environment.

Pavel Minaev
  • 99,783
  • 25
  • 219
  • 289
cheenbabes
  • 382
  • 1
  • 8
  • 17

1 Answers1

-1
  • Go to your Projects folder and delete all the application/projects. Clean the project directory. (By default this is the PATH: Documents/Visual Studio 2013/Projects
  • Close all the other IDE's and Programs that might be using your python interpreter.
  • Set no-proxy in case you are using some proxy settings because it will prevent Visual Studio from downloading and installing the required packages.

You might prefer restarting your machine before performing these steps. It worked for me. I had the same problem. Below are two useful tutorials to walk you through the entire process.

PTVS 2.0 Beta: Creating a Django Website : A step by step guide

Django and MySQL on Azure with Python Tools 2.1 for Visual Studio

caped114
  • 735
  • 11
  • 11