Forums

Need Help with AppRegistryNotReady Error

Below is the server log

2014-08-13 15:52:07,525 :    for app_config in apps.get_app_configs():
2014-08-13 15:52:07,525 :  File "/home/CheshireCat/.virtualenvs/perfectus/lib/python2.7/site-packages/django/apps/registry.py",     line 137, in get_app_configs
2014-08-13 15:52:07,525 :    self.check_apps_ready()
2014-08-13 15:52:07,525 :  File "/home/CheshireCat/.virtualenvs/perfectus/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready
2014-08-13 15:52:07,526 :    raise AppRegistryNotReady("Apps aren't loaded yet.")
2014-08-13 15:52:07,526 :django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

That exception is mentioned in the Django troubleshooting docs have a look at that.

Still don't get it. Can you have a look at my code?

Nothing jumps out at me. Try removing stuff (comment out some of your installed apps, comment out bits of models etc.) to narrow it down.

I have tried commenting out things as suggested, and even downgraded from Django 1.7 to 1.5 in vain.

Hang on, "AppRegistryNotReady" error doesn't exist in django 1.5 as far as I know -- are you definitely still seeing the same problem?

I have pip uninstall django inside my virtualenv and reinstall Django 1.5. It still didn't work. I've looked everywhere and got no clue where the code breaks, and it worked just fine locally. So, one thing I suspect is that in the settings.py I'm still using Postgresql. Although unlikely, can that be the source of this problem?

Can you check your django version inside /home/CheshireCat/.virtualenvs/perfectus/lib/python2.7/site-packages/django/__init__.py?

Now I've changed to PythonAnywhere's default version:

VERSION = (1, 6, 5, 'final', 0)

and hey, now the traceback changed

2014-08-14 14:58:48,898 :Traceback (most recent call last):
2014-08-14 14:58:48,898 :  File "/bin/user_wsgi_wrapper.py", line 67, in __call__
2014-08-14 14:58:48,898 :    self.error_log_file.logger.exception("Error running WSGI application")
2014-08-14 14:58:48,898 :  File "/usr/lib/python2.7/logging/__init__.py", line 1183, in exception
2014-08-14 14:58:48,899 :    self.error(msg, *args, **kwargs)
2014-08-14 14:58:48,899 :  File "/usr/lib/python2.7/logging/__init__.py", line 1176, in error
2014-08-14 14:58:48,899 :    self._log(ERROR, msg, args, **kwargs)
2014-08-14 14:58:48,899 :  File "/usr/lib/python2.7/logging/__init__.py", line 1268, in _log
2014-08-14 14:58:48,899 :    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
2014-08-14 14:58:48,899 :  File "/usr/lib/python2.7/logging/__init__.py", line 1242, in makeRecord
2014-08-14 14:58:48,900 :    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
2014-08-14 14:58:48,900 :  File "/usr/lib/python2.7/logging/__init__.py", line 284, in __init__
2014-08-14 14:58:48,900 :    self.threadName = threading.current_thread().name
2014-08-14 14:58:48,900 :  File "/usr/lib/python2.7/threading.py", line 1158, in currentThread
2014-08-14 14:58:48,900 :    return _active[_get_ident()]
2014-08-14 14:58:48,900 :  File "/bin/user_wsgi_wrapper.py", line 59, in __call__
2014-08-14 14:58:48,900 :    app_iterator = self.app(environ, start_response)
2014-08-14 14:58:48,900 :  File "/home/CheshireCat/.virtualenvs/perfectus/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
2014-08-14 14:58:48,901 :    self.load_middleware()
2014-08-14 14:58:48,901 :  File "/home/CheshireCat/.virtualenvs/perfectus/lib/python2.7/site-packages/django/core/handlers/base.py", line 45, in load_middleware
2014-08-14 14:58:48,902 :    mw_class = import_by_path(middleware_path)
2014-08-14 14:58:48,902 :  File "/home/CheshireCat/.virtualenvs/perfectus/lib/python2.7/site-packages/django/utils/module_loading.py", line 31, in import_by_path
2014-08-14 14:58:48,903 :    error_prefix, module_path, class_name))
2014-08-14 14:58:48,903 :django.core.exceptions.ImproperlyConfigured: Module "django.contrib.auth.middleware" does not define a "SessionAuthenticationMiddleware" attribute/class

Aha!

And now that error does sound like it might be to do with an incompatible settings.py... Can you copy-over a settings.py generated with 1.6.5, and just put your database settings, etc, back?

Harry, I finally got my site on!

Shouldn't have play around with the dev fire. Though it's a shame to ditch the migration feature of 1.7. (I actually learned about that feature from your book

hooray!

definitely a shame re: 1.7, but I guess sometimes you run out of time for debugging...