Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从模块化django设置文件导入错误_Python_Django_Django Settings - Fatal编程技术网

Python 从模块化django设置文件导入错误

Python 从模块化django设置文件导入错误,python,django,django-settings,Python,Django,Django Settings,我正在尝试创建一个模块化设置文件 为什么这样做有效: project/ settings.py other.py 使用settings.py中的此行 config_module = __import__('other', globals(), locals()) 虽然以下情况引起了一种严重的恐惧: project/ settings.py config/ other.py 使用settings.py中的此行: config_module = __import__('

我正在尝试创建一个模块化设置文件

为什么这样做有效:

project/
  settings.py
  other.py
使用settings.py中的此行

config_module = __import__('other', globals(), locals())
虽然以下情况引起了一种严重的恐惧:

project/
  settings.py
  config/
    other.py
使用settings.py中的此行:

config_module = __import__('config.other', globals(), locals())

看起来您的配置目录缺少一个
\uuuu init\uuuu.py
文件,以明确您希望将其视为一个模块。
\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuupy
文件可以为空,但它必须存在。

配置目录中是否缺少
\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuupy