Will the simple Python code work on the web-server(with Apache2 installed). The code is save as let’s say hello.py.
def hello():
print ("Hello there Python!!")
It’s just an example. This code will work in the console. Will this code work on the web? My question is: Would I console based application will work on the web saved as .py extension?
No…
Because a web page works over HTTP protocol, that means, your server needs to is:
By using python, you can only process input data (a part of step 2 of the list).
As for the solution, you must use a web framework which will handle the other parts and use a web server (like apache).
There exist good web frameworks like Django or Web.py, but it is better you check your requirements and choose a proper framework.