PyCharm: DJANGO_SETTINGS_MODULE is undefined
I faced the same problem and proposed solutions did not work.
I solved it by going in "File > Settings..."
Then search for "Django console" and add the following Environment variable: DJANGO_SETTINGS_MODULE=mysite.settings
I am using PyCharm IDE and when I run any file.py I get this error:

..raise ImportError("Settings cannot be imported, because environment
  variable %s is undefined." % ENVIRONMENT_VARIABLE) ImportError:
  Settings cannot be imported, because environment variable
  DJANGO_SETTINGS_MODULE is undefined.

How to configure DJANGO_SETTINGS_MODULE environment variable in PyCharm?