从 django 1.9 升级到 1.11 破坏了 crossbar guest worker

upgrading from django 1.9 to 1.11 broke crossbar guest worker

从 django 1.9.6 升级到 1.11.11 后,由于未找到 DJANGO_SETTINGS_MODULE ("simpl_calc_model.settings" ).

{
    "type": "guest",
    "executable": "django-admin",
    "arguments": ["run_guest"],
    "options": {
        "workdir": "..",
        "env": {
            "vars": {
                "HOSTNAME": "localhost",
                "PORT": "8080"
            }
        }
    }
}

我运行正在使用包含 simpl_calc_model 目录的项目中的管理命令对此配置进行交叉。我可以像这样直接在这个项目中 运行 来宾工作者:

./manage.py run_guest --settings=simpl_calc_model.settings

如何确保 django-admin 1.11.11 在通过我的管理命令从 crossbar 调用时可以找到设置模块?

错误日志如下所示:

Traceback (most recent call last):
File " ~/.virtualenvs/simpl-calc-model/bin/django-admin", line 11, in <module>
sys.exit(execute_from_command_line())
File " ~/.virtualenvs/simpl-calc-model/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File " ~/.virtualenvs/simpl-calc-model/lib/python3.6/site-packages/django/core/management/__init__.py", line 308, in execute
settings.INSTALLED_APPS
File " ~/.virtualenvs/simpl-calc-model/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File " ~/.virtualenvs/simpl-calc-model/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File " ~/.virtualenvs/simpl-calc-model/lib/python3.6/site-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File " ~/.virtualenvs/simpl-calc-model/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'simpl_calc_model'  

通过实施 Alasdair 的建议并删除 workdir 解决了问题:

{
    "type": "guest",
    "executable": "manage.py",
    "arguments": ["run_guest"],
    "options": {
        "env": {
            "vars": {
                "HOSTNAME": "localhost",
                "PORT": "8080"
            }
        }
    }
}