Hi Jyrki,

My apologies for not responding -- your message ran off the bottom of my inbox.

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).

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.

Yours,
Russ Magee %-)

On Wed, Oct 6, 2010 at 3:36 PM, Jyrki Pulliainen <jy...@dywypi.org> wrote:
> Sorry for bump up, but anything to say about this? Should I create a
> ticket about the problem?
>
> - Jyrki
>
> On Oct 1, 9:41 am, Jyrki Pulliainen <jy...@dywypi.org> wrote:
>> On Oct 1, 3:30 am, Russell Keith-Magee <russ...@keith-magee.com>
>> wrote:
>> > Not really -- I've tried to reproduce the 2 apps and three models you
>> > describe, but I don't see any errors on 1.1.1 or 1.1.2.
>>
>> > I appreciate that you can't release your actual source code, but if
>> > you can generate a minimal test app that reproduces the problem case,
>> > that would be very helpful.
>>
>> > As I said on twitter, this general class of problem is something we've
>> > seen before; however, in all the cases we've been able to identify so
>> > far, it's turned out to be a legitimate error that Django was
>> > historically (and erroneously) suppressing. Yes, 1.1.2 generates more
>> > errors, but that's because 1.1.1 masked legitimate errors, not because
>> > 1.1.2 is broken.
>>
>> > If you can provide a test case that demonstrates otherwise, we're
>> > happy to investigate.
>>
>> I managed to create a simulation of the situation (I suggest hitting
>> the download button or using git, it seems to give the correct
>> directory structure, the gist is a bit fubar as it doesn't appreciate
>> directories):
>>
>> http://gist.github.com/605838
>>
>> Seems to work exactly like our system does: If the app is started
>> via ./manage.py runserver it starts up fine and displays the 404. The
>> admin works fine and I can edit the model C just fine there. However,
>> if I try to run the runner.py provided in the root directory the
>> 'foobar' newer gets printed and instead the app crashes to an import
>> error. This is why I'm suspecting there's some difference with the
>> order of importing stuff and manage.py seems to get the order right.
>>
>> If I checkout Django version pre-12950 both the admin and runner.py
>> work just fine (as the ImportError gets swallowed).
>>
>> - 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.
>
>

-- 
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