Как перенаправлять по запросу GET на CGI скрипт?
# -*- coding: utf-8 -*- import BaseHTTPServer import CGIHTTPServer from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer server_address = ("192.168.1.*", 80) class HttpProcessor(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories = [ "/cgi-bin", "/cgi"] def do_GET(self): try: if not self.path == "/cgi/app.py": self.send_response(301) self.send_header("Location", "/cgi/app.py") self.end_headers() else: print "test" except IOError: self.send_error(404,"File Not Found: %s" % self.path) httpd = BaseHTTPServer.HTTPServer(server_address, HttpProcessor) httpd.serve_forever()
Добавляю обратно do_GET, оно перенаправляет на адрес, но сам скрипт становится недоступен. Ни напрямую, ни с перенаправлением.