Pythonpath issues w Screenshots

Hey, I just bought PyCharm a few weeks ago and everything was working like charm (im a novice django/python user)... Today I attempted a tutorial by james benett discussing how to work with stand-alone apps and I stumbled on some issues..

Im on Mac OSX with python 2.6 (framework built):

I have my  projects at /Users/me/DjangoProjects/{someproject}

Usually I would create a new project and run manage.py to add some 'in-project' apps.. This was working fine, however I don't remember how I added my project path to the python path initially (I remember somehow I did).. so here's my situation:

Everything was working fine on the command line (terminal) and after buying PyCharm it was still working fine, now today, for this tutorial, I wanted my standalone apps to be located at:

/Users/me/DjangoApps/{someapp}

So I had to add this location to the Pythonpath to make my projects aware where they live.. hence I forgot how I made my project location aware in the past I googled some and found three options:

- commandline: export PYTHONPATH:$ etc etc think this is what i used before but frankly im not sure

- shell: import sys, sys.path.append('/my/locations') seems like a lot of repetitive work

- putting sitecustomize.py in /lib/python/2.6/site-packages/ seems not the way to go

Current situation

Well after some attempts to change the python path I have a serious error now:

If I create a brand new (django) project in pycharm it runs.. but if I add an app now for every view I write I don't get suggestions for my import statements anymore... whether this app lives inside my project (manage.py startapp) or is created externally.. it's broken..

For instance if I write a statement in an empty views.py file (or any other python file inside the app) like this:

from django.http import HttpRequest

.http isn't suggested anymore, neither is HttpRequest, this part is even underlined with gray zigzags saying there is no reference.. yet right clicking it "go to declaration" DOES send me to the module however ALL text in that module is white (instead of color markup)..

I think django was kicked (partically) of my python path???

Please tell me how to include both locations properly into my python path again...:

/Users/me/DjangoProjects

/Users/me/DjangoApps

Thanks !!

p.s. I don't want my apps to go into my standard external  libraries, but only in the projects I choose..

SCREENSHOTS

http://www.xs4all.nl/~rvdheide/error.jpg

http://www.xs4all.nl/~rvdheide/error-libs.jpghttp://www.xs4all.nl/~rvdheide/error-int.jpg

2 comments

Same issue, same tutorial, I got a quick (broken…) solution. In the project settings (cmd+,) I added the path[1] to the interpreter. It worked for importing the module and its Class, but running syncdb from within PyCharm failed as above.

I found on this forum a solution by adding a PYTHONPATH variable in Run.Edit_Configurations.Defaults.Python.Environment_variables.[…] where you can add the path but I still didn't test it.

Is there anyone on PyCharm support that can help us? I also sent a support request to PyCharm guys, hopefully they will answer us.

Feature request: It would be nice to make PyCharm parse .bash_profile file or get sys.path from the interpreter automatically.

[1] I also previously added it to my .bash_profile with "export PYTHONPATH=$HOME/Dropbox/python/modules/" but with no luck. Python recognized it, while PyCharm not.

0

Please sign in to leave a comment.