Not every app needs/has urls.py to be included. "models.py" is
imported Django's get_app(). So, something like admin.autodiscover()
will also import your models. The problem with putting signal handlers
in __init__, is that it isn't the place you would really expect Model
related code to live (like post_save). It can also lead to non-obvious
cyclic imports, 'cause your handler code will most likely need some
models, etc.

On 18 December 2010 06:38, Yaniv Aknin <[email protected]> wrote:
> Maybe I'm missing something here, but why not the app's __init__.py?
> (my main urls.py imports all my apps' urls.py, which means their __init__.py
> is likely to be called rather early in any request, no?)
>
>  - Yaniv
>
> On Sat, Dec 18, 2010 at 3:10 AM, dmitry b <[email protected]> wrote:
>>
>> Aren't an app's models loaded lazily (upon the first use)?
>>
>> On Dec 16, 7:16 pm, "W. Craig Trader" <[email protected]> wrote:
>> > I usually register the signals for a given application at the bottom of
>> > that
>> > app's model.py file.
>> >
>> > - Craig -
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Łukasz Rekucki

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to