Final Update: There was a stray LoadModule python_module modules/mod_python.so
that conflicted with mod_wsgi
. Removing that LoadModule made everything work again.
I am setting up a production server with Django and following along with the Django tutorial, yet receiving a blank page (or, as Chrome likes to report, Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.
) when I visit http://domain.com/mysite
.
# httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /mysite /home/gibson/mysite/django.wsgi
# django.wsgi
import os
import sys
sys.path.append('/home/gibson')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
I've also attempted using a very basic mod_wsgi test application (as found in the mod_wsgi wiki), which behaves as expected:
# django.wsgi (test)
def application(environ, start_response):
status = '200 OK'
output = 'i live!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
Is there something else I could be forgetting? I appreciate the insight.
small update: For giggles, I checked my Apache error_log:
[notice] child pid 18356 exit signal Segmentation fault (11)
Googling for this gem returned some stuff about Django's caching mechanism (which I don't use) and conflicts with loading the mod_python module (which I've commented out in my httpd.conf).
Update 2: (comments removed for brevity)
# settings.py
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/home/gibson/mysite/sqlite3.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/'
SECRET_KEY = '[redacted]'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
ROOT_URLCONF = 'mysite.urls'
TEMPLATE_DIRS = (
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
)
# urls.py
from django.conf.urls.defaults import *
urlpatterns = patterns('',)