系统:ubuntu
部署在ubuntu下的fastapi项目由于获取不到系统变量ENV导致判断是在开发环境下运行,
只需要在 /etc/supervisor/supervisord.conf (具体配置文件路径根据自己的来),下的supervisord下加入一行 多个变量以,隔开
environment=自己需要的环境变量名=自己需要的值,xxxx=xxxx
然后配置文件重载一下就行
supervisorctl reload
解决方案引用自: https://stackoverflow.com/questions/12900402/supervisor-and-environment-variables