-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AppRegistryNotReady raised if us_states imported in app config ready() method #187
Comments
Could you please paste the traceback? |
|
It looks like the import works if it's done within the ready() function, so it seems like Django imports the app registry classes before i18n is initialized, but i18n is initialized by the time the app config's ready() method is run. |
I think that's the expected behavior. But could you try to generate the traceback once more with |
|
Thanks. |
If the us_states module is imported within an AppConfig's ready() method, then an AppRegistryNotReady exception will be raised. The sorting for STATE_CHOICES and USPS_CHOICES is forcing resolution of the lazily translated state names at import time, but i18n isn't available yet.
In our case we're importing a view class in our ready() method to read a property off of it. Our views module imports something from models where we have a model that's using the USStateField which causes the import of us_states.
The text was updated successfully, but these errors were encountered: