title: How to set up custom middleware in Django
body: <p>I am trying to create middleware to optionally pass a kwarg to every view that meets a condition.</p>
  
  <p>The problem is that I cannot find an example of how to set up the middleware.  I have seen classes that override the method I want to, <code>process_view</code>:</p>
  
  <pre><code>Class CheckConditionMiddleware(object):  
      def process_view(self, request):  
  
          return None  
  </code></pre>
  
  <p>But where do I put this class? Do I create a middleware app and put this class inside of it and then reference it in <code>settings.middleware</code>?</p>