title: Right way to handle HttpResponseRedirect
body: <p>I have a Django app I'm trying to deploy. The Apache setting is configured in the way that i access my wsgi app by the following URL:</p>
  
  <pre><code>sitename.com/~amartino
  </code></pre>
  
  <p>Meaning I have only a wsgi.py file in my public_html directory.
  I access my Django site via URL:</p>
  
  <pre><code>sitename.com/~amartino/expofit
  </code></pre>
  
  <p>For that's the way its been set in urls.py.</p>
  
  <pre><code>urlpatterns = patterns('',
  ('/param_select/$',session_check(param_select)),
  ('registration/$',registration),
  ('result_show/(\d+)',session_check(result_show)),
  ('^expofit/$',media_clean(start)),
  ('result_pick/$',session_check(result_pick)),
  ('mail_report/$',session_check(mail_report)),
  ('notification/$',session_check(notification)),
  </code></pre>
  
  <p>However, the problem I'm getting (which didn't show up in development :) ) is that I'm using a hardcoded HttpResponseRedirect in views.py.</p>
  
  <pre><code>...
  #If all fields are valid
  return HttpResponseRedirect('/expofit/param_select/')
  #else reload page
  ...
  </code></pre>
  
  <p>Since the production environment doesn't place my site in the root of the URL, i'm having errors now because the upper <code>HttpResponseRedirect</code> translates to </p>
  
  <pre><code>sitename.com/expofit/param_select/
  </code></pre>
  
  <p>which isn't recognized by Apache.</p>
  
  <p>I suppose I could remove the slash and have:</p>
  
  <pre><code>return HttpResponseRedirect('expofit/param_select/')
  </code></pre>
  
  <p>which would result in:</p>
  
  <pre><code>sitename.com/~amartino/expofit/registration/expofit/param_select/
  </code></pre>
  
  <p>but that doesn't seem the right way to do it for I would end up with a huge URL in no time.
  Where is the design/configuration flaw here?</p>