2017-06-07 3 views
0

Le code suivant est un WebServer écrit par moi.PYTHON WebServer Daemon

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

Le problème est que chaque fois que je l'utilise, je dois le lancer. Comment puis-je le transformer en Démon et le faire fonctionner en arrière-plan?

Répondre

0

Essayez le suivant:

gunicorn -D -b 127.0.0.1:80 -w 9 -c file_name.py customapp:application 

Ou configurer sur votre propre avec http://gunicorn.org manuel