原main.py入口文件

#Celery的入口
from celery import Celery #创建Celery实例 生产者
celery_app = Celery('meiduo') #加载配置
celery_app.config_from_object('celery_tasks.config') # 注册任务
celery_app.autodiscover_tasks(['celery_tasks.sms','celery_tasks.email'])#把邮箱的任务添加进去
celery错误信息
django.core.exceptions.ImproperlyConfigured: Requested setting EMAIL_FROM, but settings are not configured. You must eit
her define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

解决办法

在main.py文件中添加如下代码即可
# 为celery使用django配置文件进行设置 这一步一定要加,不然发送邮件的时候,celery会报错
# 代码加到创建celery实例之前
import os
if not os.getenv('DJANGO_SETTINGS_MODULE'):
os.environ['DJANGO_SETTINGS_MODULE'] = 'meiduo_mall.settings.dev'

Celey异步发送邮件时报django.core.exceptions.ImproperlyConfigured的解决办法的更多相关文章

  1. python基于Django框架编译报错“django.core.exceptions.ImproperlyConfigured”的解决办法?

    下面是我具体遇到的问题和解决方法: 错误详细信息: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_IND ...

  2. django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: rest_framework_swagger

    在启动服务时报django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: re ...

  3. django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11

    搭建Django2.0+Python3+MySQL5时同步数据库时报错:django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 o ...

  4. pythoncharm 中解决启动server时出现 “django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configured”的错误

    背景介绍 最近,尝试着用pythoncharm 这个All-star IDE来搞一搞Django,于是乎,下载专业版,PJ等等一系列操作之后,终于得偿所愿.可以开工了. 错误 在园子里找了一篇初学者的 ...

  5. 关于Django报错django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configure

    报错代码:django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but se ...

  6. django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'. Did you install mysqlclient or MySQL-python?

    Error msg: Unhandled exception in thread started by <function check_errors.<locals>.wrapper ...

  7. 【Django】django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.

    最近学习Django的过程中,在cmd打算使用python manage.py shell来测试数据的时候,当我一导入自己写的model类,就发现报了这个错误django.core.exception ...

  8. django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call

    Error info: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, ...

  9. 【Django】django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?

    今天创建APP的时候报这个错误django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you in ...

  10. django调用py报错 django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured.

    完整报错信息如下 django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, bu ...

随机推荐

  1. [转帖]Datadog 能成为最大的云监控厂商吗

    https://xie.infoq.cn/article/901cfd6b284e3e103ac70aeb3 作者:睿象云 2021-03-25 本文字数:2256 字 阅读完需:约 7 分钟   D ...

  2. [转帖]docker 最新版本升级

    文章目录 前言 一.卸载低版本docker 1.1 检查docker版本 1.2 删除docker 二.开始安装 2.1 安装所需依赖 2.2 设置docker yum源 2.3 查看所有可用版本 2 ...

  3. [转帖]配置logback上报日志到Skywalking

    https://zhuanlan.zhihu.com/p/506119895 配置logback上报日志到Skywalking 配置logback上报日志到skywalking需要引入toolkit依 ...

  4. [转帖]ARMv8架构概述、相关技术文档以及ARMv8处理器简介

    ARMv8架构 文章目录 ARMv8架构 参考文档 ARMv8架构的概述 从32位到64位的变化The changes from 32 bits to 64 bits 1,Larger registe ...

  5. [转帖]Linux kernel内存管理之overcommit相关参数

    前言 了解 linux kernel内存管理,首先可以从用户空间的角度来看kernel的内存管理,执行ls /proc/sys/vm的命令,就可以看到vm运行的所有参数,其中就包含了跟overcomm ...

  6. [转帖]写给想了解"集成电路"的朋友

    https://zhuanlan.zhihu.com/p/602627000 寒假和朋友小聚,每当就专业问题展开谈话,很容易形成"一边热火朝天,一边大脑宕机"的局面.俗话说隔行如隔 ...

  7. echarts去掉y轴线、设置x轴线的颜色、x轴文字颜色

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  8. 【python】SSTI模版注入

    0x00  Python Vene环境及介绍 venv虚拟环境:创建和管理虚拟环境的模块 首先apt update更新一下包管理 安装你当前版本的python-venv 选择一个目录,安装venv虚拟 ...

  9. [LeetCode刷题记录]113 路径总和 II

    题目描述 给定一个二叉树和一个目标和,找到所有从根节点到叶子节点路径总和等于给定目标和的路径. 说明: 叶子节点是指没有子节点的节点. 难度 中等 题解 采用深度搜索优先,遍历每条从根节点到叶子节点的 ...

  10. 手撕Vue-实现将数据代理到Vue实例

    前言 经过上一篇文章的学习,完成了 v-on 指令的实现,接下来我们来实现将数据代理到 Vue 实例上. 为什么要完成这个功能呢?因为我们在使用 Vue 的时候,可以直接通过 this.xxx 的方式 ...