I’m looking at writing a portable, light-weight Python app. As the “GUI toolkit” I’m most familiar with — by a wide margin! — is HTML/CSS/JS, I thought to use Django as a framework for the project, using its built-in “development server” (manage.py runserver).
I’ve been banging on a proof-of-concept for a couple hours and the only real problem I’ve encountered so far is shutting down the server once the user has finished using the app. Ideally, I’d like there to be a link on the app’s pages which shuts down the server and closes the page, but nothing I see in the Django docs suggests this is possible.
Can this be done? For that matter, is this a reasonable approach for writing a small, portable GUI tool?
One brute force approach would be to let the process kill itself, like:
Note:
os.killis only available on Unix (Windows alternative may be something like this: http://metazin.wordpress.com/2008/08/09/how-to-kill-a-process-in-windows-using-python/)