我正在尝试在 Elastic Beanstalk 上设置一个 cronjob。任务正在安排中。出于测试目的,它应该每分钟运行一次...但是它不起作用。这是一个 Django 应用程序。该应用程序在两个环境中运行,一个是工作环境,另一个是“托管”应用程序。
这部分正在发挥作用。该命令正在运行,但没有被执行(文件没有被删除)。
Here is views.py:
@login_required
def delete_expired_files(request):
users = DemoUser.objects.all()
for user in users:
documents = Document.objects.filter(owner=user.id)
if documents:
for doc in documents:
now = timezone.now()
if now >= doc.date_published + timedelta(days = doc.owner.group.valid_time):
doc.delete()
return redirect("user_home")
cron.yml:
version: 1
cron:
- name: "delete_expired_files"
url: "http://networksapp.elasticbeanstalk.com/networks_app/delete_expired_files"
schedule: "* * * * *"
但是,它会将其打印在日志文件的 access_log 部分:"POST /myapp/management/commands/delete_expired_files HTTP/1.1" 500 124709 "-" "aws-sqsd/2.0"
这是我到目前为止正在访问的日志文件:日志文件内容 https://docs.google.com/document/d/1l43uPtkMooywaH5L-Hk4kpv81faeJQFuNnVDieGIDXE/edit?usp=sharing
为什么?我该如何修复它?
太感谢了。
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)