﻿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
20177	Don't use setup_test_environment in the shell in testing tutorial	vlad.london.uk@…	nobody	"Hi,

I was following the instructions at https://docs.djangoproject.com/en/1.5/intro/tutorial05/

First, when executing the command in the shell:

{{{
>>> from django.test.utils import setup_test_environment
}}}


I'm getting the following error:

{{{
django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
}}}

This is fixable by setting a shell environment variable

{{{
export DJANGO_SETTINGS_MODULE=mysite.settings
}}}

However, when I execute the following commands from the next section in python shell, I'm getting the results from the production database rather than from the empty test database:


{{{
>>> response = client.get(reverse('polls:index'))
>>> response.status_code
200
>>> response.content
}}}

"	Bug	closed	Documentation	1.5	Normal	fixed		timograham@…	Accepted	1	0	0	0	0	0
