I recover the address of the server with that command : socket.gethostbyname(socket.gethostname())
So, in the file1.py I have :
def main( server_IP, name, version, install_path):
template = open('html.py').read()
c = string.Template(template).substitute(
name = name,
version = version,
install_path = install_path,
os = user_os,
user_name = user_login,
server_IP = socket.gethostbyname(socket.gethostname())
)
in html.py :
<form name="sendData" method="get" action="http://${server_IP}/cgi/scriptGet.py">
When I test this in my own computer, I have 127.0.0.1/cgi....... ( actually : The connection failed when this page is displayed).
How can I be sure to recover the address of the server ?
the server code
import BaseHTTPServer
import CGIHTTPServer
import cgitb; cgitb.enable()
server = BaseHTTPServer.HTTPServer
handler = CGIHTTPServer.CGIHTTPRequestHandler
server_address = ("", 8000)
handler.cgi_directories = ["/cgi"]
httpd = server(server_address, handler)
httpd.serve_forever()