Python 为什么Django安装会提供一个空的HTTP响应?
最终更新:出现了一个异常的Python 为什么Django安装会提供一个空的HTTP响应?,python,django,mod-wsgi,Python,Django,Mod Wsgi,最终更新:出现了一个异常的LoadModule python\u module modules/mod\u python。因此与mod\u wsgi冲突。移除该LoadModule后,一切都恢复正常 我正在用Django设置一个生产服务器,并跟随,但当我访问http://domain.com/mysite # httpd.conf LoadModule wsgi_module modules/mod_wsgi.so WSGIScriptAlias /mysite /home/gibson/m
LoadModule python\u module modules/mod\u python。因此
与mod\u wsgi
冲突。移除该LoadModule后,一切都恢复正常
我正在用Django设置一个生产服务器,并跟随,但当我访问
http://domain.com/mysite
# httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /mysite /home/gibson/mysite/django.wsgi
我还尝试使用一个非常基本的mod_wsgi测试应用程序(如中所示),该应用程序的行为符合预期:
# 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]
还有什么我会忘记的吗?我很欣赏这种洞察力
小更新:我查看了我的Apache错误日志:
[notice] child pid 18356 exit signal Segmentation fault (11)
谷歌搜索这个gem返回了一些关于Django缓存机制的信息(我没有使用),并且与加载mod_python模块(我在httpd.conf中已经注释掉了这个模块)冲突
更新2:(为了简洁起见,删除了注释)
确保Apache中没有安装冲突的模块。具体来说,请检查mod_python或类似工具。您的项目名为
mysite
?你的项目是什么(文件夹'mysite'位于/home/gibson
中,最后,你能粘贴基本的django设置、URL.py和你试图显示的视图吗?wsgi配置似乎正确。是的。是的。我会继续更新帖子。为了澄清,目前没有视图。你的意思是没有模板吗?那么,你的URL.py contai是什么n、 你在请求什么URL?我可能是说没有模板。但不太确定。:P仍在学习中。URL.py在上面。我请求基本URL:/mysite请查看我的“最终更新”。我感谢迄今为止的所有帮助,但我认为这个问题现在是空的。
[notice] child pid 18356 exit signal Segmentation fault (11)
# 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('',)