Hallöchen!
Thierry Chich writes:
> Is manage.py sqlall working ?
Yes.
I think I understood the problem now. It's a complicated case of a
cyclic import. If I have
INSTALLED_APPS = (A, B)
then "manage.py syncdb" tries to generate the tables for A and
imports A.models. The problem occurs if A.models imports B.models
on top-level (e.g. for sub-classing models of B). Then, Django
imports B.models and executes the code in B.models. This contains
admin.site.register calls. If DEBUG=True, those calls try to
validate all existing models, which means that A.models is imported
again, although B.models hasn't been executed fully yet. Therefore,
B.models' __dict__ is not yet populated. Thus, the import of
B.models in A.models -- which is triggered for the second time by
now -- fails.
Whew.
Adding
if "syncdb" in sys.argv:
DEBUG = TEMPLATE_DEBUG = False
in settings.py is an acceptable workaround for me. Should I file a
Django bug report?
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: [email protected]
or http://bronger-jmp.appspot.com
--
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.