On Oct 6, 5:12 pm, Russell Keith-Magee <russ...@keith-magee.com>
wrote:
> Hi Jyrki,
>
> My apologies for not responding -- your message ran off the bottom of my 
> inbox.

No prob, thanks for the response!

> I've had a look at your sample code; the problem is that you're
> importing the app1 module in two different ways. As a result of a
> quirk of Python's module importer, 'r12950.app1.models' and
> 'app1.models' are different modules. You are importing modules as
> "r12950.app1", but your INSTALLED_APPS lists "app1". This means that
> app1.models is actually getting imported and registered twice, and
> depending on exactly what you are doing and the order in which you do
> it, some of those registrations may be incomplete or corrupted.
>
> Now, you may not have observed any effects of this corruption --
> simple "load model, write to database" operations should still be fine
> --  but that doesn't change the fact that model startup hasn't been
> completed successfully.
>
> If you change either your importing style, or your INSTALLED_APPS
> entry, the problem will go away. The problem will also go away if you
> move the admin registration out of models.py, and into admin.py
> (Strictly, using admin.py just masks the problem, but moving to using
> admin.py is good practice anyway).

We actually used fully qualified module paths in our production
environment, they just got accidentally left out from my example.
Anyhow, the solution there was to swap stuff to admin.py, reorganize
imports and move some parts of code to "dummy" modules to avoid
circular imports.

> So -- my original analysis still stands -- albeit for slightly more
> complex reasons. The issue here is that your code was previously in
> error, and now we're a little more vigilant about reporting the
> potential problem.

Now that you've explained the problem a bit more deeply I think I have
to agree with you that my software was faulty. And I so hoped that the
flaws of my software could be accounted either by the flaws in the
framework or by the flaws in the programming language itself ;)

- Jyrki

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

Reply via email to