Monday, September 29, 2014

Re: Config: DB or git?

Den 29/09/2014 kl. 16.11 skrev Derek <>:
> So is it possible to store encrypted database passwords in the Django settings (or local_settings) file?

Yes. A simple solution would be to use a symmetric encryption like simple-crypt to encrypt and decrypt your passwords using a key that you provide externally. Here's a quick example:

import simplecrypt

SECRET_KEY = 'my_secret_key' # Get this from a file, enter it manually or by other sufficiently secure means

# Example code to generate the encrypred password
my_password = 'super_secret'
my_encrypted_password = simplecrypt.encrypt(SECRET_KEY, text)

# This is what you put in
my_encrypted_password = 'KLJJ543#EURO%'
my_password = simplecrypt.decrypt(SECRET_KEY, my_encrypted_password)


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment