Tuesday 15 February 2011

wsgi - Upgrade to Django 1.7 - AppRegistryNotReady exception -



wsgi - Upgrade to Django 1.7 - AppRegistryNotReady exception -

i'm struggling trying create things work after upgrading django version 1.6.7 1.7. looks i'm not able focus on right matter. seek resume situation far.

thing is: if leave command django.setup() in wsgi.py file, when seek access website internal server error (500). looking @ logs, get:

[sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] mod_wsgi (pid=23258): target wsgi script '/home/thrasher/webapps/django/myproject.wsgi' cannot loaded python module. [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] mod_wsgi (pid=23258): exception occurred processing wsgi script '/home/thrasher/webapps/django/myproject.wsgi'. [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] traceback (most recent phone call last): [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] file "/home/thrasher/webapps/django/myproject.wsgi", line 16, in <module> [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] application = get_wsgi_application() [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] file "/home/thrasher/webapps/django/lib/python2.7/django/core/wsgi.py", line 14, in get_wsgi_application [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] django.setup() [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] file "/home/thrasher/webapps/django/lib/python2.7/django/__init__.py", line 21, in setup [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] apps.populate(settings.installed_apps) [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] file "/home/thrasher/webapps/django/lib/python2.7/django/apps/registry.py", line 78, in populate [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] raise runtimeerror("populate() isn't reentrant") [sun oct 12 12:38:50 2014] [error] [client 127.0.0.1] runtimeerror: populate() isn't reentrant

however, if comment django.setup() call, trying access website gets me stack trace:

environment: request method: request url: http://www.creepyvisions.it/ django version: 1.7 python version: 2.7.8 installed applications: ('django.contrib.auth', 'django.contrib.admin.apps.simpleadminconfig', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.admindocs', 'myproject.archivio', 'sorl.thumbnail', 'django.contrib.sitemaps', 'rest_framework') installed middleware: ('django.middleware.common.commonmiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware') traceback: file "/home/thrasher/webapps/django/lib/python2.7/django/core/handlers/base.py" in get_response 98. resolver_match = resolver.resolve(request.path_info) file "/home/thrasher/webapps/django/lib/python2.7/django/core/urlresolvers.py" in resolve 338. pattern in self.url_patterns: file "/home/thrasher/webapps/django/lib/python2.7/django/core/urlresolvers.py" in url_patterns 367. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) file "/home/thrasher/webapps/django/lib/python2.7/django/core/urlresolvers.py" in urlconf_module 361. self._urlconf_module = import_module(self.urlconf_name) file "/usr/local/lib/python2.7/importlib/__init__.py" in import_module 37. __import__(name) file "/home/thrasher/webapps/django/myproject/urls.py" in <module> 33. url(r'^admin/', include(admin.site.urls)), file "/home/thrasher/webapps/django/lib/python2.7/django/contrib/admin/sites.py" in urls 260. homecoming self.get_urls(), self.app_name, self.name file "/home/thrasher/webapps/django/lib/python2.7/django/contrib/admin/sites.py" in get_urls 221. self.check_dependencies() file "/home/thrasher/webapps/django/lib/python2.7/django/contrib/admin/sites.py" in check_dependencies 159. if not apps.is_installed('django.contrib.admin'): file "/home/thrasher/webapps/django/lib/python2.7/django/apps/registry.py" in is_installed 223. self.check_apps_ready() file "/home/thrasher/webapps/django/lib/python2.7/django/apps/registry.py" in check_apps_ready 124. raise appregistrynotready("apps aren't loaded yet.") exception type: appregistrynotready @ / exception value: apps aren't loaded yet.

for sake of completion, code related wsgi:

myprojext.wsgi

import os import sys os.environ.setdefault("django_settings_module", "myproject.settings") django.core.wsgi import get_wsgi_application application = get_wsgi_application()

wgsi.py

import django django.core.handlers.wsgi import wsgihandler def get_wsgi_application(): #django.setup() homecoming wsgihandler()

things odd me, performed lot of searches in official django docs , in various forums, i'm still unable things work properly. suggestions much appreciated.

it turned out problem duplication, in installed_apps, of django.contrib.admin. looks root of problem. removed sec reference, uncommented django.setup() in wsgi.py , things became sunny , clear again. working fine.

django wsgi

No comments:

Post a Comment