Skip to content

Commit

Permalink
Fix flask run by not monkey patching for gevent in wsgi.py (#1101)
Browse files Browse the repository at this point in the history
* Fixes `flask run` debug server by not monkey patching in `wsgi.py`
* Closes #1099
  • Loading branch information
ColdHeat committed Sep 5, 2019
1 parent 3b1b82b commit 7a7595c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions wsgi.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from gevent import monkey
monkey.patch_all()
import os

# Detect if we're running via `flask run` and don't monkey patch
if not os.getenv("FLASK_RUN_FROM_CLI"):
from gevent import monkey

monkey.patch_all()

from CTFd import create_app

app = create_app()

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

0 comments on commit 7a7595c

Please sign in to comment.