﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22297	TransactionMiddleware signals connection_created too early	no	nobody	"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."	New feature	closed	Uncategorized	1.6	Normal	fixed		no	Unreviewed	0	0	0	0	0	0
