title: Can I run a background process in Django without starting a parallel process?
body: <p>This is a very naive question, but I feel I don't understand something fundamental about asynchronous/background tasks in django and python. </p>
  
  <p>I try to replicate a simple example provided by  django-background-tasks (<a href="https://github.com/collinmutembei/django-background-tasks-example" rel="nofollow noreferrer">https://github.com/collinmutembei/django-background-tasks-example</a>) in order to make django perform a background task 60 seconds later than it was actually run. But I guess the same is valid for any other background task manager such as Celery or Huey</p>
  
  <p>The example is pretty simple - as soon as the user accesses the url, a simple function that prints a message is executed without blocking the main django process, 60 sec later</p>
  
  <pre><code>  from background_task import background
    from logging import getLogger
  
    logger = getLogger(__name__)
  
    @background(schedule=60)
    def demo_task(message):
        logger.debug('demo_task. message={0}'.format(message))
  </code></pre>
  
  <p>The problem is that I really don't understand the basics. It doesn't run unless I start a separate (or detached) process <code>python manage.py process_tasks</code>. Should I always do it to make the background task work, or there is a way to do it without starting a parallel process?</p>
  
  <p>If I should start a parallel process, can I do it from inside of django code. Something like:</p>
  
  <pre><code>    import subprocess
  
      process = subprocess.Popen(['python', 'manage.py','process_tasks'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  </code></pre>