Skip to content

Commit 7a7595c

Browse files
authored
Fix flask run by not monkey patching for gevent in wsgi.py (CTFd#1101)
* Fixes `flask run` debug server by not monkey patching in `wsgi.py` * Closes CTFd#1099
1 parent 3b1b82b commit 7a7595c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

wsgi.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
from gevent import monkey
2-
monkey.patch_all()
1+
import os
2+
3+
# Detect if we're running via `flask run` and don't monkey patch
4+
if not os.getenv("FLASK_RUN_FROM_CLI"):
5+
from gevent import monkey
6+
7+
monkey.patch_all()
8+
39
from CTFd import create_app
410

511
app = create_app()
612

7-
if __name__ == '__main__':
13+
if __name__ == "__main__":
814
app.run(debug=True, threaded=True, host="127.0.0.1", port=4000)

0 commit comments

Comments
 (0)