Remote-Mouse/src/core/__init__.py

52 lines
1.3 KiB
Python
Raw Permalink Normal View History

2020-05-28 18:07:53 +00:00
# Python imports
2021-08-03 03:35:19 +00:00
import os, secrets
from datetime import timedelta
2020-05-28 18:07:53 +00:00
# Lib imports
2020-06-12 03:38:20 +00:00
import eventlet
2021-07-19 02:59:33 +00:00
from engineio.payload import Payload
2020-11-22 23:00:20 +00:00
2020-05-28 18:07:53 +00:00
from flask import Flask
from flask_bcrypt import Bcrypt
2020-06-12 03:38:20 +00:00
from flask_socketio import SocketIO
2021-08-03 03:35:19 +00:00
from flask_login import current_user, login_user, logout_user, LoginManager
2020-05-28 18:07:53 +00:00
# Apoplication imports
2021-08-03 03:35:19 +00:00
2020-05-28 18:07:53 +00:00
# Configs and 'init'
app = Flask(__name__)
2021-08-09 18:29:27 +00:00
app.config.from_object("core.config.ProductionConfig")
2021-08-03 03:35:19 +00:00
# app.config.from_object("core.config.DevelopmentConfig")
# app.config.from_object("core.config.TestingConfig")
2021-08-09 18:29:27 +00:00
app.jinja_env.globals['TITLE'] = app.config['TITLE']
2021-08-03 03:35:19 +00:00
# Some fixers for Websockets
2021-07-19 02:59:33 +00:00
# eventlet.monkey_patch()
2021-08-03 03:35:19 +00:00
# eventlet.debug.hub_prevent_multiple_readers(False)
2021-07-19 02:59:33 +00:00
Payload.max_decode_packets = 120 # Fix too many small packets causing error
2021-08-03 03:35:19 +00:00
# For Websockets
2021-08-09 18:29:27 +00:00
socketio = SocketIO(app, async_mode = 'eventlet',
cors_allowed_origins = [
"http://remoteconn.com",
"https://remoteconn.com",
"http://www.remoteconn.com",
"https://www.remoteconn.com"
],
allow_upgrades = True,
engineio_logger = False,
logger = True,
# manage_session = False,
# cookie = None
)
2021-08-03 03:35:19 +00:00
2020-11-22 23:40:18 +00:00
2020-05-28 18:07:53 +00:00
from core import routes