django无法导入设置

时间:2013-12-29 21:34:10

标签: python django pycharm

我曾经写过一个名为superlists的django应用,设置在superlists.settings。这是为了教程,我正在改变不同的设置,很少意识到我在做什么。 现在当我开始新的django项目时 - 它告诉我它无法导入superlists.settings

我重新安装了Pycharm,django,python(版本2.7和3.3),删除了所有虚拟环境,删除了可能多次连接到它的所有内容......它仍在那里!在一个新的,干净的python版本,甚至没有django - DJANGO_SETTINGS_MODULE sys.path指向superlists.settings。干净的每个新项目,默认设置,pycharm版本,告诉我它无法导入superlists.settings

我从{cmd}中的DJANGO_SETTINGS_MODULE删除指向该设置的sys.path - 然后再次观看 - 在那里。

需要它的地方?我不知道。 这是追溯:

Traceback (most recent call last):
File "D:/Python27/Lib/site-packages/django/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "D:\Python27\Lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "D:\Python27\Lib\site-packages\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\Python27\Lib\site-packages\django\core\management\__init__.py", line 261, in fetch_command
commands = get_commands()
File "D:\Python27\Lib\site-packages\django\core\management\__init__.py", line 107, in get_commands
apps = settings.INSTALLED_APPS
File "D:\Python27\Lib\site-packages\django\conf\__init__.py", line 54, in __getattr__
self._setup(name)
File "D:\Python27\Lib\site-packages\django\conf\__init__.py", line 49, in _setup
self._wrapped = Settings(settings_module)
File "D:\Python27\Lib\site-packages\django\conf\__init__.py", line 132, in __init__
% (self.SETTINGS_MODULE, e)
ImportError: Could not import settings 'superlists\settings.py' (Is it on sys.path? Is there an import error in the settings file?): Import by filename is not supported.

2 个答案:

答案 0 :(得分:0)

原来我创建了新的环境系统变量DJANGO_SETTINGS_MODULE。如此明显,但它几乎让我感到理智。

答案 1 :(得分:0)

更改环境变量

"error": { "code": "ResourceNotFound", "message": "Resource not found.", "innerError": { "request-id": "1b589c8b-1f65-4cf5-8429-5917cd6695f2", "date": "2017-02-14T20:13:08" }

GET /v1.0/me/drive/items/{id} Authorization: Bearer {token}

或在超级列表中使用DJANGO_SETTINGS_MODULE=superlist.superlist.settings