#29079: Django settings should not cache user wrapped settings
-------------------------------------+-------------------------------------
     Reporter:  Riccardo Di          |                    Owner:  nobody
  Virgilio                           |
         Type:  Bug                  |                   Status:  new
    Component:  Core (Other)         |                  Version:  1.11
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Adam (Chainz) Johnson):

 Yeah I don't think we should revert as it makes all settings access
 faster, noticeably so, as benchmarked by Instagram.

 You could always set the setting to an object with dynamic behaviour on
 access e.g.

 {{{
 class DefaultFromEmail:
     def __str__(self):
         if settings.ENVIRONMENT == 'production':
             return 'i...@company.com'
         return 'my-personal-em...@gmail.com'

 DEFAULT_FROM_EMAIL = DefaultFromEmail()
 }}}

 Or use the undocumented, but unlikely to change,
 `django.utils.functional.SimpleLazyObject`

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29079#comment:4>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/076.0b6132345c56abfe794630e73bc7d838%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to