Wrong path with new release

Hey Guys,

I really don't know what's going on with the latest release of PyCharm. I come back to my Django project after working on it the last time in September, and now the path-setting to my django project (which I had to set up again) is screwed up.

Well, okay my directory-structure is like this, (and always has been):

  • p4rsrv
    • src
      • manage.py
      • ...
      • p4rsrv
        • settings.py

So, I set up my Django settings like you see in the image. The settings immediately acknowledge that there is a manage.py, and everything should be fine. Except that nothing works really.

When I want to start the server I get (just the beginning and end of the output):
Traceback (most recent call last):
  File "/Applications/PyCharm.app/helpers/pycharm/django_manage.py", line 21, in <module>
   raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'src.p4rsrv.settings' (Is it on sys.path?): No module named src.p4rsrv.settings

So, evidently the wrong manage.py is executed. This drives me crazy, I changed the Django settings a hundred times and do not know what's the problem here. Please help me.
On a side note: It really annoys me that I have to go through all this setup stuff again because of a new release of PyCharm.
Comment actions Permalink
Please make sure that the "src" directory is marked as a source root in Settings | Project Structure. Note that, as long as you keep the .idea directory, you won't need to configure the project again.
Comment actions Permalink
Okay, this worked, thanks!
Maybe I deleted that .idea directory, so mea culpa.
But nonetheless, why did this not work? The paths to the manage.py and settings are explicitely defined, and since PyCharm can call a far more remote manage.py (it's own bundle one, that is) it's strange that it cannot handle those files.

Your support is, as always, ridiculously fast and helpful.
Thank you!
Comment actions Permalink
To import your manage.py module, we need not its path but rather its module name relative to PYTHONPATH. If the PYTHONPATH is not configured correctly, the module name is also calculated incorrectly.
Comment actions Permalink
Okay, got it. Thank you!

Please sign in to leave a comment.