Friday, September 25, 2020

Re: Storing secret keys in Django

Hi Theresa,

On 25/09/2020 23.00, Theresa Taye wrote:
> Hello guys,
> Please can anyone help with the best way to store/hide secret key in
> django and if possible share a link to a straight forward YouTube tutorial.

There's rarely a "best way", since use cases differ and people tend to
have different preferences, but I personally use django-configurations:

And then use an environment variable for my secret key which is set in
the service file I use for starting my Django UWSGI application in

Using django-configurations has the added benefit that I can easily have
different configurations in development and production and the secret
key is more or less the only thing I don't keep in revision control (git).

Of course, not sure if that's the "best way", but it's one way at least :-)

Kind regards,

Kasper Laudrup

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 view this discussion on the web visit

No comments:

Post a Comment