django-q2: In the new version 1.5.5, there was an error running: Apps aren't loaded yet

The following error occurred after upgrading version 1.5.5 (rolling back to 1.5.4 to restore normal):

PS C:\Users\123\PycharmProjects\Tesla> pdm run .\manage.py qcluster
15:58:07 [Q] INFO Q Cluster colorado-tennis-bravo-equal starting.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\123\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Users\123\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 126, in _main
    self = reduction.pickle.load(from_parent)
  File "C:\Users\123\Tesla\lib\site-packages\django_q\cluster.py", line 12, in <module>
    from django_q.monitor import monitor
  File "C:\Users\123\Tesla\lib\site-packages\django_q\monitor.py", line 7, in <module>
    import django_q.tasks
  File "C:\Users\123\Tesla\lib\site-packages\django_q\tasks.py", line 14, in <module>
    from django_q.models import Schedule, Task
  File "C:\Users\123\Tesla\lib\site-packages\django_q\models.py", line 28, in <module>
    class Task(models.Model):
  File "C:\Users\123\Tesla\lib\site-packages\django\db\models\base.py", line 129, in __new__
    app_config = apps.get_containing_app_config(module)
  File "C:\Users\123\Tesla\lib\site-packages\django\apps\registry.py", line 260, in get_containing_app_config
    self.check_apps_ready()
  File "C:\Users\123\Tesla\lib\site-packages\django\apps\registry.py", line 138, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

environment:

OS: Windows 10
Python: 3.10
Django_q2: 1.5.5

particulars:

null   (Before further analysis, report to the community first)

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 3
  • Comments: 16

Most upvoted comments

Sorry, I am all caught up with work at the moment. I will try to fix this on Thursday. I still haven’t been able to reproduce this (on Linux), but will try on a windows machine then.

Thanks for all the reports. It’s great to see that this package is getting used in quite a few projects!

@dongfangtianyu @rasulkireev @ethrgeist @alexerhardt @diefenbach v1.6.0 has been released which includes a fix for this (as well as other cool updates; support for Python 12 and Django 5!). It should be working fine on windows/mac now. Let me know if you are still having issue!

I found the issue and the solution is in the PR I created. Confirmed it working on my windows machine. I still need to merge it and then create a new release for it. Will do that in the next few days, don’t have time for that today anymore.

The issue was that all processes start with a different file and those files have not initialized django yet. The solution was to setup django in the scheduler, worker, monitor and pusher all separately. I don’t know why it worked on linux, but that’s not important anymore.

@zN3utr4l regarding the ctrl+c issue, you might want to take a look at this: https://github.com/django-q2/django-q2/issues/66 Windows handles that differently, you might need a different key combo for that. You need the Ctrl + Break combo (and the actual key combo can differ per computer)

@zN3utr4l Looks like you are on Windows as well? Might be an issue specific to Windows then… hmm… I will take a look later.