[Answered ]-Nginx + uwsgi + Django does not use environment variables set in venv activate script

1๐Ÿ‘

A simple fix for the credentials stuff I did is below:

with open('credentials.txt', 'r') as credentials:
    for lines in credentials.read().split('\n'):
        dbcreden.append(lines.strip())
DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': dbcreden[0],
    'USER':dbcreden[1],
    'PASS':dbcreden[2],
    'HOST':'localhost',
    'PORT': '3306'
    }
}

And for the secret key something similar:

with open('secretkey.txt') as f:
    SECRET_KEY = f.read().strip()

This is also advised in the official django docs, so it should be secure.

https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

๐Ÿ‘คmesmerlord

Leave a comment