Closed toxa23 closed 6 years ago
Thank you for the report.
I'll try to reproduced it this week. Meanwhile a full stacktrace would be helpful.
Unable to reproduce it with a simple app and quickstart sample (http://django-siteprefs.readthedocs.io/en/latest/quickstart.html). Works as expected.
Do you encounter this exception on start? How do you structure your code?
Yes, the exception appears at the very beginning. Please take a look at my settings.py and trace log. I do not deny, maybe this is me doing something wrong. sources.zip
Some hints:
settings.py
in your app (just as in quickstart) and define settings there. get_env_variable
.Considered closed. Feel free to reopen if required.
I encountered this also, when I try to described preferences in my project/settings.py
Traceback (most recent call last):
File "/path_to_root/project_wide/settings.py", line 788, in <module>
from siteprefs.toolbox import preferences
File "/usr/lib/python3.8/site-packages/siteprefs/toolbox.py", line 11, in <module>
from .models import Preference
File "/usr/lib/python3.8/site-packages/siteprefs/models.py", line 6, in <module>
class Preference(models.Model):
File "/usr/lib/python3.8/site-packages/django/db/models/base.py", line 107, in __new__
app_config = apps.get_containing_app_config(module)
File "/usr/lib/python3.8/site-packages/django/apps/registry.py", line 252, in get_containing_app_config
self.check_apps_ready()
File "/usr/lib/python3.8/site-packages/django/apps/registry.py", line 135, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
@toxa23 's solution works for me https://github.com/BanzaiTokyo/askapp/blob/f1a5aba/siteprefs/toolbox.py#L24 . I'll submit a patch shortly.