Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PYTHON Web服务器守护程序_Python_Http_Server_Cgi - Fatal编程技术网

PYTHON 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_

下面的代码是我编写的一个Web服务器

#!/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)