Django / Python error. & Ldquo; ImportError: Import by filename is not supported. & Rdquo;


I wanted to install Django and have troubles with the import error. I read this topic, but the answer didn't help here. Nothing happend after I changed the env variables to the module path.

Traceback (most recent call last):
  File "C:\Python27\Scripts\", line 5, in <module>
  File "C:\Python27\lib\site-packages\django\core\management\", line 350, in execute_from_command_line
  File "C:\Python27\lib\site-packages\django\core\management\", line 302, in execute
  File "C:\Python27\lib\site-packages\django\conf\", line 55, in __getattr__
  File "C:\Python27\lib\site-packages\django\conf\", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "C:\Python27\lib\site-packages\django\conf\", line 99, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "C:\Python27\lib\importlib\", line 37, in import_module
ImportError: Import by filename is not supported.

DJANGO_SETTINGS_MODULE shouldn't be system path to settings file (or directory). It should be an python path to your settings file. So first, make sure that your project is in PYTHONPATH or you are inside project directory, then set correct DJANGO_SETTINGS_MODULE and after that, run your django-admin command.

You can also clean DJANGO_SETTINGS_MODULE variable if command that you're trying to issue is not related with existing django project.