From c3f3ed0593a8eca9bf149a3948c1108f733aca00 Mon Sep 17 00:00:00 2001 From: Gregoo Date: Fri, 17 Jan 2025 14:36:19 +0100 Subject: [PATCH] Fix app init to work with gunicorn --- Dockerfile | 2 +- app.py | 24 ++++++++++++------------ entrypoint.sh | 0 3 files changed, 13 insertions(+), 13 deletions(-) mode change 100644 => 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 3aab4f5..53c5cda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,4 +9,4 @@ RUN pip install -r requirements.txt # Bricktracker COPY . . -ENTRYPOINT ["entrypoint.sh"] +ENTRYPOINT ["./entrypoint.sh"] diff --git a/app.py b/app.py index 40f3000..2077083 100644 --- a/app.py +++ b/app.py @@ -11,20 +11,20 @@ from bricktracker.socket import BrickSocket # noqa: E402 logger = logging.getLogger(__name__) +# 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, +) + 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, diff --git a/entrypoint.sh b/entrypoint.sh old mode 100644 new mode 100755