PYTHON Web服务器守护程序
下面的代码是我编写的一个Web服务器PYTHON Web服务器守护程序,python,http,server,cgi,Python,Http,Server,Cgi,下面的代码是我编写的一个Web服务器 #!/usr/bin/python import BaseHTTPServer import CGIHTTPServer server = BaseHTTPServer.HTTPServer handler = CGIHTTPServer.CGIHTTPRequestHandler server_address = ("", 80) handler.cgi_dicrectories = ["/cgi"] httpd = server(server_
#!/usr/bin/python
import BaseHTTPServer
import CGIHTTPServer
server = BaseHTTPServer.HTTPServer
handler = CGIHTTPServer.CGIHTTPRequestHandler
server_address = ("", 80)
handler.cgi_dicrectories = ["/cgi"]
httpd = server(server_address, handler)
try:
httpd.serve_forever()
except KeyboardInterrupt:
httpd.shutdown()
问题是每次我使用它时,我都必须启动它。
我如何让它变成恶魔并在后台工作?试试下一个:
gunicorn -D -b 127.0.0.1:80 -w 9 -c file_name.py customapp:application
或者使用手动配置它,您可以在python上使用或编写守护进程(请参见a)