Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ceopardy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@
# flask-cors is optional; prod serves everything from the same origin.
pass

# Use threading mode so the WSGI layer stays plain Werkzeug — its debugger
# and exception logging just work. If someone fronts this with gunicorn
# (see README), they pick the worker class at the CLI level (-k eventlet).
socketio = SocketIO(
app,
cors_allowed_origins="*",
async_mode="eventlet",
async_mode="threading",
)
db = SQLAlchemy(app)

Expand Down
5 changes: 4 additions & 1 deletion ceopardy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def _cmd_serve(args):
print(f" Host: http://localhost:{port}/host")
if debug:
print(" Debug: ON (verbose logging + auto-reload)")
socketio.run(app, host=host, port=port, debug=debug)
# Werkzeug is the only WSGI server we use here. Flask-SocketIO refuses it
# by default; we opt in because Ceopardy is meant for single-operator
# local use (binds to 127.0.0.1, see README on exposing via nginx).
socketio.run(app, host=host, port=port, debug=debug, allow_unsafe_werkzeug=True)


def _walk(traversable, prefix=""):
Expand Down
10 changes: 9 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@
# debug=False.
# WARNING: This app is not ready to be exposed on the network.
# Game host interface would be exposed.
socketio.run(app, host="127.0.0.1", port=5000, debug=True)
# allow_unsafe_werkzeug: Flask-SocketIO refuses Werkzeug otherwise. See
# the same opt-in (and rationale) in ceopardy/__main__.py:_cmd_serve.
socketio.run(
app,
host="127.0.0.1",
port=5000,
debug=True,
allow_unsafe_werkzeug=True,
)
Loading