title: Flask socketio split app.py: AttributeError: 'Blueprint' object has no attribute 'wsgi_app'
body: <p>I am using flask socketio for a web socket project and I splited the views using flask <code>blueprint</code>. The issue is that the socketIO is not working correctly and am getting the following error:</p>
  
  <pre><code>/flask_socketio/__init__.py", line 31, in __init__
      flask_app.wsgi_app,
  AttributeError: 'Blueprint' object has no attribute 'wsgi_app'
  </code></pre>
  
  <p>My project structure is a follows:</p>
  
  <pre><code>|-- App
  |   |-- __init__.py
  |   |-- app.py
  |   |-- templates
  |   |   |-- main.html
  |   |   |-- pymeetups.html
  |   -- views
  |       |-- __init__.py
  |       | --- test.py
  |-- __init__.py
  |-- run.py
  </code></pre>
  
  <p>run.py:</p>
  
  <pre><code>from gevent import monkey
  from flask import Flask, render_template, request
  from flask_socketio import SocketIO
  monkey.patch_all()
  
  from App.views import test
  app = Flask(__name__, template_folder='app/templates')
  app.register_blueprint(test.app)
  socketio = SocketIO(app)
  
  if __name__ == '__main__':
      socketio.run(app, "0.0.0.0", port=80)
  </code></pre>
  
  <p>test.py:</p>
  
  <pre><code>from flask import Blueprint, render_template, Flask
  from flask_socketio import SocketIO
  app = Blueprint('app', __name__)
  
  socketio = SocketIO(app)
  
  
  @app.route('/')
  def main():
      return render_template('main.html')
  
  
  @socketio.on('connect', namespace='/dd')
  def ws_conn():
      print("connect")
      socketio.emit('msg', {'count': 1}, namespace='/dd')
  
  
  @socketio.on('disconnect', namespace="/dd")
  def ws_disconn():
      print("disconnect")
  </code></pre>
  
  <p>The issue comes from the test.py file with the statement:</p>
  
  <pre><code>app = Blueprint('app', __name__)
  
  socketio = SocketIO(app)
  </code></pre>
  
  <p>If dont use flask blueprint and combine all into one single file it works perfectly:</p>
  
  <p>app.py:</p>
  
  <pre><code>from gevent import monkey
  from flask import Flask, render_template, request
  from flask_socketio import SocketIO
  monkey.patch_all()
  
  
  app = Flask(__name__)
  socketio = SocketIO(app)
  
  
  @app.route('/')
  def main():
      return render_template('main.html')
  
  
  
  @socketio.on('connect', namespace='/dd')
  def ws_conn():
      socketio.emit('msg', {'count': 1}, namespace='/dd')
  
  
  @socketio.on('disconnect', namespace='/dd')
  def ws_disconn():
      print("Disconnected")
  
  
  
  if __name__ == '__main__':
      socketio.run(app, "0.0.0.0", port=80)
  </code></pre>
  
  <p>How can i split the routes as i expect my application to have lots of functions and it is difficult to manage all function into a single file.?</p>