title: Django not writing media files to directory in production
body: <p>I'm stumped. I set up a Django site on an Ubuntu server running nginx and it works fine on development. This is not the first or second Django site I've successfully deployed either so I'm basically just copying and pasting settings at this point. Problem is, <strong>my media files aren't uploading, even from the admin</strong>. It says it has, no errors and after saving, it displays the 'link' to the media file. But there's nothing there. I get 404, and if I go to the media directory on the server, nothing was created, be it sub directory or image file. </p>
  
  <p>I checked my media settings and the file paths are correct. <code>settings.MEDIA_ROOT</code> correctly points to my media directory. I wondered if it was a permissions error but I've set the media folder to 777 with no luck. However, Django will display media files I upload to the directory directly. </p>
  
  <p>Any suggestions would be helpful.</p>
  
  <p>.</p>
  
  <p><strong>UPDATE</strong>: So I did server search and saw that my files are being uploaded 2 levels above where they're supposed to be. </p>
  
  <p>My <code>MEDIA_ROOT</code> correctly points to <code>var\www\sk\src\media</code> but they're being uploaded to <code>var\www\media</code>. </p>
  
  <p>Here's my settings.</p>
  
  <pre><code>BASE_DIR = os.path.abspath(os.path.join(os.path.dirname('__file__'), '..'))
  PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
  PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
  sys.path.insert(0, os.path.join(PROJECT_ROOT, 'apps'))  # Add the apps dir to the path
  
  MEDIA_ROOT = os.path.join(BASE_DIR, "media")
  MEDIA_URL = '/media/'
  </code></pre>
  
  <p>I don't know why this is happening.</p>