'Unresolved references' - how to add libraries?
Hi,
Django is intentionally not on my path - I use sys.path.insert(0,'/path/to/django') as a hacky substitute for virtualenv ;-)
For PyCharm to be any use I need some way to tell it this so it can resolve references. Can this to be done?
Please sign in to leave a comment.
Hello Andy,
Right now you can go to Settings | Project Structure and add the folder with
your Django installation as a content root to your project.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
That helped.
I also had to add my project folder explicitly as adding the parent caused lots of unresolved references.
There still are lots of spurious unresolved references though.
It balks at:
1. 'from django.conf import settings' PyCharm can't resolve any of my settings. I know this one is tricky as it's dynamically loading settings but it needs to be special-cased at the very least.
2. 'self.cleaned_data' on a subclass of forms.ModelForm
3. 'SomeModel.objects' says that objects is unresolved
and a bunch of other stuff (model object methods added by Django MPTT and other dynamic methods)
Hello Andy,
This is a known issue:
http://youtrack.jetbrains.net/issue/PY-563
Could you please file a YouTrack issue for that? We don't yet have any special
support for Django forms.
This should work in the latest PyCharm build, but maybe there's something
special in your case that breaks it.
YouTrack issues for any problems you find are very much welcome.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Thanks for the response. I'll update PyCharm and file any remaining issues as bug reports.