I am using a virtual machine on Google Cloud with Ubuntu as the operating system, and I have deployed a Django backend on it. In my settings.py
, I use environment variables like this:
EMAIL_HOST_USER = env('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
I would like to know how to properly set environment variables on the VM so that my Django application can access them. Specifically:
Any best practices for securely managing these environment variables in a Google Cloud VM would be appreciated. Thanks!
If you have secrets, keep them secret! You can use Secret Manager for this. And then, read your secret at runtime instead of putting it in plain text in your VM configuration.
You have different option for this: