title: debug Flask server inside Jupyter Notebook
body: <p>I want to debug small flask server inside jupyter notebook for demo.</p>
  
  <p>I created virtualenv on latest Ubuntu and Python2 (on Mac with Python3 this error occurs as well), pip install flask jupyter.</p>
  
  <p>However, when I create a cell with helloworld script it does not run inside notebook. </p>
  
  <pre><code>from flask import Flask
  app = Flask(__name__)
  
  @app.route("/")
  def hello():
      return "Hello World!"
  
  if __name__ == "__main__":
      app.run(debug=True,port=1234)
  </code></pre>
  
  <blockquote>
    <p>File
    "/home/***/test/local/lib/python2.7/site-packages/ipykernel/kernelapp.py",
    line 177, in _bind_socket
        s.bind("tcp://%s:%i" % (self.ip, port))   File "zmq/backend/cython/socket.pyx", line 495, in
    zmq.backend.cython.socket.Socket.bind
    (zmq/backend/cython/socket.c:5653)   File
    "zmq/backend/cython/checkrc.pxd", line 25, in
    zmq.backend.cython.checkrc._check_rc
    (zmq/backend/cython/socket.c:10014)
        raise ZMQError(errno) ZMQError: Address already in use</p>
  </blockquote>
  
  <p>NB - I change the port number after each time it fails.</p>
  
  <p>Sure, it runs as a standalone script.</p>
  
  <p>update  without (debug=True) it's ok.</p>