Python is one of the most famous programming language in this technical era. Now lots of IT company shifting their existing framework to Python framework for the simplicity, huge library support, and scalability. There are also lots of popular web Python Web framework already present, like Django, Flask, Web2py, etc. by which anyone can start Web Development.

But as we all know to run a web project, we need a Web Server like Apache, Tomcat, Glassfish, etc. Apache is one of the popular web server. Apache web server support lots of web technologies by default, but not the python.

If anyone wants do a small web project with Database connectivity but without taking headache of python web framework, then this blog will help you to run your python file on Apache Server step by step. These are the steps…

Step 1

At first install Xampp successfully. And find the Xampp installation directory. Usually it is installed in C:\ drive.

Step 2

Go to C:\xampp\apache\conf directory. and open httpd.conf file.

Step 3

Search for AddHandler and add .py at last. (after .asp)

Step 4

Restart the Server.

Step 5

Create a new file, named like and save it to the C:\xampp\htdocs folder.

Step 6

Now locate the directory where the python.exe installed in your system and copy the whole path. In my case the path is


Step 7

Open the file and type

#!C:\path(which you have copied in step 6)

print("Content-Type : text/html \n")


print("<head><h1>Welcome to Python Web</h1></head>")

Step 8

Now run this web page, you will see your output.

That is all. In this way you can add as many as python web page in your project. So Lets Start Coding. Enjoy.


Jayanta Kumar Ray · December 7, 2021 at 11:51 am

Very very good work

SK MD WASIM · December 7, 2021 at 11:53 am

Very good initiative

Leave a Reply

Avatar placeholder

Your email address will not be published.