On Sat, Apr 13, 2013 at 11:53 PM, Pakal <[email protected]> wrote:
> Hello, > > since version 1.2, there has been no changes about this issue, which still > bothers me: > https://code.djangoproject.com/ticket/14916 > > In summary, the django dev server loads models.py of every INSTALLED_APP, > and thus (somehow) ensures proper initialization of models and signals. > > But in production, web servers do NOT load more than the strict minimum > required by the requests they serve, so it opens the door to very subtle > and deadly bugs, where the first requests of every new django process might > miss a good part of the whole workflow, because miscellaneous "hooks" have > not been registered properly. > Doesn't this advocate a global import of all installed_apps' models.py, at > process setup ? > > And more generally, people have no idea where to put their django setup > code, so there are tons of forum threads and workarounds about this, using > mod_wsgi's start script, or code in urls.py/settings.py, or even > dedicated on-shot middelwares ( > http://www.allbuttonspressed.com/projects/django-autoload). > Wouldn't it be worth offering a place, in a project and/or in each django > app, which will be called AFTER all models/signals are initialized, but > BEFORE the first request is served ? Same behaviour as the "fake > middleware" trick, but without its ugliness. > The reason there hasn't been any update to ticket #14916 is that it has been closed as a duplicate of #3591. Which it is. The ticket title may not make this obvious, but if you read the full ticket history and/or search for #3591 on mailing lists, you'll quickly find mention of an "app refactor". The purpose of the app refactor is to provide a wrapper object that can encompass application-specific configuration -- including things like application startup logic and signal registration -- and to provide a guaranteed and consistent order for startup. There are some draft patches floating around for the app refector; as I understand it, the code was *almost* ready to be merged for 1.5, but there were some last minute concerns, so it was postponed. I don't think there have been any major discussion since then. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" 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]. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
