#23621: Module autoreloading doesn't work due to some checks while loading an
app
-------------------------------+--------------------------------------
Reporter: pashinin | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7
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 carljm):
I don't like vague FUDy arguments against fixing a regression. Reloading a
models module worked in previous versions of Django (to the same extent
that it ever works in Python), and I think if we are going to explicitly
disallow it starting with Django 1.7 we should at the very least be able
to give sound and specific reasons.
The general problem with module reloading in Python is that other modules
may (and probably do) still have references to classes or functions from
the old, not-reloaded version of the module. And that is quite likely with
Django - for instance if there are FK references to or from the reloaded
model, there will be related-objects and `_meta` modules still holding
references to the old version of the model, and that could cause all kinds
of strange behavior.
But there are simple cases where it _doesn't_ break and makes life much
more convenient, i.e. when doing rapid iteration and interactive shell
testing of a single module, without involving any other modules. I'm
guessing this is the OP's use case. So it seems to me that Django could
continue to "support" module reloading to the same extent Python does:
it's possible, but in non-triviel cases it's likely to break, and when it
breaks you get to keep all the pieces.
On the other hand, it won't bother me too much if we just say "sorry,
module reloading is too likely to cause obscure bugs, just don't do it".
So I guess I'm +0.
--
Ticket URL: <https://code.djangoproject.com/ticket/23621#comment:5>
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/066.e48c1cd1c9edaa397ecc58811d1a214d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.