Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gunicorn reload option doesn't work with flask-socketIO #2089

Open
Andrew-Rand opened this issue Sep 9, 2024 · 1 comment
Open

Gunicorn reload option doesn't work with flask-socketIO #2089

Andrew-Rand opened this issue Sep 9, 2024 · 1 comment

Comments

@Andrew-Rand
Copy link

Andrew-Rand commented Sep 9, 2024

Hello!

I try to use flask-socketio with gunicorn and at it works well. But when i try to use reload mod for debbuging, autoreload doesn't work on code changes. It happens only if i run socketio. I use eventlet as you recommend.

Example:

from flask import Flask
from flask_socketio import SocketIO

app = Flask('app')

socketio = SocketIO()

socketio.init_app(
app,
message_queue='redis://redis:6379/0',
logger=False,
engineio_logger=False,
cors_allowed_origins='*',
async_mode='eventlet',
)
socketio.run(app, port=5005)

run in terminal

gunicorn --worker-class eventlet -w 6 main:app --reload

My dependecies:

Python 3.11.9

flask==1.0.3
jinja2==2.11.2
packaging==21.3
gunicorn==22.0.0
markupsafe==1.1.1
itsdangerous==1.1.0
six==1.15.0
dnspython==2.1.0
eventlet==0.33.0
greenlet==2.0.2
flask-socketio==5.3.7
werkzeug==0.16.1
flask-redis==0.4.0

Thank you!

@Andrew-Rand Andrew-Rand changed the title Gunicorn reload option doesn't worl with flask-socketIO Gunicorn reload option doesn't work with flask-socketIO Sep 9, 2024
@miguelgrinberg
Copy link
Owner

I have no control over when Gunicorn decides to reload. The Flask reloader is supported and to my knowledge works fine.

I use eventlet as you recommend.

I haven't recommended eventlet in the last several years. In fact eventlet is a bad choice to use because it is a dying project. See https://eventlet.readthedocs.io/en/latest/ for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants