Hello,

some days ago i have isntalled the wsgi module into my apache and the
simple Hello, World application runs fine. The next step I did want to
do is to make a TCP server that is listening on a certain port (e.g.
621). Because of this, I modified the Hello World application to the
following code:

######

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]

from wsgiref.simple_server import make_server
srv = make_server('localhost', 621, application)
srv.serve_forever()

######

But now the script won't run anymore, here is the error.log of the
apache:

######

[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2] mod_wsgi
(pid=5612): Target WSGI script '/var/www/python/test.wsgi' cannot be
loaded as Python module.
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2] mod_wsgi
(pid=5612): Exception occurred processing WSGI script '/var/www/python/
test.wsgi'.
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2] Traceback
(most recent call last):
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]   File "/var/
www/python/test.wsgi", line 12, in <module>
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]     srv =
make_server('localhost', 621, application)
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]   File "/usr/
lib/python2.6/wsgiref/simple_server.py", line 181, in make_server
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]     server =
server_class((host, port), handler_class)
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]   File "/usr/
lib/python2.6/SocketServer.py", line 400, in __init__
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]
self.server_bind()
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]   File "/usr/
lib/python2.6/wsgiref/simple_server.py", line 50, in server_bind
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]
HTTPServer.server_bind(self)
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]   File "/usr/
lib/python2.6/BaseHTTPServer.py", line 108, in server_bind
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]
SocketServer.TCPServer.server_bind(self)
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]   File "/usr/
lib/python2.6/SocketServer.py", line 411, in server_bind
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]
self.socket.bind(self.server_address)
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2]   File
"<string>", line 1, in bind
[Thu Dec 24 19:38:19 2009] [error] [client 192.168.178.2] error:
[Errno 13] Permission denied

######

Do you know why this is happening? Is there another way to create such
a server or to grant the module to create sockets? Thank you in advance

--

You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.


Reply via email to