Updated init structure
This commit is contained in:
parent
280c94274e
commit
077120e9e4
|
@ -1,12 +1,17 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import secrets
|
import os, secrets
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import eventlet
|
import eventlet
|
||||||
|
|
||||||
from engineio.payload import Payload
|
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 import Flask
|
||||||
from flask_bcrypt import Bcrypt
|
from flask_bcrypt import Bcrypt
|
||||||
|
@ -18,13 +23,26 @@ from flask_socketio import SocketIO
|
||||||
|
|
||||||
|
|
||||||
# Configs and 'init'
|
# Configs and 'init'
|
||||||
|
ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config['TITLE'] = 'RemoteMouse'
|
app.config.update({
|
||||||
app.config['SECRET_KEY'] = secrets.token_hex(32) # For csrf and some other stuff...
|
"TITLE": 'RemoteMouse',
|
||||||
|
'DEBUG': False,
|
||||||
|
'SECRET_KEY': secrets.token_hex(32),
|
||||||
|
'PERMANENT_SESSION_LIFETIME': timedelta(days = 7).total_seconds()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
# For Websockets
|
# For Websockets
|
||||||
# eventlet.monkey_patch()
|
socketio = SocketIO(app, async_mode = 'eventlet',
|
||||||
Payload.max_decode_packets = 120 # Fix too many small packets causing error
|
cors_allowed_origins = ["*"],
|
||||||
socketio = SocketIO(app, async_mode='eventlet')
|
path = "socket.io",
|
||||||
|
allow_upgrades = True,
|
||||||
|
manage_session = True,
|
||||||
|
cookie = None,
|
||||||
|
engineio_logger = True,
|
||||||
|
logger = True)
|
||||||
|
|
||||||
|
|
||||||
from core import routes
|
from core import routes
|
||||||
|
|
Loading…
Reference in New Issue