title: Expect status [201] from Google Storage. But got status 302
body: <p>I was trying to upload a file to Google Cloud Storage with the help of a django application. I wrote this <strong>create_gcs_file</strong> function that gets called in my view:</p>
  
  <pre><code>import cloudstorage as gcs
  from google.appengine.ext import blobstore
  
  def create_gcs_file(filename, data):
      with gcs.open(filename, 'w') as f:
          f.write(data)
  
      blobstore_filename = '/gs' + filename
      return blobstore.create_gs_key(blobstore_filename)
  </code></pre>
  
  <p>I call this function in a view and pass it a filename, and some file.read() data as parameters. <a href="http://pastebin.com/bqV0JMEy" rel="nofollow">Here</a> is the view code I have written that makes use of this.</p>
  
  <p>But when I upload the file I get this error:</p>
  
  <p><code>Expect status [201] from Google Storage. But got status 302</code></p>
  
  <p>The debug page shows that the error occurs at this line:</p>
  
  <p><code>with gcs.open(filename, 'w') as f:</code></p>
  
  <p>P.S: I get this error when running my app with the Google App Engine SDK 1.8.5 locally.</p>