title: django views - 502 bad gateway
body: <p>I'm testing my project in the production server where I'm getting several errors of various features in my web application which is working perfectly on my computer.</p>
  
  <p>Please go to <a href="http://qlimp.com" rel="nofollow">http://qlimp.com</a> and login using this <strong>username/password: nirmal/karurkarur</strong> Then go to <a href="http://qlimp.com/cover" rel="nofollow">http://qlimp.com/cover</a> You'll find a palette where you can upload images and do something similar to <strong>flavors.me</strong>. I'm having several problems here(images,text,other information are not getting stored in the database).</p>
  
  <p>I think there is no problem with the setup. The problem is it is not even entering into the Django views properly but working without any problem on my computer. Is there anyone experienced the same problem? I'm wondering why is it not working.</p>
  
  <p>Also you can check out in <a href="http://qlimp.com/signup/" rel="nofollow">http://qlimp.com/signup/</a> and you can find the problem where the datas are not get stored.</p>
  
  <p>So there are many problems which I can't ask in one question(not a stackoverflow culture) and so I'm asking this.</p>
  
  <p>When I upload the image I checked in <strong>chrome inspector 'network tab'</strong> it shows <strong>502 bad gateway</strong></p>
  
  <p>Here is my Django <strong>views.py</strong>: <a href="https://gist.github.com/2778242" rel="nofollow">https://gist.github.com/2778242</a></p>
  
  <p><strong>jQuery</strong> Code for the <strong>ajax image upload</strong>: </p>
  
  <pre><code>$('#id_tmpbg').live('change', function()
      {
      $("#ajax-loader").show();
      $("#uploadform").ajaxForm({success: showResponse}).submit();
      });
  
      function showResponse(responseText, statusText, xhr, $form)  { 
      $.backstretch(responseText)
      $("#ajax-loader").hide();
      }
  </code></pre>
  
  <p>And I also checked that it is actually entering into the <code>request.is_ajax()</code> but not into <code>form.is_valid()</code> in my views. Why is it so? I'm uploading the right format.</p>
  
  <p>Could anyone identify the mistake I've done? Also I need an answer on Why the code is not working on production server which is actually working on the development server (this would be helpful for me to solve rest of the problems).</p>
  
  <p>Development server: Ubuntu 11.10/Python 2.7/Django 1.3.1</p>
  
  <p>Production server: Ubuntu 12.04/Python 2.7/Django 1.3.1</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>There is some problem in everyone signing in with the same user/password. So please register there and it shows <strong>[Errno 111] Connection refused</strong>, doesn't matter, you can login then.</p>
  
  <p><strong>UPDATE-2</strong></p>
  
  <p>Actually the problem is with form.is_valid() so I removed it and checked but now I'm getting this error:</p>
  
  <pre><code>Exception Type: ValueError
  Exception Value:    The BackgroundModel could not be created because the data didn't validate.
  Exception Location: /home/nirmal/project/local/lib/python2.7/site-packages/django/forms/models.py in save_instance, line 73
  </code></pre>
  
  <p>I'm all-time uploading the right Image format and I don't know why it is not validating.</p>
  
  <p><strong>UPDATE-3</strong></p>
  
  <p>I'm getting <strong>304 Not Modified</strong> for all the static files in <a href="http://qlimp.com/cover" rel="nofollow">http://qlimp.com/cover</a> Will this be a problem for not working?</p>