title: How to schedule a single-time event in Django in Heroku?
body: <p>I have a question about the software design necessary to schedule an event that is going to be triggered once in the future in Heroku's distributed environment.</p>
  
  <p>I believe it's better to write what I want to achieve, but I have certainly done my research and could not figure it out myself even after two hours of work.</p>
  
  <p>Let's say in my <code>views.py</code> I have a function:</p>
  
  <pre class="lang-py prettyprint-override"><code>def after_6_hours():
      print('6 hours passed.')
  
  
  def create_game():
      print('Game created')
      # of course time will be error, but that's just an example
      scheduler.do(after_6_hours, time=now + 6)
  </code></pre>
  
  <p>so what I want to achieve is to be able to run <code>after_6_hours</code> function exactly 6 hours after <code>create_game</code> has been invoked. Now, as you can see, this function is defined out of the usual <code>clock.py</code> or <code>task.py</code> or etc etc files. </p>
  
  <p>Now, how can I have my whole application running in Heroku, all the time, and be able to add this job into the queue of this imaginary-for-now-<code>scheduler</code> library?</p>
  
  <p>On a side note, I can't use Temporizer add-on of Heroku. The combination of APScheduler and Python rq looked promising, but examples are trivial, all scheduled on the same file within <code>clock.py</code>, and I just simply don't know how to tie everything together with the setup I have. Thanks in advance!</p>