title: How to run a python script in the background django
body: <p>I have a python script (ml.py)that generates some data. I want it to run it in the background daily at 1 AM. How to achieve that ?</p>
  
  <p>ml.py</p>
  
  <p>Takes input from the django models, runs some logic and save the results to the database</p>
  
  <p>I tried installing django-background-tasks and created the following files
  tasks.py</p>
  
  <pre><code>from background_task import background
  
  @background(schedule=1)
  def hello():
      execute('./scripts/ml.py')
  
  hello(repeat=Task.Daily)
  </code></pre>
  
  <p>In the shell, I executed the following command:</p>
  
  <pre><code>python manage.py process_tasks
  </code></pre>
  
  <p>Now I get an error saying that the name execute is not defined</p>
  
  <p>My other questions are :</p>
  
  <ul>
  <li>Do I have to write the command  python manage.py process_tasks
  everyday ? </li>
  <li>Can I exit out of the command window and does the process
  still run everyday ?</li>
  </ul>