我正在尝试在高山 Linux 上安装最新版本的 Ansible Records Analyzer 服务器,我确保所有要求都已正确安装(Django、GCC、python3、Pypi、ansible),安装一切顺利,除了关于 PATH 变量上缺少根 PATH 的警告,我已修复此问题:警告:
WARNING: The script pbr is installed in '/root/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
修复:
~ # export PATH=/root/.local/bin:$PATH
因此安装完成后指导在此打算运行服务器的步骤中,我遇到了大量错误,就好像运行命令找不到要执行的所需组件一样,尽管我确信所有组件都已安装:
~ # ara-manage runserver
[ara] No setting found for SECRET_KEY. Generating a random key...
Traceback (most recent call last):
File "/root/.local/bin/ara-manage", line 8, in <module>
sys.exit(main())
File "/root/.local/lib/python3.8/site-packages/ara/server/__main__.py", line 41, in main
if not os.path.exists(settings.ARA_SETTINGS):
File "/root/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 79, in __getattr__
self._setup(name)
File "/root/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "/root/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/root/.local/lib/python3.8/site-packages/ara/server/settings.py", line 263, in <module>
ALLOWED_HOSTS=ALLOWED_HOSTS.to_list(),
AttributeError: 'list' object has no attribute 'to_list'
这种行为背后的原因是什么?
答案1
好吧,我设法克服了这个问题,问题出在 dynaconf 中,当前版本 3.1.3 不能正确读取 conf 文件,导致服务器运行失败。
同时,唯一的解决方法是安装以前版本的 dynaconf :
pip install 'dynaconf==3.1.2'
供您参考,dynaconf 已经针对回归提出了修复方案:rochacbruno/dynaconf#541
我已经测试过它确实解决了这个问题并且它将很快在 dynaconf 3.1.4 中发布。