我正在
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet
django==2.0.2
和celery==4.1.0
中的错误。没有搜索帮助我。我试过了
import django
django.setup()
但似乎这对我不起作用。这是追溯:
[2018-06-05 10:41:42,529: ERROR/ForkPoolWorker-1] Task backend.ml.face_detection_request[891df311-fe6b-4456-8c30-84a0b9baf716] raised unexpected: AppRegistryNotReady("Apps aren't loaded yet.",)
Traceback (most recent call last):
File "/home/user/lib/python3.5/site-packages/celery/app/trace.py", line 374, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/user/lib/python3.5/site-packages/celery/app/trace.py", line 629, in __protected_call__
return self.run(*args, **kwargs)
File "/home/user/wandresearchrepo/wandhub/wandhub/backend/ml.py", line 89, in face_detection_request
from backend.models import Image
File "/home/user/backend/models.py", line 6, in <module>
class Company(models.Model):
File "/home/user/lib/python3.5/site-packages/django/db/models/base.py", line 100, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/user/lib/python3.5/site-packages/django/apps/registry.py", line 244, in get_containing_app_config
self.check_apps_ready()
File "/home/user/lib/python3.5/site-packages/django/apps/registry.py", line 127, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.