AWS Worker tier cron - server error #500 - "post http 1.1 500 AWS aws-sqsd/2.0"
<p>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.</p>

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

<p>Here is <strong>views.py</strong>:</p>

<p><code>@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 &gt;= doc.date_published + timedelta(days = doc.owner.group.valid_time):
                    doc.delete()
    return redirect("user_home")</code></p>

<p><strong>cron.yml:</strong></p>

<pre><code>version: 1
cron:
    - name: "delete_expired_files"         
url: "http://networksapp.elasticbeanstalk.com/networks_app/delete_expired_files"
schedule: "* * * * *"    
</code></pre>

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

<p>This is the log file I am accessing so far:
<a href="https://docs.google.com/document/d/1l43uPtkMooywaH5L-Hk4kpv81faeJQFuNnVDieGIDXE/edit?usp=sharing" rel="nofollow" title="log file">Log file content</a></p>

<p>Why is it? How can I fix it?
Thank you so much.</p>