stopping SimpleHTTPServer

François Pinard pinard at iro.umontreal.ca
Tue Nov 19 08:26:31 EST 2002


[dsavitsk]

> I have an application built on BaseHTTPServer.  Much of the code
> is borrowed from SimpleHTTPServer (hence the subject).  In general,
> it runs on its own, but it can serve an admin web page and respond to
> requests made therefrom.  The problem I am having is that I can't kill
> it remotely.  I put in a sys.exit(), but that didn't do any good. Can
> anyone suggest a good way?  Actually, I would like a way to kill it
> from a command line as well.

One may use some special URLs as triggers to the server.  In more complex
applications, you might combine the above idea with HTML forms meant to
drive the server itself.

Another possibility, that you could implement independently of the two
above, is to trap some signals in the server that could be sent externally,
then set flags to be obeyed at the next interaction.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list