[Django] #23084: uWSGI raises django.core.exceptions.AppRegistryNotReady

4 views
Skip to first unread message

Django

unread,
Jul 23, 2014, 3:57:05 AM7/23/14
to django-...@googlegroups.com
#23084: uWSGI raises django.core.exceptions.AppRegistryNotReady
------------------------------+----------------------
Reporter: kmmbvnr@… | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.7-rc-1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------
I did uwsgi setup as listed here - http://smidth.ru/blog/django/django-
nginx-uwsgi-supervisor/ with django 1.7 and following wsgi.ini


{{{
[uwsgi]
home=/project_path/env/
chdir=/project_path
master=True
disable-logging=True
vacuum=True
pidfile=/project_path/project.pid
max-requests=5000
socket=127.0.0.1:49001
processes=2
harakiri = 20

pythonpath=/project_path/
env=DJANGO_SETTINGS_MODULE=project.settings
module=django.core.handlers.wsgi:WSGIHandler()
touch-reload=/project_path/deploy/reload
}}}

I have to set DEBUG to False in order to see the real exception


{{{
traceback (most recent call last):
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/core/handlers/wsgi.py", line 187, in __call__
response = self.get_response(request)
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/core/handlers/base.py", line 199, in get_response
response = self.handle_uncaught_exception(request, resolver,
sys.exc_info())
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/core/handlers/base.py", line 243, in
handle_uncaught_exception
return callback(request, **param_dict)
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/utils/decorators.py", line 105, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/views/defaults.py", line 44, in server_error
template = loader.get_template(template_name)
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/template/loader.py", line 144, in get_template
template, origin = find_template(template_name, dirs)
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/template/loader.py", line 126, in find_template
loader = find_template_loader(loader_name)
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/template/loader.py", line 98, in find_template_loader
TemplateLoader = import_string(loader)
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/utils/module_loading.py", line 26, in import_string
module = import_module(module_path)
File "/srv/viewflow.io/.tox/py33/lib/python3.3/importlib/__init__.py",
line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in
module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in
_call_with_frames_removed
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/template/loaders/app_directories.py", line 33, in <module>
app_template_dirs = calculate_app_template_dirs()
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/template/loaders/app_directories.py", line 21, in
calculate_app_template_dirs
for app_config in apps.get_app_configs():
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/apps/registry.py", line 125, in get_app_configs
self.check_ready()
File "/srv/viewflow.io/.tox/py33/lib/python3.3/site-
packages/django/apps/registry.py", line 119, in check_ready
raise AppRegistryNotReady()
django.core.exceptions.AppRegistryNotReady
}}}


It could be fixed by adding following lines on top of
django.core.handlers.wsgi.py

{{{
import django
django.setup()
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23084>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 23, 2014, 4:06:42 AM7/23/14
to django-...@googlegroups.com
#23084: uWSGI raises django.core.exceptions.AppRegistryNotReady
------------------------------+--------------------------------------

Reporter: kmmbvnr@… | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.7-rc-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by anonymous):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Sorry, miss the docs.

The correct solution would be specify

{{{
module=django.core.wsgi:get_wsgi_application()
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23084#comment:1>

Django

unread,
Jul 23, 2014, 6:17:10 AM7/23/14
to django-...@googlegroups.com
#23084: uWSGI raises django.core.exceptions.AppRegistryNotReady
------------------------------+--------------------------------------
Reporter: kmmbvnr@… | Owner: nobody
Type: Bug | Status: closed

Component: Core (Other) | Version: 1.7-rc-1
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by aaugustin):

* status: new => closed
* resolution: => invalid


Comment:

Yes, that's the correct solution. May I suggest reading
[https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/uwsgi/ our
official documentation] rather than incorrect blog posts? ;-)

--
Ticket URL: <https://code.djangoproject.com/ticket/23084#comment:2>

Reply all
Reply to author
Forward
0 new messages