Opened 19 years ago

Closed 19 years ago

Last modified 17 years ago

#143 closed defect (fixed)

Problem running the command line examples in Tut 1 when using --settings option

Reported by: sdelatorre@… Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In tutorial 1, under "Playing with the API", none of the examples will work if you've been using the --settings option with django-admin.py (the DJANGO_SETTINGS_MODULE env variable was never set). To work, you have to do the following before importing the project objects:

>>> import os
>>> os.environ['DJANGO_SETTINGS_MODULE']='myproject.settings.main'
>>> from django.models.polls import polls, choices

Is there a more user friendly way to do this? Maybe add a global variable to django.conf that is used to do the import?

>>> django.conf.DJANGO_SETTINGS_MODULE='myproject.settings.main'

or possibly

>>> django.settings_module='myproject.settings.main'

Change History (1)

comment:1 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

(In [328]) Fixed #143 -- Clarified the need for an environment variable in tutorial 1. Thanks, sdelatorre@…

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