title: Uploading a JPEG image via Django displays error
body: <p>I'm running a Django app inside a virtualenv on Ubuntu with NGINX/FastCGI and trying to upload a JPG image to the Django admin app.</p>
  
  <p>I'm getting this error: "Upload a valid image. The file you uploaded was either not an image or a corrupted image." I can upload a GIF image, so it's only JPEG that's causing the problem.</p>
  
  <p>Here's what I've tried so far:</p>
  
  <p>1) Install libjpeg62-dev before PIL</p>
  
  <pre><code>pip uninstall pil
  sudo apt-get libjpeg62-dev
  pip install pil
  </code></pre>
  
  <p>At the end of the PIL install, I see:</p>
  
  <pre><code>PIL 1.1.7 SETUP SUMMARY
  --------------------------------------------------------------------
  version       1.1.7
  platform      linux2 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
                [GCC 4.4.3]
  --------------------------------------------------------------------
  *** TKINTER support not available
  --- JPEG support available
  --- ZLIB (PNG/ZIP) support available
  --- FREETYPE2 support available
  *** LITTLECMS support not available
  </code></pre>
  
  <p>So it looks like JPEG support is there. I've also done the manual test to verify and it verified:</p>
  
  <pre><code>&gt;&gt;&gt; from PIL import Image
  &gt;&gt;&gt; trial_image=Image.open("/path/to/my/image.png")
  &gt;&gt;&gt; trial_image.verify()
  </code></pre>
  
  <p>2) Similar to approach #1 above, but manually specifying the JPG_ROOT:</p>
  
  <pre><code>pip uninstall pil
  sudo apt-get libjpeg62-dev
  pip install --no-install pil
  vi /path/to/virtualenv/build/PIL/setup.py (JPG_ROOT = libinclude("/usr/lib"))
  pip install pil
  </code></pre>
  
  <p>3) Try my luck with Pillow (a PIL fork)</p>
  
  <pre><code>pip uninstall pil
  sudo apt-get libjpeg62-dev
  pip install pillow    
  </code></pre>
  
  <p>I'm running Django under I've also trying stopping &amp; starting the nginx service after each time installing PIL.</p>
  
  <p>So far none of the above approaches have gotten me past the above error message in my Django app on Ubuntu. I can upload the same JPG image just fine on my local dev box (Mac OSX 10.6.5) running the same Django app, so I know it's something with my deployment on Ubuntu.</p>
  
  <p>Any help would be appreciated!</p>