Djangoのソースコードを読んでいて、settings(django.conf.LazySettings)オブジェクトにconfigureというメソッドがあることを知った。・・・改めて確認すると、ちゃんとオフィシャルのドキュメントにもあった。これを使うと、環境変数DJANGO_SETTINGS_MODULEを定義しなくてもsettingsを使える。 環境変数DJANGO_SETTINGS_MODULEを未定義でdjango.conf.settingsにアクセスするとImportErrorになる。 >>> from django.conf import settings >>> settings.DEBUG Traceback (most recent call last): File "", line 1, in # ...省略 ImportError: Settings cannot