This project has moved and is read-only. For the latest updates, please go here.

Django: Intellisense not detecting app folders

Jul 22, 2014 at 9:06 PM
I have added all my django apps in a package apps, and I added this folder to sys.path in
now I have imported apps as import app1, app2 which are present in apps package. But Intellisense not detecting these imports and showing unable to resolve "app1", intellisense may be missing for the module \n app1: <unknown type>
Jul 22, 2014 at 9:14 PM
We don't run any Python code when resolving modules, so we won't recognize paths added to sys.path in code.

I suspect you have an file at the top of your project, so normal Python import rules mean you need to write import MyProject.app1 rather than just "app1". However, we know that Django has some logic to change this at runtime, so we're considering ways we can work around it.

Removing the unnecessary file generally works, though it may cause issues with other modules that try to import your apps.
Jul 22, 2014 at 9:22 PM
Isn't there any option for adding package to python module paths just like eclipse have? So i can add my apps folder in that path and intellisense detect that.
Jul 22, 2014 at 9:24 PM
We have Search Paths in Solution Explorer for your project where you can add the path. When you run/debug the project through VS this will automatically set PYTHONPATH as well.

But my main point was that we're aware of this issue with Django and we're looking for a way to save people from having to do anything to fix it :)
Jul 22, 2014 at 9:27 PM
I tried adding apps folder in search path. But that ain't working :( intellisense is showing same error.
Jul 22, 2014 at 10:05 PM
You're right, we don't handle having the same modules added multiple times into the analyzer. I'm working on it now.
Jul 23, 2014 at 12:40 AM
And now we do handle it. 2.1 RC (or the next dev build) will understand how to handle search paths within the project structure properly.