AWS Worker tier cron - server error #500 - “post h

2019-03-05 01:51发布

I'm trying to set up a cronjob at Elastic Beanstalk. The task is being scheduled. For testing purposes it should run every minute... However it is not working. It is a Django app. The app is running in two Environments, one is the worker and the other one is "hosting" the application.

This part is working. The command is running but it's not being executed (the files are not being deleted).

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: "* * * * *"    

However, it prints this on the log file at the access_log part : "POST /myapp/management/commands/delete_expired_files HTTP/1.1" 500 124709 "-" "aws-sqsd/2.0"

This is the log file I am accessing so far: Log file content

Why is it? How can I fix it? Thank you so much.

0条回答
登录 后发表回答