我正在关注Django Doc,但是当我这样做时,我收到以下错误消息。
ODBC Data Source Administrator
"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.
我理解这是因为在加载必要的lib之前调用了转换,但是如果文档以这种方式说明,我怎么能改变呢?
LANGUAGE_CODE = 'en'
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale/'),
)
USE_I18N = True
USE_L10N = True
USE_TZ = True
TIME_ZONE = 'Europe/Copenhagen'
from django.utils.translation import ugettext as _
LANGUAGES = [
('da', _('Danish')),
('en', _('English')),
]