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. Eventually I had to put everything in ExecStart
with -e
in front of every variable, also with SECRET_KEY and everything in plain text. Is it safe, is it possible to access this externally or how else could I do this?
您可以使用.env
文件和python-dotenv包来处理变量。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.