title: Upload Media from Heroku to Amazon S3
body: <p>New to Heroku &amp; Amazon S3, so bear with me. Uploaded my Django app onto Heroku, and having a problem with user media uploads. The model is below:</p>
  
  <pre><code>#models.py
  class Movie(models.Model):
      title           = models.CharField(max_length = 500)
      poster          = models.ImageField(upload_to = 'storages.backends.s3boto')
      pub_date        = models.DateTimeField(auto_now_add = True)
      author          = models.ForeignKey(User)
  </code></pre>
  
  <p>The poster attribute is the one where the image is uploaded. I had it running fine locally, and now on Heroku there is an error. So I added 'storages.backends.s3boto', as numerous other posts have told me to. (not sure if right).</p>
  
  <p>My Settings.py file looks like this right now, kind of a mess:</p>
  
  <pre><code>#settings.py
  PROJECT_ROOT   = os.path.abspath(os.path.dirname(__file__))
  PROJECT_DIR    = os.path.join(PROJECT_ROOT, '../qanda')
  
  DEFAULT_FILE_STORAGE    = 'storages.backends.s3boto.S3BotoStorage'
  STATICFILES_STORAGE     = 'storages.backends.s3boto.S3BotoStorage'
  
  AWS_ACCESS_KEY_ID         = '****************'
  AWS_SECRET_ACCESS_KEY     = '************'
  AWS_STORAGE_BUCKET_NAME   = 'mrt-assets'
  AWS_PRELOAD_METADATA      = True
  
  MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'qanda/media/movie_posters/)
  MEDIA_URL = '/media'
  STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
  STATIC_URL = 'https://mrt-assets.s3.amazonaws.com/static/'
  STATICFILES_DIRS = (os.path.join(PROJECT_DIR, 'static'),)
  </code></pre>
  
  <p>My bucket is called mrt-assets, and there are 2 folders in there static (css, js, images and media. I'm not too worried about the static files for now, as I've hardcoded the CSS/JS files into my HTML files*, but how do I get my user uploaded media (images of any kind) into mrt-assets/media?</p>
  
  <p>*although if someone wanted to help with STATIC files too that would be great. But user uploaded media more urgent.</p>
  
  <p>EDIT (per Yuji's comment):</p>
  
  <p>Have tried a number of options, and none of them working. I've gone back and deleted a lot of changes, and this is now my Settings</p>
  
  <pre><code>#settings.py
  PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
  MEDIA_ROOT = 'http://s3.amazonaws.com/mrt-assets/media/'
  MEDIA_URL = '/media/'
  STATIC_ROOT = 'http://s3.amazonaws.com/mrt-assets/static/'
  STATIC_URL = '/static/'
  ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
  TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, "templates"),)
  
  #models.py
  #same as before, but now have changed the poster directory
  poster = models.ImageField().
  </code></pre>
  
  <p>Not really sure what to do, need to connect my Heroku app to S3 so user media uploads are saved there. </p>
  
  <p>Have now changed my S3 Bucket to this</p>
  
  <pre><code>mrt-assets
      static
          css
          js
          images
      media
          (empty)
  </code></pre>