i wan to develop web application by using python on mac os. i am trying to get a link between html and python code. can i give a link between them or not. if it is possible please send me your valuable suggeitions
Thanks for giving reply. In general, When we develop any web application in java first we write html code to get the details from the user and then java code to process the data and then any database to store the data. similarly , i want to develop web application on python instead of java. still, I don't know how to get link between html to python and then database. hear i am using mysql database. can, you give me any sugg
There is two ways to make web server in python. First method is to install any we frame work for python. There is lots of web frameworks available for python Webpy,Django are some of these frameworks. Check this thread to how to setup a Webpy web server http://nikhilvishnupv.blogspot.com/2008/01/make-web-server-using-python.html . Here python acts as a a php script. HTML pages are embeded in python.
The next way is used for make small apps. here a python module asyncore is used. A sample script is given below
import socket, time
html="<html>This is a sample web page using python asyncore<div><i>email@example.com</i></div></html>"
self.port = port
print "listening on port", self.port
channel, addr = self.accept()
server = TimeServer(8046)
You can always make the server aplication give a python script conditions such as calling from the shell "python MyScipt -user=USER -pass = password" and the python script will verify the username. I think the sys has a module that allows you to use conditions.