Updated init structure

This commit is contained in:
Maxim Stewart 2020-11-22 17:00:20 -06:00
parent 280c94274e
commit 077120e9e4
1 changed files with 25 additions and 7 deletions

View File

@ -1,12 +1,17 @@
# Python imports
import secrets
import os, secrets
from datetime import timedelta
# Lib imports
import eventlet
from engineio.payload import Payload
# Some fixrs for Websockets
eventlet.monkey_patch()
# eventlet.debug.hub_prevent_multiple_readers(False)
Payload.max_decode_packets = 120 # Fix too many small packets causing error
from flask import Flask
from flask_bcrypt import Bcrypt
@ -18,13 +23,26 @@ from flask_socketio import SocketIO
# Configs and 'init'
ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__))
app = Flask(__name__)
app.config['TITLE'] = 'RemoteMouse'
app.config['SECRET_KEY'] = secrets.token_hex(32) # For csrf and some other stuff...
app.config.update({
"TITLE": 'RemoteMouse',
'DEBUG': False,
'SECRET_KEY': secrets.token_hex(32),
'PERMANENT_SESSION_LIFETIME': timedelta(days = 7).total_seconds()
})
# For Websockets
# eventlet.monkey_patch()
Payload.max_decode_packets = 120 # Fix too many small packets causing error
socketio = SocketIO(app, async_mode='eventlet')
socketio = SocketIO(app, async_mode = 'eventlet',
cors_allowed_origins = ["*"],
path = "socket.io",
allow_upgrades = True,
manage_session = True,
cookie = None,
engineio_logger = True,
logger = True)
from core import routes