Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22559 closed Uncategorized (invalid)

Tutorial 5 - Missing few steps in instruction

Reported by: Briksins@… Owned by: nobody
Component: Documentation Version: 1.6
Severity: Normal Keywords: Tutorial 5
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

DJango v1.6.4

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()

Change History (3)

comment:1 by Briksins@…, 11 years ago

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

comment:2 by Tim Graham, 11 years ago

Resolution: invalid
Status: newclosed

You need to use manage.py shell as described before that section: "We will start again with the shell".

comment:3 by anonymous, 11 years ago

ohh my bad, i used just python command to enter the python shell, not manage.py shell

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