Example #1
0
def ipython_apprun():
    """For interactive debugging with ipython
    """
    global appthread
    if not "appthread" in globals():

        def start():
            from IPython.Shell import IPShellEmbed

            IPShellEmbed(argv=[], user_ns=globals())()
            import thread

            appthread.STOPIT = True
            thread.interrupt_main()

        appthread = Thread(target=start)
        appthread.start()
        appthread.STOPIT = False
        sys.argv = ["", ARGS.port]
        while not appthread.STOPIT:
            try:
                app.run()
            except KeyboardInterrupt:
                continue