diff --git a/cloud9_install.sh b/cloud9_install.sh index e6e2c6f..e6fd011 100644 --- a/cloud9_install.sh +++ b/cloud9_install.sh @@ -12,7 +12,7 @@ cp ~/workspace/webapp/alembic.example.ini ~/workspace/webapp/alembic.ini echo "[C9Setup] Installing Titan dependencies" cd ~/workspace/ sudo python3.5 -m pip install -r requirements.txt -sudo python3.5 -m pip install alembic pymysql +sudo python3.5 -m pip install alembic pymysql gevent uwsgi echo "[C9Setup] Auto populating alembic.ini database url and titan database table" cd ~/workspace/webapp diff --git a/webapp/run.py b/webapp/run.py index 9d611b3..7f2f6f3 100644 --- a/webapp/run.py +++ b/webapp/run.py @@ -1,5 +1,5 @@ #!/usr/bin/env python2 -from titanembeds.app import app +from titanembeds.app import app, socketio import subprocess def init_debug(): @@ -41,4 +41,4 @@ def init_debug(): return "OK" if __name__ == "__main__": init_debug() - app.run(host="0.0.0.0",port=3000,debug=True,processes=3) + socketio.run(app, host="0.0.0.0",port=3000,debug=True) diff --git a/webapp/run_c9.py b/webapp/run_c9.py index 68a161e..c934894 100644 --- a/webapp/run_c9.py +++ b/webapp/run_c9.py @@ -1,6 +1,6 @@ -from run import app, init_debug +from run import app, socketio, init_debug import os if __name__ == "__main__": init_debug() - app.run(host=os.getenv('IP', '0.0.0.0'), port=int(os.getenv('PORT', 8080)), debug=True, processes=3) \ No newline at end of file + socketio.run(app, host=os.getenv('IP', '0.0.0.0'), port=int(os.getenv('PORT', 8080)), debug=True) \ No newline at end of file diff --git a/webapp/titanembeds/app.py b/webapp/titanembeds/app.py index efbd9e0..2840149 100644 --- a/webapp/titanembeds/app.py +++ b/webapp/titanembeds/app.py @@ -2,7 +2,7 @@ from config import config from .database import db from flask import Flask, render_template, request, session, url_for, redirect, jsonify from flask_sslify import SSLify -from titanembeds.utils import rate_limiter, discord_api, bot_alive +from titanembeds.utils import rate_limiter, discord_api, bot_alive, socketio from .blueprints import api, user, admin, embed import os from titanembeds.database import get_administrators_list @@ -20,6 +20,7 @@ app.secret_key = config['app-secret'] db.init_app(app) rate_limiter.init_app(app) sslify = SSLify(app, permanent=True) +socketio.init_app(app) app.register_blueprint(api.api, url_prefix="/api", template_folder="/templates") app.register_blueprint(admin.admin, url_prefix="/admin", template_folder="/templates") diff --git a/webapp/titanembeds/utils.py b/webapp/titanembeds/utils.py index 0f67653..7c5f7a4 100644 --- a/webapp/titanembeds/utils.py +++ b/webapp/titanembeds/utils.py @@ -1,6 +1,7 @@ from titanembeds.database import db, Guilds, KeyValueProperties, get_keyvalproperty from flask import request, session from flask_limiter import Limiter +from flask_socketio import SocketIO from config import config import random import string @@ -89,3 +90,4 @@ def bot_alive(): return results rate_limiter = Limiter(key_func=get_client_ipaddr) # Default limit by ip address +socketio = SocketIO() \ No newline at end of file