[1.7.x] Fixed #22688 -- Documented ready() may be called more than once

Backport of b8fc167b32 from master.
This commit is contained in:
Claude Paroz 2014-05-24 15:57:04 +02:00
parent a59870e217
commit dbdbda87fc
1 changed files with 9 additions and 0 deletions

View File

@ -238,6 +238,15 @@ Methods
separate from the production settings, ``manage.py test`` would still
execute some queries against your **production** database!
.. note::
In the usual initialization process, the ``ready`` method is only called
once by Django. But in some corner cases, particularly in tests which
are fiddling with installed applications, ``ready`` might be called more
than once. In that case, either write idempotents methods, or put a flag
on your ``AppConfig`` classes to prevent re-running code which should
be executed exactly one time.
.. _namespace package:
Namespace packages as apps (Python 3.3+)