Monday, September 29, 2014

Re: Config: DB or git?

Den 29/09/2014 kl. 16.11 skrev Derek <gamesbook@gmail.com>:
>
> 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 settings.py
my_encrypted_password = 'KLJJ543#EURO%'
my_password = simplecrypt.decrypt(SECRET_KEY, my_encrypted_password)


Erik

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/530E0223-7AC1-411C-ADA0-34F581B6ED1E%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment