Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#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_db with 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)

hstore_test.tar.gz (3.6 KB ) - added by no 11 years ago.
Test Project

Download all attachments as: .zip

Change History (3)

by no, 11 years ago

Attachment: hstore_test.tar.gz added

Test Project

comment:1 by Aymeric Augustin, 11 years ago

Resolution: fixed
Status: newclosed

This will be fixed by app-loading in 1.7 ;-)

Look for the wall of text on the DevelopersMailingList for details.

comment:2 by no, 11 years ago

Cc: no added
Note: See TracTickets for help on using tickets.
Back to Top