Ticket #2407: CGI_Server.py

File CGI_Server.py, 1.2 KB (added by Martin, 18 years ago)

The CGI Server classes

Line 
1import django
2import sys
3from django.core.servers.basehttp import ServerHandler
4
5__all__ = ["CGI_Server_Handler"]
6
7__version__ = "0.1".strip ()
8sys_version = sys.version.split () [0]
9software_version = "CGI_Wrapper/%s Python/%s" % (__version__, sys_version)
10
11class CGI_Server_Handler (ServerHandler) :
12 """A simpuated CGI server"""
13
14 origin_server = False
15 default_settings_module = "settings"
16 server_software = software_version
17 status = "500"
18
19 def __init__ (self, environ, * path) :
20 sys.path.extend (path)
21 key = "DJANGO_SETTINGS_MODULE"
22 if key not in environ :
23 environ [key] = self.default_settings_module
24 self.request_handler = self
25 super (CGI_Server_Handler, self).__init__ \
26 ( sys.stdin, sys.stdout, sys.stderr, environ
27 , multithread = False
28 , multiprocess = False
29 )
30 # end def __init__
31
32 def run (self, cls) :
33 super (CGI_Server_Handler, self).run (cls ())
34 # end def run
35
36 def log_request (self, status, bytes) :
37 pass ### for now, ignore it
38 # end def log_request
39
40# end class CGI_Server_Handler
Back to Top