Пример #1
0
def runserver():
    while True:
        try:
            ComicsApp.run(port=9000)
#            WSGIServer(ComicsApp()).run()                
        except:
            pass
Пример #2
0
    os.unlink('./server.pid')
    os.sys.exit(0)
  except:
    pass


#signals = (signal.SIGINT, signal.SIGHUP, signal.SIGQUIT, signal.SIGTERM, signal.SIGKILL)
#signals = (signal.SIGINT, signal.SIGHUP, signal.SIGQUIT, signal.SIGTERM)
signals = (signal.SIGINT, signal.SIGHUP, signal.SIGQUIT)

for s in signals:
  signal.signal(s, sig_handler)
  
#signal.signal(signal.SIGINT, sig_handler)
#signal.signal(signal.SIGHUP, sig_handler)
#signal.signal(signal.SIGQUIT, sig_handler)
#signal.signal(signal.SIGTERM, sig_handler)
#signal.signal(signal.SIGKILL, sig_handler)

pid = os.getpid()
pidfile = open('./server.pid', 'w')
pidfile.write("%s" % pid)
pidfile.close()

try:
    ComicsApp.run(port = 20086)
except:
    pass