Ask Your Question

WingIDE has problems recognizing variables set with django-environ

asked 2020-11-07 09:40:27 -0600

didierCH's avatar

Hi all, I use django-environ ( on one of my existing Django projects. I developed it outside wing-ide. When I try to import and set up the project in Wing pro 7.2.6 the "secret" variables set in my django-environ file ".env" (see django-environ docs for more information about it) are not recognized. I get the following error message:

 File "/home/didier/Documents/django-project/venv/lib/python3.8/site-packages/django/conf/", line 176, in __init__
  raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")

django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

It seems to me that Wing IDE does not recognize the hidden file and can't read the hidden variables. All that said, when I run the project the "classical" way from the command line it works seamlessly.

I use Python 3.8, Django 2.2 and a virtual environment with venv. It runs on Linux Mint 19.2. Has anybody an idea about it?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-11-07 10:24:52 -0600

didierCH's avatar

Hi folks, I solved the problem. I had to set the DJANGO_SETTINGS_MODULE variable in my projects setting to my development settings. In my case

My settings module looks like this:


So I had to set the project settings in my project configuration of wing-ide to the following:

edit flag offensive delete link more


You might also be able to get Wing to read the .env file by setting Python Executable in Project Properties to Activated Env and specifying that file. However, this assumes that after loading the env 'python' will star the right Python (because that's how virtualenv and conda envs work). I don't know whether or not that assumption would be a problem with django-environ.

Wingware Support's avatar Wingware Support  ( 2020-11-09 08:40:13 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-11-07 09:40:27 -0600

Seen: 382 times

Last updated: Nov 07 '20