标签归档:Pythin faq

How to:Python

1、django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configured.

You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

>>> from django.conf import settings
>>> settings.configure()
>>> from django.test.utils import setup_test_environment
>>> setup_test_environment()