문제

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