#28752: django.setup() should not be runnable multiple times
--------------------------------+--------------------------------------
Reporter: pascal chambon | Owner: nobody
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 pascal chambon):
OK I think my vocabulary was wrong, it's not (really) an idempotence
problem, since django.setup() does more or less the same things on both
calls (just skipping apps population phase on the second).
It's not a reentrancy problem, i.e not a problem with multiple threads (or
signal interrupts) entering django.setup() concurrently.
It's really just a problem of "multiple successive calls of
django.setup()", which are doing silent errors and weird modifications,
simply because only the first call of django.setup() makes sense.
Raising an exception on subsequent calls would be a possibility, but it
would be a useless hassle, since users just want is to ensure that django
was initialized at some point.
That's why I propose we just do a no-op on subsequent calls to
django.setup().
(By teh way I don't understand your statement about the "django.setup =
lambda: None" snippet - it was just a quick and dirty hack to prevent the
multiple runs of django.setup(), which broke the LOGGING config)
--
Ticket URL: <https://code.djangoproject.com/ticket/28752#comment:11>
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/063.38ac0044071c1d2077b7d55b7afe94d3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.