Django+uWsgi unable to find "application" callable - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Django+uWsgi unable to find "application" callable (/thread-4529.html) |
Django+uWsgi unable to find "application" callable - rosettas - Aug-23-2017 Hi I am running askbot via uWsgi, which was working fine. But after few thing updated (maybe uWsgi from 2.0.14 to 2.0.15), it is stopped. Please help. The versions: Python 2.7.13 Django (1.8.17) uWSGI (2.0.15) The problem from uWsgi startup log: The uWsgi configuration:Quote:[uwsgi] The django.wsgi file: import os import sys import time import traceback import signal current_directory = os.path.dirname(__file__) parent_directory = os.path.dirname(current_directory) module_name = os.path.basename(current_directory) sys.path.append(parent_directory) sys.path.append(current_directory) os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % module_name from django.core.wsgi import get_wsgi_application try: application = get_wsgi_application() print 'WSGI without exception' except Exception: print 'handling WSGI exception' # Error loading applications if 'mod_wsgi' in sys.modules: traceback.print_exc() os.kill(os.getpid(), signal.SIGINT) time.sleep(2.5) RE: Django+uWsgi unable to find "application" callable - nilamo - Aug-23-2017 (Aug-23-2017, 02:32 PM)rosettas Wrote: Quote:from django.core.wsgi import get_wsgi_application try: application = get_wsgi_application() print 'WSGI without exception' except Exception: print 'handling WSGI exception' wsgi works by looking for a callable object that's specifically named "application". The error is telling you that it can't find that variable name. And yet, you clearly are defining it. django.core.wsgi is not complicated: https://github.com/django/django/blob/master/django/core/wsgi.py Wrote:import django from django.core.handlers.wsgi import WSGIHandler def get_wsgi_application(): """ The public interface to Django's WSGI support. Return a WSGI callable. Avoids making django.core.handlers.WSGIHandler a public API, in case the internal WSGI implementation changes or moves in the future. """ django.setup(set_prefix=False) return WSGIHandler() Try replacing your error handling to print out the raw error: except Exception as err: print(err)Maybe we can get more info that way. I'm not sure what else to do, as everything appears to be setup correctly, and the error doesn't make sense with the file you've shared. RE: Django+uWsgi unable to find "application" callable - rosettas - Aug-24-2017 Thanks! It works. The raw error printing shows one postgresql lib lost. I have reinstalled the postgresql client, the problem solved. RE: Django+uWsgi unable to find "application" callable - nilamo - Aug-24-2017 Thanks for reporting back :) |