Opened 13 years ago

Closed 13 years ago

Last modified 11 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


In tutorial 1, under "Playing with the API", none of the examples will work if you've been using the --settings option with (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 Changed 13 years ago by Adrian Holovaty

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