"Can't find the file 'settings.py' in the directory containing 'manage.py'" after upgrade to 2.5.1 today


I use custom settings.py files for all my Django 1.3.1 projects, and it has been working fine until today. After the upgrade to PyCharm 2.5.1, it seems PyCharm is not being able to "find" my settings.py, even though it is specified in the "Additional options" of the configuration.

Error: Can't find the file 'settings.py' in the directory containing 'manage.py'. It appears you've customized things.

You'll have to run django-admin.py, passing it your settings module.

(If the file settings.py does indeed exist, it's causing an ImportError somehow.)

If I give the exact same command I see PyCharm is trying to use, but directly on the command line, it does work:

/path/to/my/virtualenv/bin/python manage.py runserver 8000 --settings=settings_rubens

Is anybody else experimenting problems like this?



Comment actions Permalink

OK, I found the problem...

It seems the new PyCharm is chocking on an 'import myproject' directive that I had to use in my settings.py exactly to hack the older versions of the PyCharm debugger.

The command below has a different outcome depending on wether I'm running the debugger or not:

in /a/b/c/settings.py:

project_dir = os.path.dirname(__file__)

Normal run mode:  --> project_dir = '/a/b/c'

Debugger mode:    --> project_dir = ''

To circumvent this difference, I was using:
import myproject

project_dir = os.path.dirname(myproject.__file__)

It seems this worked fine with previous versions of PyCharm, but now this 'import' crashes the debugger. I've found another way to get what I needed...
Comment actions Permalink

Hi Rubens,

thank you for reporting the problem. Difference in project_dir will be fixed as soon as possible.


Please sign in to leave a comment.