Changes between Version 5 and Version 6 of Ticket #28752


Ignore:
Timestamp:
Oct 30, 2017, 2:34:16 PM (7 years ago)
Author:
pascal chambon
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28752 – Description

    v5 v6  
    2020
    2121
     22-- here are some updates, comments get rejected as spam --
     23
     24
     25
     26Calling django.setup() multiple times is useless, BUT it can happen in lots of cases, that's why imho this case should be handled by the framework to avoid nasty side effects.
     27
     28These "duplicate calls" often involve the collision between manage.py commands, tests, custom scripts, and external launchers like pytest-django. Plus maybe some corner cases when unittest-style TestCases and pytest-style test functions are mixed in the same project.
     29
     30Users have to do a real gym to call setup() "at some moment" in all these use cases, yet try to prevent multiple calls of this initialization step (like the 'if__name__ == "main"' protection). So far my only way out was often to check for (not really undocumented) states of the framework before calling setup().
     31
     32
     33
Back to Top