#26152: django.setup() hangs django if ever used in a module that's imported by 
an
app
--------------------------------------+------------------------------------
     Reporter:  hjwp                  |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Documentation         |                  Version:  1.9
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by hjwp):

 Hi Aymeric,  there's a couple of ways I can think of that would detect
 cycles and then a couple of things we could do with it:

 detect options:
 - import the traceback module and examine the call stack for a previous
 call to django.setup()
 - set some global variable in the module, _setup_called = True, or
 whatever it may be.  (there is already a class variable called .ready,
 which is set to true at the end of the apps.populate() call.  So maybe we
 could just add a second class variable that's set at the beginning)

 what to do:
 - raise an exception
 - or, just an early return.  Maybe setup() should just be idempotent

--
Ticket URL: <https://code.djangoproject.com/ticket/26152#comment:8>
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/062.759e505ebdde51955046e3f20820c02d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to