2

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()
5
  • Just guessing, but it may be a 32-bit/64-bit compatibility issue...if you have 32-bit or 64-bit windows try installing the matching Python. Commented Nov 10, 2013 at 13:26
  • I have 64 bit python, bud 32bit Apache and mod_wsgi Commented Nov 10, 2013 at 13:48
  • That's probably the issue, have you tried using 32-bit python? Commented Nov 10, 2013 at 13:53
  • Yes you are right. I didnt install Python 32bit, but Apache and mod_wsgi 64bit and it worked. Thx Commented Nov 10, 2013 at 14:05
  • Great, I'll make an answer then, so others with the same issue can easily find it. Commented Nov 10, 2013 at 14:13

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.