#24994: Document/check that settings.SECRET_KEY should be a valid unicode string
-------------------------------------+-------------------------------------
     Reporter:  Baptiste Mispelon    |                    Owner:  MaartenPI
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Core (System         |                  Version:  1.8
  checks)                            |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Aymeric Augustin):

 * status:  closed => new
 * resolution:  needsinfo =>


Comment:

 Once Django drops support for Python 2 you'll have to go out of your way
 to put bytes in the SECRET_KEY.

 Currently, since the type isn't enforced, every app that wants to do
 something with SECRET_KEY should conditionally convert it to bytes,
 typically with `force_bytes`, since it _could_ be bytes. I don't think
 this is common knowledge; it's even a pitfall.

 Enforcing the type would simplify that code and avoid errors for the
 minority who uses bytes in pluggable apps that assume text e.g. by doing
 `settings.SECRET_KEY.encode()`.

 mejiaa has spent a lot of time lobbying for making this change in the
 debug toolbar but his opinion has received little support until now and I
 disagree with them.

--
Ticket URL: <https://code.djangoproject.com/ticket/24994#comment:13>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.6cf63ded8d46ccbe02e45c01ec64425f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to