Python Forum
Django+uWsgi unable to find "application" callable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Django+uWsgi unable to find "application" callable
#1
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:

Error:
*** Operational MODE: single process *** handling WSGI exception unable to find "application" callable in file /foo/askbot1/django.wsgi unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode ***
The uWsgi configuration:

Quote:[uwsgi]

# Django-related settings
# the base directory (full path)
chdir = /foo/askbot1
# Django's wsgi file
wsgi-file = /foo/askbot1/django.wsgi

# the virtualenv (full path)
home = /bar/.virtualenvs/askbot010

# process-related settings
# master
master = true
# maximum number of worker processes
processes = 1

logto = /foo/askbot1/log/askbot.log

# the socket (use the full path to be safe)
socket = /foo/askbot1/site.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666

# clear environment on exit
vacuum = true

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)
Reply
#2
(Aug-23-2017, 02:32 PM)rosettas Wrote:
Error:
*** Operational MODE: single process *** handling WSGI exception unable to find "application" callable in file /foo/askbot1/django.wsgi
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/ma...re/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.
Reply
#3
Thanks! It works.

The raw error printing shows one postgresql lib lost. I have reinstalled the postgresql client, the problem solved.
Reply
#4
Thanks for reporting back :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Django: View is unable to find attributes of database model pythonpaul32 1 1,984 May-20-2024, 05:38 AM
Last Post: tahirahmedd
  How to set up uwsgi and nginx? Stas43 2 2,834 Apr-21-2023, 10:51 AM
Last Post: Stas43
  Python flask uwsgi nginx docker mfaridi 2 3,336 Sep-14-2022, 11:07 AM
Last Post: mfaridi
  run watchdog in flask app with uwsgi experimental 0 4,173 Apr-25-2020, 09:44 PM
Last Post: experimental
  Downloading Images - Unable to find correct selector Brompy 4 5,015 Jan-22-2020, 04:54 PM
Last Post: snippsat
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 5,726 Jun-30-2019, 12:21 AM
Last Post: scidam
  flask to uwsgi threading issue batchenr 1 5,617 Jun-17-2019, 02:12 PM
Last Post: batchenr
  How to deploy Django application on Apache2 server deepag 0 2,920 Jan-23-2019, 05:09 AM
Last Post: deepag
  Have django-extensions installed, can't find shell_plus Larz60+ 7 12,878 Jul-14-2018, 12:04 AM
Last Post: Larz60+
  location settings for Django Uwsgi Nginx Configuration for production sandyman 0 3,813 Sep-15-2017, 09:08 AM
Last Post: sandyman

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.