views:

379

answers:

2

when i run development server it works very well, even an empty project runing in mod_wsgi i have no problem but when i want to put my own project i get an Internal Server Error (500)

in my apache conf i put

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>

in 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()

and in my error_log it said:

[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

please help me!!

+1  A: 

The error says that Python module for PostgreSQL client isn't found or failed to import. Where did you install it? Are the files accessible by Apache service, which runs as a distinct user to yourself?

Graham Dumpleton
I install it in C:\Archivos de programa\PostgreSQL\8.4, how can i know if the files are accessible by apache on windows?
sacabuche
and psycopg2 in C:\Python26\Lib\site-packages\psycopg2
sacabuche
thanks you guide me to the answer
sacabuche
A: 

Well in fact my problem was pyscopg2 windows version, i was using the latest (2.2.1) and i just downgrade to 2.0.14 and it's alive!!!

sacabuche