title: Non-root routing with Django and Apache
body: <p>I'm trying to get Django served by Apache, but I'd like it to have more flexibility than the dumb way I've got it implemented now.  At the moment, my httpd_wsgi.conf has this line:</p>
  
  <pre><code>WSGIScriptAlias / /Library/WebServer/Documents/acdc/apache/promotions.wsgi
  </code></pre>
  
  <p>In my project's urls.py, I have this line:</p>
  
  <pre><code>url(r'^chicken/login/', 'login'),
  </code></pre>
  
  <p>If I type <a href="http://www.example.com/chicken/login" rel="noreferrer">http://www.example.com/chicken/login</a> into my browser's address bar, I get routed to the appropriate login function.  And if all the patterns in urls.py are prefaced with 'chicken' then everything works fine.</p>
  
  <p>What I'd like, though, is to be able to switch the URL at which this app is deployed.  So for instance, what if I wanted <a href="http://www.example.com/monkey/login" rel="noreferrer">http://www.example.com/monkey/login</a> to work?  Right now I'd have to change all my URLs and all my links, which is dumb.  It seems like this should be trivial if I changed WSGIScriptAlias:</p>
  
  <pre><code>WSGIScriptAlias /monkey/ /Library/WebServer/Documents/acdc/apache/promotions.wsgi
  </code></pre>
  
  <p>then I could just have my URLs look like:</p>
  
  <pre><code>url(r'^login/', 'login'),
  </code></pre>
  
  <p>and get rid of the coupling.  The problem is that after an hour of trial and error and research I can't get it to work.  Navigating to <a href="http://www.example.com/monkey/login" rel="noreferrer">http://www.example.com/monkey/login</a> using the just-previous configuration gives me this Apache error in the log:</p>
  
  <pre><code>Target WSGI script not found or unable to stat: /Library/WebServer/Documents/acdc/apache/promotions.wsgilogin
  </code></pre>
  
  <p>so it looks like the "login" route is just get appended to the promotions.wsgi file that launches my Django app.</p>
  
  <p>To summarize, I'd like to have Apache 'swallow' portions of the URL and feed the rest for pattern-matching with my patterns in urls.py.  How do I do this?</p>