title: Python/Django: I need some code to run between requests, which concept to look for?
body: <p>I am trying Django for my project, which contains server-side code, which should work between requests. It should be initialized at server start, keep state, and polled sometimes between HTTP requests. </p>
  
  <p>I can write own server with python http.server but it seems overkill at the moment, simple (Django built-in HTTP) server is ok for my project for now. Which is the simplest way to implement server-side code for typical Django project?</p>
  
  <p><strong>Edit:</strong> So I am looking for something like this:</p>
  
  <pre><code># my_serverside_module.py
  
  # keep during server lifetime
  state = [] 
  
  # called at server start
  def init_module(): pass 
  
  # called by framework 1 time per minute
  def poll(): pass 
  
  # called by myself during http request from Django code
  def do_something(): pass
  </code></pre>