im on win7 ,i started a tutorial helloworld.py and everything doing fine but i don't know how to quit the service.i use
quit()
but command line give me an error message and exit.but service is still running and take my 8080 port. i hadn't find a way to shut down it manually.
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'
According to this page, quit()
is not appropriate for this task.
Depending on how you run your server, you should consider using 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.
Include this in your python file.
@cherrypy.expose
def shutdown(self):
cherrypy.engine.exit()
Then add a link on your page.
<a id="shutdown"; href="./shutdown">Shutdown Server</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With