2012-04-01 5 views
0

wsgiserverのontopを実行しているフラスコを持っています。それは、次の..フラスコのオンタップでwsgiserverをシャットダウンする方法

d = wsgiserver.WSGIPathInfoDispatcher({'/': app}) 
server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 7000), d) 

if __name__ == '__main__': 

    try: 
     server.start() 

    except KeyboardInterrupt: 
     server.stop() 

私はそれをどのように停止しないで開始されましたか?だから..

@app.route('/stop') 
@requires_auth 
def stop(): 
    CODE TO STOP HERE 

私は高と低を検索し、私が見つけたものは何も働いていない。助けてもらえますか?おかげ

答えて

0

あなたはこのような何かを行うことができる必要があります:

def run(): 
    d = wsgiserver.WSGIPathInfoDispatcher({'/': app}) 
    server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 7000), d) 

    @app.route('/stop') 
    @requires_auth 
    def stop(): 
     server.stop() 

    try: 
     server.start() 

    except KeyboardInterrupt: 
     server.stop() 

if __name__ == '__main__': 
    run() 
関連する問題