Closed tsebire closed 8 years ago
Try upgrading to the latest django-watson.
https://github.com/etianen/django-watson/blob/master/CHANGELOG.markdown
On Sun, 13 Dec 2015 at 16:55, tsebire notifications@github.com wrote:
Hello,
I can't register a model in watson anymore since I've upgraded to Django 19
It raises a AppRegistryNotReady exception I'm using an AppConfig for my module set in my initpy file :
from djangoapps import AppConfigfrom watson import search as watson class ProduitsConfig(AppConfig): name = "moderationappsproduits"
def ready(self): ProduitModel = selfget_model("Produit") watsonregister(ProduitModel, fields=("nom", "marque__nom", "marque__pays__nom", "marque__region__nom", "type", "couleur"))
When I comment the watson import and the register line, I don't have any error
Am I missing something ?
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/144.
I already did, that's why I don't know what can I do next. I'll retry tonight and keep you updated.
Hmm, do you have a full traceback that I can investigate?
On Mon, 14 Dec 2015 at 09:00 tsebire notifications@github.com wrote:
I already did, that's why I don't know what can I do next. I'll retry tonight and keep you updated.
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/144#issuecomment-164382094 .
Here you go :
Traceback (most recent call last):
File "D:/Work/Sites/moderation/manage.py", line 10, in
I fixed the problem by putting the watson import in the ready method of AppConfig and not at the beginning of my file (it was working like this before).
Thanks for your time.
@tsebire thanks for posting your fix. I'd been looking at this for about 2 hours now!
Out of interest, what causes the exception? It is running buildwatson, or is it runserver?
I'm confused, because none of the unit tests pick up on this.
On Sun, 3 Jan 2016 at 23:39 fresh-django notifications@github.com wrote:
@tsebire https://github.com/tsebire thanks for posting your fix. I'd been looking at this for about 2 hours now!
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/144#issuecomment-168554762 .
It was thrown on runserver command.
I'd like to keep this open for now. It should be possible to import watson at the top-level of your apps.py file. I'm not sure right now why it's not...
Ok my bad :). Good luck fixing this and happy new year.
I'm also seeing this with Django 1.9.1:
from django.apps import AppConfig
from watson import search as watson
default_app_config = 'issues.IssueAppConfig'
class IssueAppConfig(AppConfig):
name = "issues"
def ready(self):
software_v = self.get_model("SoftwareVersion")
issue = self.get_model("IssueTranslation")
watson.register(software_v)
watson.register(issue)
Throws:
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
What worked for me is to move "from watson import search as watson" into the ready() function. No idea what's going on behind the scene though.
Check out the latest master branch. This should be fixed.
Keeping this issue open for now, until confirmation that it's fixed...
@Athemis moving into ready() worked for me.
@etianen I tried it with the latest master branch. Unfortunately it still gives the same error:
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Moving the imports into the ready function still fixes it.
Can I have the full traceback?
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x035E1B70>
Traceback (most recent call last):
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Program Files (x86)\Python35-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 662, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "E:\Playground\Python\CaloriesNow\foodlog\apps.py", line 2, in <module>
from watson import search as watson
File "C:\Program Files (x86)\Python35-32\lib\site-packages\watson\search.py", line 14, in <module>
from django.contrib.contenttypes.models import ContentType
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\contrib\contenttypes\models.py", line 159, in <module>
class ContentType(models.Model):
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\db\models\base.py", line 94, in __new__
app_config = apps.get_containing_app_config(module)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\registry.py", line 239, in get_containing_app_config
self.check_apps_ready()
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Oh, the ContentTypes framework. Gotcha.
Try the latest master now.
On Mon, 29 Feb 2016 at 15:03 TommySprat notifications@github.com wrote:
Unhandled exception in thread started by <function check_errors.
.wrapper at 0x035E1B70> Traceback (most recent call last): File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper fn(_args, *_kwargs) File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_exception six.reraise(exception) File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\six.py", line 685, in reraise raise value.with_traceback(tb) File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper fn(_args, **kwargs) File "C:\Program Files (x86)\Python35-32\lib\site-packages\djangoinit__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\registry.py", line 85, in populate app_config = AppConfig.create(entry) File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\config.py", line 90, in create module = import_module(entry) File "C:\Program Files (x86)\Python35-32\lib\importlibinit.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File " ", line 986, in _gcd_import File " ", line 969, in _find_and_load File " ", line 944, in _find_and_load_unlocked File " ", line 222, in _call_with_frames_removed File " ", line 986, in _gcd_import File " ", line 969, in _find_and_load File " ", line 958, in _find_and_load_unlocked File " ", line 673, in _load_unlocked File " ", line 662, in exec_module File " ", line 222, in _call_with_frames_removed File "E:\Playground\Python\CaloriesNow\foodlog\apps.py", line 2, in from watson import search as watson File "C:\Program Files (x86)\Python35-32\lib\site-packages\watson\search.py", line 14, in from django.contrib.contenttypes.models import ContentType File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\contrib\contenttypes\models.py", line 159, in class ContentType(models.Model): File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\db\models\base.py", line 94, in new app_config = apps.get_containing_app_config(module) File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\registry.py", line 239, in get_containing_app_config self.check_apps_ready() File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\registry.py", line 124, in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. — Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/144#issuecomment-190248996 .
I had the same issue but the issue RESOLVED as per Dave's advice to use the latest master branch. Thanks for the hard work.
Cool, I'll release on Monday! :D On Fri, 4 Mar 2016 at 05:12, sunjoomoon notifications@github.com wrote:
I had the same issue but the issue RESOLVED as per Dave's advice to use the latest master branch. Thanks for the hard work.
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/144#issuecomment-192108160 .
I also tried that latest master branch and can confirm that it's fixed on my system too.
This is now released as 1.2.1
Hello,
I can't register a model in watson anymore since I've upgraded to Django 1.9.
It raises a AppRegistryNotReady exception. I'm using an AppConfig for my module set in my init.py file :
When I comment the watson import and the register line, I don't have any error.
Am I missing something ?