Opened 19 years ago
Closed 19 years ago
#824 closed enhancement (invalid)
Need change the Environment variable DJANGO_SETTINGS_MODULE check
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | UI/UX: |
Description
If I want to import some django module in IDLE to do some testing work, but I may get follows execption:
import django.core.formfields
Traceback (most recent call last):
File "<pyshell#0>", line 1, in -toplevel-
import django.core.formfields
File "c:\python24\lib\site-packages\django-0.90-py2.4.egg\django\core\formfields.py", line 1, in -toplevel-
from django.core import validators
File "c:\python24\lib\site-packages\django-0.90-py2.4.egg\django\core\validators.py", line 28, in -toplevel-
from django.conf.settings import JING_PATH
File "c:\python24\lib\site-packages\django-0.90-py2.4.egg\django\conf\settings.py", line 29, in -toplevel-
raise EnvironmentError, "Environment variable %s is undefined." % ENVIRONMENT_VARIABLE
EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is undefined.
Can you change the checking to DJANGO_SETTINGS_MODULE? I think if there is no DJANGO_SETTINGS_MODULE Environment variable or command line argument, the django should use current path as the value of DJANGO_SETTINGS_MODULE or omit it at all. That should be better. And I also can import some django module in IDLE without exception.
If you set DJANGO_SETTINGS_MODULE before you run IDLE, I believe this will solve your problem.