Hello world with import socket gave me the same issue.  I just re-
installed Python 2.6, more specifically 2.6.2 and everything is
working fine, thanks for your help.

On Apr 14, 10:25 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On Apr 15, 12:07 pm, Thierry <lamthie...@gmail.com> wrote:
>
>
>
> > I'm currently running Apache 2.2 on Windows and I can get the hello
> > world of modwsgi to run.  However, when I configure my Django project,
> > Apache has the following errors from the error.log file:
>
> > mod_wsgi (pid=5956): Target WSGI script 'C:/django_proj/mysite/apache/
> > mysite.wsgi' cannot be loaded as Python module.
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=5956): Exception occurred processing WSGI script 'C:/django_proj/
> > mysite/apache/mysite.wsgi'.
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] Traceback (most
> > recent call last):
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:/
> > django_proj/mysite/apache/mysite.wsgi", line 7, in <module>
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     import
> > django.core.handlers.wsgi
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
> > 8, in <module>
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     from django
> > import http
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in
> > <module>
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     from urllib
> > import urlencode
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\urllib.py", line 26, in <module>
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     import
> > socket
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\socket.py", line 46, in <module>
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     import
> > _socket
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] ImportError: DLL
> > load failed: The specified module could not be found.
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=5956): Target WSGI script 'C:/django_proj/mysite/apache/
> > mysite.wsgi' cannot be loaded as Python module.
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=5956): Exception occurred processing WSGI script 'C:/django_proj/
> > mysite/apache/myite.wsgi'.
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] Traceback (most
> > recent call last):
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:/
> > django_proj/mysite/apache/mysite.wsgi", line 7, in <module>
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     import
> > django.core.handlers.wsgi
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
> > 8, in <module>
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     from django
> > import http
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in
> > <module>
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     from urllib
> > import urlencode
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\urllib.py", line 26, in <module>
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     import
> > socket
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\socket.py", line 46, in <module>
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     import
> > _socket
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] ImportError: DLL
> > load failed: The specified module could not be found.
>
> > My 'C:/django_proj/mysite/apache/mysite.wsgi' is the following:
> > import os, sys
> > sys.path.append('C:/django_proj')
> > sys.path.append('C:/django_proj/mysite')
>
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
>
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
>
> > The apache conf is:
> > Alias /media/ "C:/django_proj/mysite/media/"
>
> > <Directory "C:/django_proj/mysite/media">
> >     Order allow,deny
> >     Options Indexes
> >     Allow from all
> >     IndexOptions FancyIndexing
> > </Directory>
>
> > WSGIScriptAlias /blah "C:/django_proj/mysite/apache/mysite.wsgi"
>
> > <Directory "C:/django_proj/mysite/apache">
> >     Order allow,deny
> >     Allow from all
> > </Directory>
>
> > I'm trying to run the above locally by accessing:http://localhost/blah,
> > I get the 500 Internal Server Error.  Can anyone tell me what I'm
> > missing?
>
> This is not a Django problem, there is something wrong with how Python
> is installed on your system.
>
> Replace your Django WSGI script file with:
>
>   # Attempt to import 'socket' module.
>
>   import socket
>
>   # Now for the hello world application.
>
>   def application(environ, start_response):
>     status = '200 OK'
>     output = 'Hello World!'
>
>     response_headers = [('Content-type', 'text/plain'),
>                         ('Content-Length', str(len(output)))]
>     start_response(status, response_headers)
>
>     return [output]
>
> and you will likely get a similar result, because the import of
> 'socket' will fail.
>
> When you install Python, ensure you did so as an account with
> Administrator rights and select that you want to make it available to
> all users on the system. If you don't do this, the registry entries
> which setup where Python searches for modules may not be available to
> the user that Apache service runs as. This can result in it not being
> able to find some stuff properly.
>
> Please try the WSGI script above instead as first step to show that
> this is not a Django problem.
>
> Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to