Debugging "Premature end of script headers" - WSGI/Django [migrated]
- by Marcin
I have recently deployed an app to a shared host (webfaction), and for no apparent reason, my site will not load at all (it worked until today).
It is a django app, but the django.log is not even created; the only clue is that in one of the logs, I get the error message: "Premature end of script headers", identifying my wsgi file as the source.
I've tried to add logging to my wsgi file, but I can't find any log created for it. Is there any recommended way to debug this error? I am on the point of tearing my hair out.
My WSGI file:
import os
import sys
from django.core.handlers.wsgi import WSGIHandler
import logging
logger = logging.getLogger(__name__)
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.environ['CELERY_LOADER'] = 'django'
virtenv = os.path.expanduser("~/webapps/django/oneclickcosvirt/")
activate_this = virtenv + "bin/activate_this.py"
execfile(activate_this, dict(__file__=activate_this))
# if 'VIRTUAL_ENV' not in os.environ:
# os.environ['VIRTUAL_ENV'] = virtenv
sys.path.append(os.path.dirname(virtenv+'oneclickcos/'))
logger.debug('About to run WSGIHandler')
try:
application = WSGIHandler()
except (Exception,), e:
logger.debug('Exception starting wsgihandler: %s' % e)
raise e