Python with CGI and WEB

Asked

Viewed 72 times

0

I made a simple code in python that displays on a web page the version of the user’s operating system and configured my web server that runs on linux to be compatible with CGI. My webserver runs on a Windows machine.

    import cgi, cgitb 
    import platform

    form = cgi.FieldStorage() 
    print "Content-type:text/html\r\n\r\n"
    print "<html>"
    print "<head>"

    plataforma = platform.system()
    versao = platform.release()
    sistema= plataforma+" "+versao

    print "<h2>Seu sistema operacional e %s</h2>" % (sistema)
    print "</head>"
    print "<body>"
    print "</body>"
    print "</html>" 

It’s something very simple just to understand how CGI works with python, but when I open this page on a Linux machine for example, give me the message that I use the windows version of my Web Server.

My question is, does CGI run on the server and not on the client? For example, a python code in the same style that downloads a file, would it download to the server and not to the client? Have some other way to make CGI run locally or would have to use another methodology?

  • 1

    You understand how the HTTP protocol works?

  • Related https://answall.com/q/93308/101

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.