This is especially useful when testing, since test runners (eg. pytest-
django) often configure the framework by themselves, before the end user
can patch it with mockups and other early-time tweaks.
--
Ticket URL: <https://code.djangoproject.com/ticket/30536>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by pascal chambon):
Pending PR on https://github.com/django/django/pull/11435.
--
Ticket URL: <https://code.djangoproject.com/ticket/30536#comment:1>
* status: new => closed
* resolution: => duplicate
Comment:
Hi Pascal. I'm going to close this as a Duplicate of #28752. Let's keep
the discussion there. Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/30536#comment:2>
* status: closed => new
* needs_better_patch: 0 => 1
* resolution: duplicate =>
Comment:
Looking at the PR, I've re-titled this reopened it, since I could see
#28752 being accepted separately a resolution here. Can you please split
the PR into two along those lines? Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/30536#comment:3>
* stage: Unreviewed => Accepted
Comment:
OK, I'm going to provisionally accept this.
Two use-cases seem desirable:
1. The testing example, of setting up mocks etc.
2. If #28752 were in place, having a ''project-level'' hook for Do-this-
Once setup logic might solve issues that app-level `ready()` handlers
can't.
I'm not sure about the proposed implementation. I'll ask others to review.
(Maybe we have to say `wontfix`, and stick with monkey patching `setup()`
if needs be...)
--
Ticket URL: <https://code.djangoproject.com/ticket/30536#comment:4>
Comment (by pascal chambon):
Ok the PR is pending for #28752 B-)
--
Ticket URL: <https://code.djangoproject.com/ticket/30536#comment:5>
Comment (by Florian Apolloner):
Replying to [comment:4 Carlton Gibson]:
> I'm not sure about the proposed implementation. I'll ask others to
review.
Same here, my comment from the PR:
Personally I feel that this fix is happening at the wrong level. An
environment variable (Or even as keyword argument to ''setup'' itself)
feels more suitable, after all ''setup'' is the thing that reads your
settings in the first place.
I think this might be something that could/should be discussed on the
mailing list?
--
Ticket URL: <https://code.djangoproject.com/ticket/30536#comment:6>
* status: new => closed
* resolution: => wontfix
Comment:
Given #28752 and the concerns raised, I'm going to say `wontfix` here.
It's easy enough to adjust an entry point script (canonically `wsgi.py`,
but whatever is in play) to run custom logic at start up.
IMO That's always going to come out cleaner than adding a settings powered
hook in here.
--
Ticket URL: <https://code.djangoproject.com/ticket/30536#comment:7>