2012-08-28 5 views
5

イムは、私は罰金をやってチュートリアルhelloworld.py、すべてを始めたが、私はservice.iの使用を終了する方法がわからないcherrypyサーバーをシャットダウンする方法は? win7の上

quit() 

が、コマンドラインは私にエラーメッセージを与えるとexit.butサービスはまだ稼働しており、8080ポートを使用しています。私は手動でシャットダウンする方法を見つけていませんでした。

File "C:\python32\lib\site-packages\cherrypy\process\wspbus.py", line 197, in 
publish 
    output.append(listener(*args, **kwargs)) 
    File "C:\python32\lib\site-packages\cherrypy\_cpserver.py", line 151, in start 

    ServerAdapter.start(self) 
    File "C:\python32\lib\site-packages\cherrypy\process\servers.py", line 167, in 
start 
    wait_for_free_port(*self.bind_addr) 
    File "C:\python32\lib\site-packages\cherrypy\process\servers.py", line 410, in 
wait_for_free_port 
    raise IOError("Port %r not free on %r" % (port, host)) 
IOError: Port 8080 not free on '0.0.0.0' 

答えて

4

this pageによると、quit()は、この作業には適していません。

あなたのサーバを実行する方法に応じて、あなたはcherrypy.engine.exitを使用して検討する必要があります。

>>> help(cherrypy.engine.exit) 
exit(self) method of cherrypy.process.win32.Win32Bus instance 
    Stop all services and prepare to exit the process. 
4

あなたのpythonファイルでこれを含めます。

@cherrypy.expose 

def shutdown(self): 
    cherrypy.engine.exit() 

あなたのページにリンクを追加してください。

<a id="shutdown"; href="./shutdown">Shutdown Server</a> 
関連する問題