I have an application that requires configuration before it is started. For these configuration steps I have implemented another application, that will be run once for setting up the system. Now, configuration application needs to stop web2py server after it is done. I could not find anything in documentation or mail lists.

Is it possible to stop web2py, i.e. shutdown server, inside a controller function?

有帮助吗?

解决方案

It sounds like you want to do something that I'd have to recommend against.

If you want to throw caution to the wind put this in your controller action:

import os
os._exit(0)

sys.exit() won't work because of the way controllers are executed (with exceptions being caught for ticket reporting).

os._exit() doesn't get caught because it immediately terminates the process; USE WITH CAUTION.

Best of luck to you

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top