繁体   English   中英

Windows XP上的mod_wsgi [django]内部服务器错误

[英]Internal Server Error with mod_wsgi [django] on windows xp

当我运行开发服务器时,它运行得很好,即使在mod_wsgi中运行一个空项目也没有问题,但是当我想放置自己的项目时,我会收到内部服务器错误(500)

在我的Apache conf中

WSGIScriptAlias /codevents C:/django/apache/CODEvents.wsgi

<Directory "C:/django/apache">
Order allow,deny
Allow from all
</Directory>

Alias /codevents/media C:/django/projects/CODEvents/html

<Directory "C:/django/projects/CODEvents/html">
Order allow,deny
Allow from all
</Directory>

在CODEvents.wsgi中

import os, sys
sys.path.append('C:\\Python26\\Lib\\site-packages\\django')
sys.path.append('C:\\django\\projects')
sys.path.append('C:\\django\\apps')
sys.path.append('C:\\django\\projects\\CODEvents')


os.environ['DJANGO_SETTINGS_MODULE'] = 'CODEvents.settings'


import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

在我的error_log中说:

[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1] mod_wsgi (pid=1848): Exception occurred processing WSGI script 'C:/django/apache/CODEvents.wsgi'.
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1] Traceback (most recent call last):
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line 241, in __call__
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     response = self.get_response(request)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\core\\handlers\\base.py", line 142, in get_response
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return self.handle_uncaught_exception(request, resolver, exc_info)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\core\\handlers\\base.py", line 166, in handle_uncaught_exception
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return debug.technical_500_response(request, *exc_info)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\views\\debug.py", line 58, in technical_500_response
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     html = reporter.get_traceback_html()
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\views\\debug.py", line 137, in get_traceback_html
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return t.render(c)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\template\\__init__.py", line 173, in render
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return self._render(context)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\template\\__init__.py", line 167, in _render
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return self.nodelist.render(context)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\template\\__init__.py", line 796, in render
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     bits.append(self.render_node(node, context))
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\template\\debug.py", line 72, in render_node
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     result = node.render(context)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\template\\debug.py", line 89, in render
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     output = self.filter_expression.resolve(context)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\template\\__init__.py", line 579, in resolve
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     new_obj = func(obj, *arg_vals)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\template\\defaultfilters.py", line 693, in date
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return format(value, arg)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\dateformat.py", line 281, in format
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return df.format(format_string)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\dateformat.py", line 30, in format
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     pieces.append(force_unicode(getattr(self, piece)()))
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\dateformat.py", line 187, in r
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return self.format('D, j M Y H:i:s O')
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\dateformat.py", line 30, in format
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     pieces.append(force_unicode(getattr(self, piece)()))
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\encoding.py", line 66, in force_unicode
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     s = unicode(s)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\functional.py", line 206, in __unicode_cast
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return self.__func(*self.__args, **self.__kw)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\translation\\__init__.py", line 55, in ugettext
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return real_ugettext(message)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\functional.py", line 55, in _curried
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\translation\\__init__.py", line 36, in delayed_loader
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return getattr(trans, real_name)(*args, **kwargs)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\translation\\trans_real.py", line 276, in ugettext
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     return do_translate(message, 'ugettext')
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\translation\\trans_real.py", line 266, in do_translate
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     _default = translation(settings.LANGUAGE_CODE)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\translation\\trans_real.py", line 176, in translation
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     default_translation = _fetch(settings.LANGUAGE_CODE)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\translation\\trans_real.py", line 159, in _fetch
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     app = import_module(appname)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\utils\\importlib.py", line 35, in import_module
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     __import__(name)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\contrib\\admin\\__init__.py", line 1, in <module>
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\contrib\\admin\\helpers.py", line 1, in <module>
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     from django import forms
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\forms\\__init__.py", line 17, in <module>
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     from models import *
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\forms\\models.py", line 6, in <module>
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     from django.db import connections
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\db\\__init__.py", line 75, in <module>
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     connection = connections[DEFAULT_DB_ALIAS]
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\db\\utils.py", line 91, in __getitem__
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     backend = load_backend(db['ENGINE'])
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]   File "C:\\Python26\\lib\\site-packages\\django\\db\\utils.py", line 49, in load_backend
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     raise ImproperlyConfigured(error_msg)
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1] TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql_psycopg2' isn't an available database backend. 
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1] Try using django.db.backends.XXX, where XXX is one of:
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1]     'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
[Mon May 24 23:31:39 2010] [error] [client 127.0.0.1] Error was: cannot import name utils

请帮我!!

该错误表明找不到或无法导入PostgreSQL客户端的Python模块。 您在哪里安装的? Apache服务可以作为您自己的独立用户运行这些文件吗?

好吧,实际上我的问题是pyscopg2 Windows版本,我使用的是最新版本(2.2.1),我刚刚降级到2.0.14,它还活着!!!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM