Thank you.

I thought every function should be documented and nobody realized that this one is not. But if that's not the case maybe one should at least point out to the Python best practice which your just mentioned Adam.

I didn't know that recipe one so far.
But shouldn't almost everyone create another secret key at least once (for production)?

Then it would be great to describe (or link to) a recommend way to do it in the Django Docs, from my point of view.

Am 6/1/2022 um 11:28 AM schrieb 'Adam Johnson' via Django developers (Contributions to Django itself):
Python's secrets module has token_hex and a short recipe for generating random strings: https://docs.python.org/3.10/library/secrets.html#recipes-and-best-practices . I don't think Django needs to provide a public function here. I would advise Digital Ocean to recommend the secrets module.

On Wed, Jun 1, 2022 at 10:22 AM Fab <fabianjarr...@gmail.com> wrote:

    There isn't a recommended way so you can generate it however you
    want. The function is used in the startproject
    
<https://github.com/django/django/blob/0dd29209091280ccf34e07c9468746c396b7778e/django/core/management/commands/startproject.py#L19>
 command
    for convenience.

    On Monday, 16 May 2022 at 13:09:36 UTC+1 Sam wrote:

        In the DigitalOcean documentation
        
<https://docs.digitalocean.com/tutorials/app-deploy-django-app/#setting-the-secret-key>
        I just found that they use
        `from django.core.management.utils import get_random_secret_key`
        to generate a new, unique secret key.

        I didn't know that there was such a function.
        and the get_random_secret_key function seems to be not
        documented so far
        <https://docs.djangoproject.com/en/4.0/ref/utils/>.

        Is this the recommended way to generate secret keys for Django
        apps?
        If that's the case wouldn't it make sense to write a piece of
        documentation for that?

        Kind regards,
        Samuel✌

-- You received this message because you are subscribed to the Google
    Groups "Django developers (Contributions to Django itself)" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to django-developers+unsubscr...@googlegroups.com.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/django-developers/b2018ec8-0cc0-475e-8ede-81f10c1e193bn%40googlegroups.com
    
<https://groups.google.com/d/msgid/django-developers/b2018ec8-0cc0-475e-8ede-81f10c1e193bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to a topic in the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-developers/0nHdj8X_v6Y/unsubscribe. To unsubscribe from this group and all its topics, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM2TiTctT9uEL1gvy%3DGo8NfoYmYBUsuOx0LtS5TGgAKdAg%40mail.gmail.com <https://groups.google.com/d/msgid/django-developers/CAMyDDM2TiTctT9uEL1gvy%3DGo8NfoYmYBUsuOx0LtS5TGgAKdAg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/30ec37e4-9fca-1548-c474-fff6f8ce0515%40gmail.com.
  • get... Sam
    • ... Fab
      • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
        • ... epokeins

Reply via email to