Django/Python error. “ImportError: Import by filename is not supported.”

放肆的年华 提交于 2019-12-01 11:05:18

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.

I was facing the same issue in windows. Then later I realised that the problem is with the version of Django installed. I am using python 2.7, and it seems that the import by filename is not supported by it. I believe if you use python 3 , there wont be any problem. So , I installed django 1.6.5 and the solved the problem.

pip install django==1.6.5
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!