confirm socketio run app

This commit is contained in:
Sorrel Bri 2019-10-07 10:19:48 -07:00
parent 1f877fddbe
commit 44d365199f
3 changed files with 8 additions and 4 deletions

6
app.py
View file

@ -16,8 +16,10 @@ app.config.from_object(DevelopmentConfig)
socketio = SocketIO(app) socketio = SocketIO(app)
def create_app(): def create_app():
CORS(app, resources={r"/api/*": {"origins": "http://localhost:3000"}, CORS(app, resources={
r"/auth/*": {"origins": "http://localhost:3000"}}) r"/api/*": {"origins": "http://localhost:3000"},
r"/auth/*": {"origins": "http://localhost:3000"}
})
db.init_app(app) db.init_app(app)
ma.init_app(app) ma.init_app(app)
return app return app

View file

@ -12,6 +12,8 @@ Flask-Script==2.0.6
Flask-SocketIO==4.2.1 Flask-SocketIO==4.2.1
Flask-SQLAlchemy==2.4.1 Flask-SQLAlchemy==2.4.1
Flask-Testing==0.7.1 Flask-Testing==0.7.1
gevent==1.4.0
greenlet==0.4.15
isort==4.3.21 isort==4.3.21
itsdangerous==1.1.0 itsdangerous==1.1.0
Jinja2==2.10.1 Jinja2==2.10.1

View file

@ -1,4 +1,4 @@
from app import create_app, db from app import create_app, db, socketio
# Blueprints # Blueprints
from api.api import api from api.api import api
@ -14,4 +14,4 @@ if __name__ == '__main__':
app.register_blueprint(api) app.register_blueprint(api)
app.register_blueprint(auth) app.register_blueprint(auth)
migrate = Migrate(app, db) migrate = Migrate(app, db)
app.run(port=8000, debug=True) socketio.run(app)