Question

When i tried to run Django 1.5 on Apache 2.2, Windows server 2008 R2 and Python 3.3, It give me this error, i think there is problem in wsgi.py, but i dont now where: This is error in Apache:

[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1] mod_wsgi (pid=8768): Target WSGI script 'C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mysite/mysite/wsgi.py' cannot be loaded as Python module.
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1] mod_wsgi (pid=8768): Exception occurred processing WSGI script 'C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mysite/mysite/wsgi.py'.
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1] Traceback (most recent call last):\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mysite/mysite/wsgi.py", line 10, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     import django.core.handlers.wsgi\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line 9, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     from django import http\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\lib\\site-packages\\django\\http\\__init__.py", line 2, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     from django.http.request import (HttpRequest, QueryDict, UnreadablePostError,\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\lib\\site-packages\\django\\http\\request.py", line 20, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     from django.http.multipartparser import MultiPartParser\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\lib\\site-packages\\django\\http\\multipartparser.py", line 10, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     import cgi\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\Lib\\cgi.py", line 38, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     from email.parser import FeedParser\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\Lib\\email\\parser.py", line 12, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     from email.feedparser import FeedParser, BytesFeedParser\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\Lib\\email\\feedparser.py", line 27, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     from email import message\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\Lib\\email\\message.py", line 16, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     from email import utils\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\Lib\\email\\utils.py", line 30, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     import socket\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]   File "C:\\Python33\\Lib\\socket.py", line 47, in <module>\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1]     import _socket\r
[Sun Nov 10 13:26:46 2013] [error] [client 127.0.0.1] ImportError: DLL load failed: %1 nen\xc3\xad platn\xc3\xa1 aplikace typu Win32.\r

This is wsgi.py

import sys
import os

# workaround for various print messages stopping the app under mod_wsgi (namely South)
sys.stdout = sys.stderr

sys.path.append('D:/Rocnikova_prace/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()
Was it helpful?

Solution

The error indicates that the library was found but is not "loadable" by Windows. The could be due to 32-bit/64-bit incompatibilities between your Windows version and/or Apache, Python, and mod_wsgi.

Double-check that you have installed or built all these as 32-bit or 64-bit, and have not mixed the 2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top