Remote-Mouse/src/core/__init__.py

58 lines
1.8 KiB
Python

# Python imports
import os, secrets
from datetime import timedelta
# Lib imports
import eventlet
from engineio.payload import Payload
from flask import Flask
from flask_bcrypt import Bcrypt
from flask_socketio import SocketIO
from flask_login import current_user, login_user, logout_user, LoginManager
# Apoplication imports
# Configs and 'init'
app = Flask(__name__)
app.config['TITLE'] = 'RemoteMouse'
app.config['SECRET_KEY'] = "2A#GQafbREoblgMSQYomZSxbaPE6dt#" # For csrf and some other stuff...
# app.config.from_object("core.config.ProductionConfig")
# app.config.from_object("core.config.DevelopmentConfig")
# app.config.from_object("core.config.TestingConfig")
# app.jinja_env.globals['TITLE'] = app.config['TITLE']
# app.config['SECRET_KEY'] = app.config['SECRET_KEY'] # For csrf and some other stuff...
# Some fixers for Websockets
# eventlet.monkey_patch()
# eventlet.debug.hub_prevent_multiple_readers(False)
Payload.max_decode_packets = 120 # Fix too many small packets causing error
# For Websockets
socketio = SocketIO(app, async_mode='eventlet')
# socketio = SocketIO(app, async_mode = 'eventlet',
# cors_allowed_origins = [
# "http://localhost:5000",
# "http://localhost:8088",
# "http://www.remoteconn.com",
# "https://www.remoteconn.com",
# "https://www.remoteconn.com/",
# "http://www.remoteconn.com/"
# ],
# # allow_upgrades = True,
# engineio_logger = True,
# # manage_session = False,
# # cookie = None,
# logger = True,
# )
from core import routes