Add socketio.

This commit is contained in:
Patrick Jentsch 2019-08-21 14:41:38 +02:00
parent 3a6fdaa24b
commit bfe28eca61
4 changed files with 11 additions and 3 deletions

View File

@ -1,2 +1,2 @@
FLASK_APP=opaque.py
#FLASK_APP=opaque.py
FLASK_ENV=development

View File

@ -3,6 +3,7 @@ from flask import Flask
from flask_apscheduler import APScheduler
from flask_login import LoginManager
from flask_mail import Mail
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy
@ -11,6 +12,7 @@ login_manager = LoginManager()
login_manager.login_view = 'auth.login'
mail = Mail()
scheduler = APScheduler()
socketio = SocketIO()
def create_app(config_name):
@ -23,6 +25,7 @@ def create_app(config_name):
mail.init_app(app)
scheduler.init_app(app)
scheduler.start()
socketio.init_app(app)
from .api import api as api_blueprint
app.register_blueprint(api_blueprint, url_prefix='/api')

View File

@ -1,13 +1,16 @@
from app import create_app, db
from app import create_app, db, socketio
from app.models import Corpus, User, Role, Permission, Job
from flask_migrate import Migrate
import os
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
migrate = Migrate(app, db)
if __name__ == '__main__':
socketio.run(app)
@app.shell_context_processor
def make_shell_context():
return dict(db=db,

View File

@ -1,9 +1,11 @@
docker==4.0.2
eventlet==0.25.0
Flask==1.0.3
Flask-APScheduler==1.11.0
Flask-Login==0.4.1
Flask-Mail==0.9.1
Flask-Migrate==2.5.2
Flask-SocketIO==4.2.1
Flask-SQLAlchemy==2.4.0
Flask-Table==0.5.0
Flask-WTF==0.14.2