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)
Thanks for the post. I had the same problem on pyramid/akhet. Using this information fixed my issue as well.
Thanks for this. I’ve been trying to figure out why my project kept failing with this message. +1
Thanks, this fix worked.
BTW, if you’re not using Django, and just running a python script, put these lines in your script instead of manage.py
Thanks so much! Came across the same issue while using gevent for a long-polling chat room. Resolved it instantly.