mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-24 22:17:03 +01:00
Initial socketio initialization
This commit is contained in:
parent
fb8cfe3abc
commit
e5cdde73b0
@ -12,7 +12,7 @@ cp ~/workspace/webapp/alembic.example.ini ~/workspace/webapp/alembic.ini
|
|||||||
echo "[C9Setup] Installing Titan dependencies"
|
echo "[C9Setup] Installing Titan dependencies"
|
||||||
cd ~/workspace/
|
cd ~/workspace/
|
||||||
sudo python3.5 -m pip install -r requirements.txt
|
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"
|
echo "[C9Setup] Auto populating alembic.ini database url and titan database table"
|
||||||
cd ~/workspace/webapp
|
cd ~/workspace/webapp
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
from titanembeds.app import app
|
from titanembeds.app import app, socketio
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
def init_debug():
|
def init_debug():
|
||||||
@ -41,4 +41,4 @@ def init_debug():
|
|||||||
return "OK"
|
return "OK"
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
init_debug()
|
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)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from run import app, init_debug
|
from run import app, socketio, init_debug
|
||||||
import os
|
import os
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
init_debug()
|
init_debug()
|
||||||
app.run(host=os.getenv('IP', '0.0.0.0'), port=int(os.getenv('PORT', 8080)), debug=True, processes=3)
|
socketio.run(app, host=os.getenv('IP', '0.0.0.0'), port=int(os.getenv('PORT', 8080)), debug=True)
|
@ -2,7 +2,7 @@ from config import config
|
|||||||
from .database import db
|
from .database import db
|
||||||
from flask import Flask, render_template, request, session, url_for, redirect, jsonify
|
from flask import Flask, render_template, request, session, url_for, redirect, jsonify
|
||||||
from flask_sslify import SSLify
|
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
|
from .blueprints import api, user, admin, embed
|
||||||
import os
|
import os
|
||||||
from titanembeds.database import get_administrators_list
|
from titanembeds.database import get_administrators_list
|
||||||
@ -20,6 +20,7 @@ app.secret_key = config['app-secret']
|
|||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
rate_limiter.init_app(app)
|
rate_limiter.init_app(app)
|
||||||
sslify = SSLify(app, permanent=True)
|
sslify = SSLify(app, permanent=True)
|
||||||
|
socketio.init_app(app)
|
||||||
|
|
||||||
app.register_blueprint(api.api, url_prefix="/api", template_folder="/templates")
|
app.register_blueprint(api.api, url_prefix="/api", template_folder="/templates")
|
||||||
app.register_blueprint(admin.admin, url_prefix="/admin", template_folder="/templates")
|
app.register_blueprint(admin.admin, url_prefix="/admin", template_folder="/templates")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from titanembeds.database import db, Guilds, KeyValueProperties, get_keyvalproperty
|
from titanembeds.database import db, Guilds, KeyValueProperties, get_keyvalproperty
|
||||||
from flask import request, session
|
from flask import request, session
|
||||||
from flask_limiter import Limiter
|
from flask_limiter import Limiter
|
||||||
|
from flask_socketio import SocketIO
|
||||||
from config import config
|
from config import config
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
@ -89,3 +90,4 @@ def bot_alive():
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
rate_limiter = Limiter(key_func=get_client_ipaddr) # Default limit by ip address
|
rate_limiter = Limiter(key_func=get_client_ipaddr) # Default limit by ip address
|
||||||
|
socketio = SocketIO()
|
Loading…
Reference in New Issue
Block a user