<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-family: Verdana,Geneva,sans-serif'>
<p>On 2014-02-28 20:26, jackychen wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">hi, <br /> I have commit a patch to sync notifier module under horizon with oslo-incubator, I met the gate-horizon-python error, all the errors are aimed at DatabseError.<br /> Code Review Link: <a class="moz-txt-link-freetext" href="https://review.openstack.org/#/c/76439/">https://review.openstack.org/#/c/76439/</a><br /><br /> The specific error: django.db.utils.DatabaseError: DatabaseWrapper objects created in a thread can only be used in that same thread. The object with alias 'default' was created in thread id 140664492599040 and this is thread id 56616752.<br /><br /> So I have google it and find that there are two ways to fix this<br /><br /> 1. <a class="moz-txt-link-freetext" href="https://code.djangoproject.com/ticket/17998">https://code.djangoproject.com/ticket/17998</a><br /> import eventlet<br /> eventlet.monkey_patch()<br /><br /> 2.https://bitbucket.org/akoha/django-digest/issue/10/conflict-with-global-databasewrapper<br /> replace<br /> cursor = self.db.connection.cursor()<br /> with<br /> cursor = db.connections[DEFAULT_DB_ALIAS].cursor()<br /> everywhere it appears in storage.py, and add to the imports:<br /> from django import db from django.db.utils import DEFAULT_DB_ALIAS<br /><br /> Anyway, all these two solution are all not can be handled in my code commit, <br /> So do you have any point of view to make this work?<br /> Thanks for all your help.<br /><br /></blockquote>
<pre><br />I believe that in other projects we monkeypatch eventlet, but I don't know for sure if that's the appropriate fix here.  Adding oslo and db tags so those people will see this too.<br /><br />-Ben<br />
</pre>
<p> </p>
<div> </div>
</body></html>