[wingide-users] autocompletion

Wingware Support support at wingware.com
Fri Jan 29 10:08:46 MST 2010


Michael P. Soulier wrote:
> On 29/01/10 Wingware Support did say:
> 
>> I don't know that much about Django internals.  How does it end up 
>> finding them?  If there is a main entry point that sets sys.path then 
>> you can set this as the main debug file in Wing IDE and it may 
>> automatically detect the path. If not, you need to manually add them.
>>
>> I somewhat suspect that Django is designed so you simply add the models 
>> directory to the path and then do "import MyAppName" instead. If the 
>> models directory has an __init__.py file in it, then this is the case.
> 
> Yes, each application subdirectory is a python module namespace, but they are
> defined in the main settings.py file. 
> 
> For example, from my settings.py:
> 
> INSTALLED_APPS = (
>     'django.contrib.auth',
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',
>     'django.contrib.admin',
>     'servermanager.lib',
>     'teleworker.advanced',
>     'teleworker.dashboard',
>     'teleworker.icps',
>     'teleworker.clients',
>     'teleworker.metrics',
>     'teleworker.proxies',
>     'teleworker.lib',
>     'teleworker.js',
>     'teleworker.scrc',
>     'teleworker.cluster',
> )
> 
> teleworker is the name of my current project directory, which also has an
> __init__.py in it. One always adds this directory to the PYTHONPATH of the
> hosting web server in one way or another. Through the settings.py file it then
> discovers the rest of the application.

So you will probably need to add them manually in Wing IDE, in project 
properties. To make this easier, set a breakpoint somewhere where the 
path would already have been set up in Django, and use the Debug Probe 
tool to print the Python path and then copy and paste it into your 
project properties. You will need to switch the past display to text 
mode before you can paste.

Note that you can also use environment variables in the Python path in 
project properties, which may make managing this easier.

It would be good to hear from other Django users if there is some better 
way of doing this, and to update the how-to to include more information 
about this.

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list