Skip to content
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

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. #216

Closed
qiailin opened this issue Feb 10, 2017 · 12 comments
Closed

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. #216

qiailin opened this issue Feb 10, 2017 · 12 comments

Comments

@qiailin
Copy link

qiailin commented Feb 10, 2017

I tried , the django version 1.10a1,1.10.5,1.103

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

help, me ! thanks

@qiailin
Copy link
Author

qiailin commented Feb 10, 2017

I'm looking for an asynchronous queue that is more suitable than celery but django_q is not available .

@jeroenbrouwer
Copy link

I'm getting the same error with django 1.11, are there any known causes for this problem?

@Eagllus
Copy link
Collaborator

Eagllus commented May 1, 2017

I'm running Django 1.11 with Django-Q 0.8.0 and have no problems.
Could you provide some more information about your project?

@jeroenbrouwer
Copy link

Already fixed it by putting django_q below the app containing the settings and models in the INSTALLED_APPS setting. Maybe add this to the docs? 😄

@Eagllus
Copy link
Collaborator

Eagllus commented May 1, 2017

@jeroenbrouwer not sure I understand what you mean.

In my settings I have

INSTALLED_APPS = (
    'django_q',
    'django.contrib.admin',
    'django.contrib.auth',
   ....
)

I even moved the INSTALLED_APPS to the beginning of my file.
could you share some information about the app your working on?

for example:

  • how do you start your application?
  • how is your configuration setup?

@qiailin did you every resolve this issue?

@jeroenbrouwer
Copy link

jeroenbrouwer commented May 1, 2017

I've got quite an unusual setup for the models which caused the error. I've got a models app which imports the models from several files such that they are easily accessible throughout the whole application. This app needs to be loaded before django_q otherwise I get said error whenever I start django in whichever way possible: runserver, testserver, migrate etc.
And, I haven't had this problem with other external apps.

@Eagllus
Copy link
Collaborator

Eagllus commented May 1, 2017

@jeroenbrouwer not sure if we can add anything about this to the documentation.
It sounds logical that importing your settings is something you want to be done at the top of your models app.

The error is triggered by calling Django-Q in this case before django.setup() is called.

@jeroenbrouwer
Copy link

@Eagllus I guess that's the case, but I'm failing to understand why the order of the loaded apps in the settings is important then...

@Eagllus
Copy link
Collaborator

Eagllus commented May 2, 2017

In the INSTALLED_APPS it's not important but Django requires django.setup() to be ran before parts of an app can be called.
During the setup fase one important thing that it does is apps.populate(settings.INSTALLED_APPS)

def populate(self, installed_apps=None):
        """
        Loads application configurations and models.
        This method imports each application module and then each model module.
        It is thread safe and idempotent, but not reentrant.
        """

If you try to access an app before setup has run the function check_apps_ready will raise AppRegistryNotReady("Apps aren't loaded yet.")

@jeroenbrouwer
Copy link

@Eagllus I know this, just not sure why django-q has to be after my models app in the INSTALLED_APPS list 😉

It's working anyhow and it's doing its job like a charm!

@Eagllus
Copy link
Collaborator

Eagllus commented May 2, 2017

@jeroenbrouwer I cant tell you without knowing any code 😉

But I'm happy to hear that Django-Q is doing a great job 😄

@Eagllus Eagllus closed this as completed Feb 6, 2018
raonyguimaraes added a commit to raonyguimaraes/django-q that referenced this issue Feb 27, 2018
Update to reflect issue Koed00#216
@stevemwangi
Copy link

Try activating the virtual env.

In my case, using git:

source scripts/activate
#Solves my problem.

P-EB pushed a commit to P-EB/django-q that referenced this issue Oct 20, 2024
* Add twine check

* add poetry to install

* move up remove black/flake formatting

* fix path

* fix?

* fix rst?

* add rstcheck

* test all files?

* all

* remove complaining image

* only check readme

* remove not needed dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants