Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 a hello world script written in python called I am using apache on a windows machine, and I'd like the script to run automatically, whenever I enter something like http://localhost/

Can someone please tell me how to do this ?

PS: If I point to the script directly from the browser, it displays properly.

#! c:\Python27\python.exe

print "Content-Type: text/html\n\n"
print 'Heya, world..yaba daba doo!'
share|improve this question
up vote 1 down vote accepted

It sounds like you want your Python script to be the index document?

If your setup already works when you do something like http://localhost/ I would suggest renaming it to (common convention to call an index document "index.something") and then editing your Apache configuration to include inthe DirectoryIndex filenames list.

share|improve this answer

I'd highly recommend you write your app (however simple) around a framework. It makes everything massively easier, and you don't end up reinventing wheels. I tend to use Django, or CherryPy.

I recommend you give Cherry a look. The homepage details how to make a Hello World application.
Then all you need to do is ProxyPass to it from Apache, or use mod_wsgi and let apache communicate directly with the application.

share|improve this answer

Is your DirectoryIndex set appropriately in your httpd.conf file?

For example, my DirectoryIndex line is as follows - you should add to the list (although may be more conventional).

DirectoryIndex index.php index.html

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.