I'm writing on a simple dragon web-server windows
this works but now I Dynamic script (php or py) and not just HTML pages.
Here's my code:
BaseHTTPServer import HTTPServer CGIHTTPServer import CGIHTTPRequestHandler from square RequestsHandler (from CGIHTTPRequestHandler): cgi_directories = ["/ www"] #to do_GET (own) Run all the scripts in the DEF '/ www' folder: try: f = open (curdir + September + '/ www' + self.path) self. Send_response (200) self.send_header ('content Self-index_error (404, "Page '% s' not found) "% Self.path) DEF Main (): Try: Server = HTTPServer ((', 80), RequestsHandler) server.serve_forever () except for KeyboardInterrupt: server.socket.close (), then __name__ ==' __main__ ': main () If I put php code in the www folder then I get the page but the code does not mean
what do I have to do for? Thank you
I think you are more than engineering
# / Usr / bin / env dragon import CGIHTTPServer def (main): SERVER_ADDRESS = (', 8000) handler = CGIHTTPServer.CGIHTTPRequestHandler handler.cgi_directories = [' / cgi '] server = CGIHTTPServer.BaseHTTPServer.HTTPServer (server_address, handler) : Except for server.serve_forever () KeyboardInterrupt: server.socket.close () if __name__ == '__main__': main ()
Comments
Post a Comment