| 22 | -- here are some updates, comments get rejected as spam -- |
| 23 | |
| 24 | |
| 25 | |
| 26 | Calling 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 | |
| 28 | These "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 | |
| 30 | Users 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 | |