title: Django task not running using crontab
body: <p>I am using <code>django-kronos</code> to create a cron job and it is running fine when I run it manually. But it is not running in case of crontab.</p>
  
  <p>Below is my code to test if it is working:</p>
  
  <p><code>settings.py</code></p>
  
  <pre><code>ENV_PATH = os.path.join(BASE_DIR, '.env')
  
  # Adding KRONOS PROPERTIES
  KRONOS_PREFIX = '{} '.format(ENV_PATH)
  KRONOS_POSTFIX = '&gt;&gt; /var/log/cron.log 2&gt;&amp;1'
  </code></pre>
  
  <p>I have my passwords in <code>.env</code> file. Hence I have used <code>KRONOS_PREFIX</code> to export those variables first. <code>KRONOS_POSTFIX</code> is used to add logs to my cron.</p>
  
  <p><code>cron.py</code></p>
  
  <pre><code>import kronos
  
  @kronos.register('* * * * *')
  def test_task():
      print("IT WORKS....")
  </code></pre>
  
  <p><code>Commands:</code></p>
  
  <pre><code>$ python manage.py showtasks
  
  * List of tasks registered in Kronos *
  &gt;&gt; Kronos tasks
      &gt;&gt; test_task
  &gt;&gt; Django tasks
  
  $ python manage.py installtasks
  1 task removed, 1 installed.
  
  </code></pre>
  
  <p><code>crontab -l</code></p>
  
  <pre><code>* * * * * /home/sam/..../.env  /home/sam/.../venv/bin/python /home/sam/.../manage.py runtask test_task  --settings=my_project.settings &gt;&gt; /var/log/cron.log 2&gt;&amp;1 # kronos:4f383ee5e8844285d6ac6dc78196e377
  </code></pre>
  
  <p>It works when I run the command mentioned in <code>crontab</code> manually and logs the output as well. I checked several articles online without any success. </p>
  
  <p>I found this <a href="https://www.digitalocean.com/community/questions/unable-to-execute-a-python-script-via-crontab-but-can-execute-it-manually-what-gives" rel="nofollow noreferrer">digitalocean article</a> somewhat similar but this is also not working in my case.</p>
  
  <p>Any help is much appreciated. </p>
  
  <p>Thanks.</p>