Django runserver and gevent; NotImplementedError: gevent is only usable from a single thread

Hey. So I ran into a problem when using Django runserver and Requests for Python. Specifically, when running runserver, I came across the error:

NotImplementedError: gevent is only usable from a single thread

To fix this, you need to run the gevent monkey patch in your projects manage.py.

Add the following lines in the __main__ of your manage.py

from gevent import monkey
monkey.patch_all()

Your main will look as follows:

if __name__ == "__main__":
    import gevent
    from gevent import monkey
    monkey.patch_all()
    execute_manager(settings)

4 thoughts on “Django runserver and gevent; NotImplementedError: gevent is only usable from a single thread”

  1. Thanks so much! Came across the same issue while using gevent for a long-polling chat room. Resolved it instantly.

Leave a Reply

Your email address will not be published. Required fields are marked *