[英]How to store env variables other than inside gunicorn.service for a Django project?
I tried putting all my environment variables for my Django project inside ~/.bash_profile
and then use it in gunicorn.service with EnvironmentFile=/home/user/.bas...
but with no luck. 我尝试将我的Django项目的所有环境变量都放入
~/.bash_profile
,然后在带有EnvironmentFile=/home/user/.bas...
gunicorn.service中使用它,但是没有运气。 Eventually I had to put everything in ExecStart
with -e
in front of every variable, also with SECRET_KEY and everything in plain text. 最终,我必须将所有内容放在
ExecStart
,将-e
放在每个变量的前面,还必须将SECRET_KEY和所有内容都以纯文本格式放置。 Is it safe, is it possible to access this externally or how else could I do this? 安全吗?是否可以从外部访问它?或者我还能怎么做?
您可以使用.env
文件和python-dotenv包来处理变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.