BrickTracker/app.py
2025-01-17 11:03:00 +01:00

39 lines
864 B
Python

# This need to be first
import eventlet
eventlet.monkey_patch()
import logging # noqa: E402
from flask import Flask # noqa: E402
from bricktracker.app import setup_app # noqa: E402
from bricktracker.socket import BrickSocket # noqa: E402
logger = logging.getLogger(__name__)
if __name__ == '__main__':
# Create the Flask app
app = Flask(__name__)
# Setup the app
setup_app(app)
# Create the socket
s = BrickSocket(
app,
threaded=not app.config['NO_THREADED_SOCKET'].value,
)
# Run the application
logger.info('Starting BrickTracker on {host}:{port}'.format(
host=app.config['HOST'].value,
port=app.config['PORT'].value,
))
s.socket.run(
app,
host=app.config['HOST'].value,
debug=app.config['DEBUG'].value,
port=app.config['PORT'].value,
)