Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed the Python , apache. The command line programs are working with python.

I have two virtual hosts in apache


WHat i want is i place file in site1 root directory and it display hello in browser

with mod_wsgl only without cgi

share|improve this question
up vote 3 down vote accepted

In it's most simplest form..

Create a file called hello_world.wsgi with the following contents. This should be outside of your DocumentRoot so that Apache is unable to serve it up as plain text:

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]

Then configure your vhost to serve all requests beneath / from that script:

WSGIScriptAlias / <path_to_script>/hello_world.wsgi
share|improve this answer
i am trying that and will let u know. Thanks for being simple and straight to point – John Jun 24 '10 at 0:44
Thanks buddy i finally displayed hello in browser. I am confused with one thing , i was epecting to run something like and now i am running wsgi so it means on web i can't have something like and with code in it. Where will i write my all code? – John Jun 24 '10 at 7:00

Have you actually tried reading the mod_wsgi documentation. That is what it is there for.

share|improve this answer
From the man himself no less! – kevinarpe Mar 2 at 13:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.