0

Trying to get a flask socketio app going.

Here's my init.py

import os

from flask import Flask, logging
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy

from config import app_config

database = SQLAlchemy()
socket_io = SocketIO()


def create_app(config_name):
    app = Flask(__name__, instance_relative_config=True)
    app.config.from_object(app_config[config_name])
    database.init_app(app)
    socket_io.init_app(app)

    from .home import home as home_blueprint
    app.register_blueprint(home_blueprint)

    return app

and here is my run.py

#!/usr/bin/env python3

import sys
from app import create_app, socket_io

config_name = sys.argv[1]
app = create_app(config_name)

if __name__ == "__main__":
    socket_io.run(app)

When I start up the app, this is the log output in the python console:

C:\AnacondaPython\python.exe D:/workspaces/App/run.py development
 * Restarting with windowsapi reloader
 * Debugger is active!
 * Debugger PIN: 189-233-458

And then nothing happens.

When I open the app in the browser, it just keeps loading.

How do I do this correctly?

I'll provide more code if necessary.

Thanks for any help and tips!

user3629892
  • 2,960
  • 9
  • 33
  • 64

0 Answers0