unable to set custom settings file

Hello guys,

I would like to use a custom settings file during my development. What I am using is described here: http://toastdriven.com/blog/2010/jan/05/better-local-settings/

Thus to be able to utilize this approach, I need to specify a --settings option or define DJANGO_SETTINGS_MODULE environment variable. I didn't fine a way to specify --settings option. I have tried to define DJANGO_SETTINGS_MODULE "Edit Configurations" and added it to Environment variables section, but it doesn't seem to take effect.

When I run the django I just get the regular settings:

Django version 1.3, using settings 'project.settings'

Even though I have set the DJANGO_SETTINGS_MODULE to project.settings_local' value. Any idea what may be going on?

I am using the latest EAP build.

Thanks!

5 comments
Comment actions Permalink

OK I also found the way to specify it in the Django Support in the Project Settings, where I changed the Settings: value, but that didn't work....weird.

0
Comment actions Permalink

Hi Dan!

Django manage.py overwrites DJANGO_SETTINGS_MODULE environment variable, so the are two ways to use your custom settings: fix manage.py or, which is more convenient, specify --settings option.

In PyCharm you can specify --settings option in the 'Additional options' field of Django server run configuration dialog.

--

Dmitry

0
Comment actions Permalink

Settings option in Django support panel tells PyCharm which settings.py it should use to perform static analysis of your project and doesn't affect run of Django server (only your manage.py and --settings option do).

--

Best regards,

Dmitry

0
Comment actions Permalink

Hello Dmitry,

that worked, thank you!

0
Comment actions Permalink

Hello Dmitry,

I am sorry to hijack this thread, but I recently installed latest EAP build on Ubuntu linux.

When I try to start the development server, I see this in the console:

/home/danger/.virtualenvs/venv-dev/bin/python manage.py runserver 8080 --settings=proj.settings_dev

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.

Process finished with exit code 1

It seems like --settings is getting passed correctly, but is not handled.

Any idea what's going on?

Thanks

0

Please sign in to leave a comment.