django-crontab定时任务报错记录

1、使用命令python manage.py crontab add时报错:‘/temp/xxxxxx’, 10 , bad hour
解决方法:
看报错的字面意思就是时间填错了,然后我试了各种时间格式,依然报bad hour,查了网上一般报时间错误的都是bad minute,我意识到不是这个问题,然后仔细比对了下配置文件,发现最后面的逗号没写,一般认为这个元组里面只有一个元素会忽略,但是这里请一定要加上,虽然我也不知道为什么!下面把我的配置贴上:
CRONJOBS = (
(‘/5 *‘, ‘Appname.backend.slb_monitor.finaly_slbinfo‘, ‘>>‘ + os.path.join(BASE_DIR, ‘logs/crons.log‘)),
)

2、添加上了定时任务,满心欢喜的以为没问题了,最后发现任务是执行了,但是没什么反应;
解决方法:
这个时候执行后的报错是不会直接输出到你配置的log里面去的,你需要用python manage.py crontab run xxxxxxxxxxxxxxxxxxx(此处为任务添加时生成的一串任务码,没有记录的话可通过crontab -l查看)手动运行,运行后就能看到任务执行的报错了,轻松解决!

3、定时任务运行函数说明,例: ‘Appname.backend.slb_monitor.finaly_slbinfo‘,Appname就是你项目里面的app名称,backend.slb_monitor.finaly_slbinfo就是app里面的文件路径和函数名称,一定不要弄错了!

原文地址:https://blog.51cto.com/8596219/2418298

时间: 2024-08-03 08:14:14

django-crontab定时任务报错记录的相关文章

记一次django的诡异报错 Could not parse the remainder: '=' from '='

如题,一个展示日志的功能,调用该模板文件时报错,Could not parse the remainder: '=' from '='.这行模板语言在上面出现过同样的,仅仅是改了'<='右端的整数大小,而且该有的标签也不少. 百般思考无解,stackoverflow和百度都没答案.后来重新看了下开发文档,发现是Django的版本不对,开发时用的1.8.2,我部署时用的1.11.5.重新安装低版本的django后问题解决.但原因仍待查. 记一次django的诡异报错 Could not parse

Django urls.py报错: raise TypeError(&#39;view must be a callable or a list/tuple in the case of include()

Django urls.py报错: raise TypeError('view must be a callable or a list/tuple in the case of include() 报错信息 "F:\PyCharm 2016.2.2\bin\runnerw.exe" C:\Users\Administrator\AppData\Local\Programs\Python\Python35\python.exe F:/Django/blogs/manage.py run

duplicate symbol _OBJC_METACLASS_$ 报错记录

duplicate symbol _OBJC_METACLASS_$_TabbarButton in: /Users/hw201406/Library/Developer/Xcode/DerivedData/xxx-gafskbgawbctznekgfxqhaugwjce/Build/Intermediates/xxx.build/Debug-iphonesimulator/xxx06.build/Objects-normal/i386/TabbarButton-FDEB19611A30D765

Django——模版Template报错

>>> from django.template import Template >>> t = Template("My name is {{ my_name }}.") Traceback (most recent call last): File "C:\Python33\lib\site-packages\django\conf\__init__.py", line 38, in _setup settings_modul

InnoDB: The InnoDB memory heap is disabled报错记录

报错记录: [[email protected] ~]# cat /data/3307/data/localhost.localdomain.err  150509 21:21:27 mysqld_safe Starting mysqld daemon with databases from /data/3307/data 150509 21:21:27 InnoDB: The InnoDB memory heap is disabled 150509 21:21:27 InnoDB: Mute

django admin 中文报错incorrect string value解决方案

对于错误" Incorrect string value: '\xE6\xA2\xB5\xE8\x92\x82...'for column 'object_repr' at row 1 解决方法是设置django_admin_log表的object_repr一项使用utf8_unicode_ci: 对于错误"  Incorrect string value: '\xE6\xA2\xB5\xE8\x92\x82...'for column 'change_message' at row

Spring Boot 报错记录

Spring Boot 报错记录 由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决 解决方案1: @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) //@SpringBootApplication @MapperScan("com.example.*") //扫描:该包下相应的class,主要是MyBatis的持久化类. 解决方案2: #去配置文件中配置数据库连接参数 #

Django 使用allauth报错 RuntimeError: Model class django.contrib.sites.models.Site doesn&#39;t declare an explicit app_label and isn&#39;t in an application in INSTALLED_APPS

一:报错 RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS 出现这种情况需将Django的Sites框架添加到您的应用程序中,并在您的设置中将SITE_ID设置为1即可.位置放在默认配置的后面,其他应用的前面. INSTALLED_APPS = [ 'django

Django:django-cors-headers 报错no module named &quot;corsheaders&quot;

django跨域使用 pip install django-cors-headers 然后在settings文件中加上参数设置 # app配置 INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles