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

django-celery执行celery -A my_celery.tasks worker -l info报错:
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

或者 : Model class django.contrib.contenttypes.models.ContentType doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS

要看看导入的问题:导入app就会报错,这个文件夹中不能导入app

You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure()_第1张图片
You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure()_第2张图片

你可能感兴趣的:(You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure())