AppRegistryNotReady trying to access model's verbose name

465 views
Skip to first unread message

Stodge

unread,
Aug 6, 2014, 11:06:51 AM8/6/14
to django...@googlegroups.com
I'm trying to port my Django project to Dango 1.7rc2 but I'm hitting the app registry error. I know that this is mentioned in the Troubleshooting section of the documentation but I don't understand why this is happening.

__init__.py", line 44, in register_layer
    layer['verbose_name'] = model._meta.verbose_name.capitalize()
  File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 132, in __wrapper__
    res = func(*self.__args, **self.__kw)
  File "/usr/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 83, in ugettext
    return _trans.ugettext(message)
  File "/usr/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 325, in ugettext
    return do_translate(message, 'ugettext')
  File "/usr/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 306, in do_translate
    _default = translation(settings.LANGUAGE_CODE)
  File "/usr/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 209, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/usr/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 189, in _fetch
    "The translation infrastructure cannot be initialized before the "
django.core.exceptions.AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.

The model's verbose name is a translated string, but models.py uses ugettext_lazy so I don't understand why it ends up using ugettext. Thanks

Alexander Serechenko

unread,
Jan 12, 2015, 1:11:34 PM1/12/15
to django...@googlegroups.com
I've got the same problem while using module django-modelclone.
I'd like to contribute in this module and fix the bug, can you help me wtih it?

среда, 6 августа 2014 г., 18:06:51 UTC+3 пользователь Stodge написал:
Reply all
Reply to author
Forward
0 new messages