Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

up vote 1 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 hello.py and now i am running wsgi so it means on web i can't have something like hello.py 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.

http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide http://code.google.com/p/modwsgi/wiki/WhereToGetHelp

share|improve this answer

Your Answer


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