Storing secret keys in Django

44 views
Skip to first unread message

Theresa Taye

unread,
Sep 25, 2020, 5:01:45 PM9/25/20
to django...@googlegroups.com

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.

Thanks in anticipation

Kasper Laudrup

unread,
Sep 25, 2020, 5:47:50 PM9/25/20
to django...@googlegroups.com
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:

https://github.com/jazzband/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
production.

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

Theresa Taye

unread,
Sep 25, 2020, 6:04:19 PM9/25/20
to django...@googlegroups.com

Thank you Kasper
I appreciate this

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f6f938b0-7a9e-a635-cead-ae38a10e835c%40stacktrace.dk.
Reply all
Reply to author
Forward
0 new messages