'''Problem:'''
In the Tutorial 5 - at the begining of the "Test View" part
we have pythin console code to execute:
{{{
>>> from django.test.utils import setup_test_environment
>>> setup_test_environment()
}}}
however import of "setup_test_environment" doesnt work and throw
exception:
{{{
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but
settings are not configured. You must either define the environment
variable DJANGO_SETTINGS_MODULE or call settings.configure() before acces
sing settings.
}}}
however to execute
{{{
settings.configure()
}}}
we have to import "settings"
{{{
from django.conf import settings
}}}
'''Solution:'''
To fix tutorial flow need to change current console code of 2 lines to the
4 lines like this:
{{{
>>> from django.conf import settings
>>> settings.configure()
>>> from django.test.utils import setup_test_environment
>>> setup_test_environment()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22559>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Further problems:
The following code execution:
{{{
response = client.get('/')
}}}
throw exception:
{{{
AttributeError: 'module' object has no attribute 'ROOT_URLCONF'
}}}
not sure how to fix this problem as my "settings.py" file has defined
"ROOT_URLCONF"
{{{
ROOT_URLCONF = 'Tutorial_1.urls'
}}}
cannot continue with that tutorial, moving to the tutorial 6 without
completing that one
--
Ticket URL: <https://code.djangoproject.com/ticket/22559#comment:1>
* status: new => closed
* resolution: => invalid
Comment:
You need to use `manage.py shell` as described before that section: "We
will start again with the shell".
--
Ticket URL: <https://code.djangoproject.com/ticket/22559#comment:2>
Comment (by anonymous):
ohh my bad, i used just python command to enter the python shell, not
manage.py shell
--
Ticket URL: <https://code.djangoproject.com/ticket/22559#comment:3>