mikeabrahamsen/Flask-Meld

example error 'Flask' object has no attribute 'socketio'

Closed this issue · 0 comments

The example cause this error

Traceback (most recent call last):
  File "wsgi.py", line 6, in <module>
    socketio = app.socketio
AttributeError: 'Flask' object has no attribute 'socketio'

I fixed putting scoketio initialization after meld initialization

from flask import Flask, render_template
from flask_meld import Meld

app = Flask(__name__)
app.config['SECRET_KEY'] = 'big!secret'

meld = Meld()
meld.init_app(app)

socketio = app.socketio

@app.route('/')
def index():
    return render_template("base.html")

if __name__ == '__main__':
    socketio.run(app)