django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment varia

Use this

import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

instead of

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<appname>.settings")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)