#143 closed defect (fixed)
Problem running the command line examples in Tut 1 when using --settings option
Reported by: | 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'
Note:
See TracTickets
for help on using tickets.
(In [328]) Fixed #143 -- Clarified the need for an environment variable in tutorial 1. Thanks, sdelatorre@…