Throwing the following DatabaseError in Django 1.5.1 (and 1.5.0) and mysql when I runserver and attempt to load a local version of the web app:
DatabaseError at /
DatabaseWrapper objects created in a thread can only be used in that same thread. The object with alias 'default' was created in thread id 4365488128 and this is thread id 140735183980896.
The exception location is as follows:
/Users/USERNAME/.envs/PROJECT_NAME/lib/python2.7/site-packages/django/db/backends/init.py in validate_thread_sharing, line 154
This happens only on the first page load. When I hit refresh the the web app loads as expected. The error returns when I alter Django/python code and the local server needs to re-validate. When that happens the first load once again throws the DatabaseError and subsequent loads once again do not.
This issue is only happening on my Django 1.5 projects. I've uninstalled mysql and cleared the mysql binary files located in /usr/local/var/mysql. A fresh install of mysql has not solved this issue.
A similar DatabaseError is discussed here but I'm not able to follow their solution:
https://code.djangoproject.com/ticket/17998
I'm at a loss here, any ideas or expertise would be appreciated. Thank you.