#32451: Management command to securely generate a secret key
-----------------------------------------+------------------------
               Reporter:  RealOrangeOne  |          Owner:  nobody
                   Type:  New feature    |         Status:  new
              Component:  Uncategorized  |        Version:  3.1
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 Django's `startproject` command does generate a secret key for you in a
 secure way for your newly created Django project. But it's good practice
 to have a different key for each environment, whether that be development,
 staging or production. Therefore, there's a need to generate one after a
 project has been setup, when you're creating a new environment or starting
 a project from something other than `startproject`. The method used to
 generate (`get_random_secret_key`) seems to be undocumented, and yet its
 implementation details are rather important (the fact it's not just
 `random.choice`).

 I recently wrote (https://github.com/RealOrangeOne/django-secret-key-
 generator) a web app to generate a `SECRET_KEY` in a similarly secure way
 (more secure than the other ones out there), but it'd be great to have a
 simple management command to securely generate a key (using the existing
 `get_random_secret_key` util) so it could be easily set in a project, and
 thus share the original implementation.

 Does this (management command + documenting `get_random_secret_key`) sound
 like a good idea? I'm happy to submit a patch myself.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32451>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.467223164dd0917cded945aea7befdf8%40djangoproject.com.

Reply via email to