Question
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Awnser
import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "项目名.settings")