#22297 closed New feature (fixed)
TransactionMiddleware signals connection_created too early
| Reported by: | no | Owned by: | nobody |
|---|---|---|---|
| Component: | Uncategorized | Version: | 1.6 |
| Severity: | Normal | Keywords: | |
| Cc: | no | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
This may or may not be a django bug.
I have a project that uses django_hstore, which relies on connection_created in order to register the database adapters for hstore conversion with postgresql. With TransactionMiddleware the signal seems to be called before all the INSTALLED_APPS are loaded, thus it is called before django_hstore is loaded.
I am able to reproduce this issue with
python 2.7.5
django 1.6.2
django-hstore 1.2.2
uwsgi 2.0.3
psycopg2 2.5.2
Unfortunately, it can't be reproduced with manage.py runserver because it validates the models, which loads the apps before the signal is called.
I've attached a test project with the following setup:
- Create a postgres database named
hstore_test_dbwith user/password as test/test - Run syncdb
- Run manage.py shell
from main.models import TestModel; TestModel.objects.create(dict_field= {'key' : 1 })- Run uwsgi with the following settings:
uwsgi --http :8000 --module hstore_test.wsgi --chdir $(pwd) --home $VIRTUAL_ENV --e DJANGO_SETTINGS_MODULE=hstore_test.settings
Note: the error only occurs on the first page load after starting uwsgi. It fails to error on any subsequent refresh.
Attachments (1)
Change History (3)
by , 12 years ago
| Attachment: | hstore_test.tar.gz added |
|---|
comment:1 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
This will be fixed by app-loading in 1.7 ;-)
Look for the wall of text on the DevelopersMailingList for details.
comment:2 by , 12 years ago
| Cc: | added |
|---|
Test Project