我使用环境变量来传递设置文件:
app.config.from_envvar('DVR_SETTINGS')
它在我的开发系统上工作正常但是当我尝试在嵌入式Linux系统(arago)上部署这个东西时,我得到了这个:
RuntimeError: The environment variable 'DVR_SETTINGS' is not set and as such configuration could not be loaded.
Set this variable and make it point to a configuration file
但我已经做到了:
root@dm365-evm:/var/www/dvr# echo $DVR_SETTINGS
/var/www/dvr/settings/production.py
答案 0 :(得分:3)
您需要导出环境变量:
export DVR_SETTINGS
您可以将设置和导出组合在一行中:
export DVR_SETTINGS=/var/www/dvr/settings/production.py
或者你可以将它放在运行Flask服务器的行上:
DVR_SETTINGS=/var/www/dvr/settings/production.py python flask_script.py
答案 1 :(得分:0)
在OS窗口中,您需要导出环境变量: