Setting up the chat client functionality using SocketIO - Start
This commit is contained in:
33
eveai_chat/__init__.py
Normal file
33
eveai_chat/__init__.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import logging
|
||||
import logging.config
|
||||
from flask import Flask
|
||||
from flask_socketio import emit
|
||||
|
||||
from common.extensions import db, socketio
|
||||
from config.logging_config import LOGGING
|
||||
|
||||
|
||||
def create_app(config_file=None):
|
||||
app = Flask(__name__)
|
||||
|
||||
if config_file is None:
|
||||
app.config.from_object('config.config.DevConfig')
|
||||
else:
|
||||
app.config.from_object(config_file)
|
||||
|
||||
logging.config.dictConfig(LOGGING)
|
||||
register_extensions(app)
|
||||
|
||||
return app
|
||||
|
||||
|
||||
def register_extensions(app):
|
||||
db.init_app(app)
|
||||
socketio.init_app(app,
|
||||
message_queue=app.config.get('SOCKETIO_MESSAGE_QUEUE'),
|
||||
cors_allowed_origins=app.config.get('SOCKETIO_CORS_ALLOWED_ORIGINS'),
|
||||
async_mode=app.config.get('SOCKETIO_ASYNC_MODE'),
|
||||
logger=app.config.get('SOCKETIO_LOGGER'),
|
||||
engineio_logger=app.config.get('SOCKETIO_ENGINEIO_LOGGER'),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user