title: Create view in CouchDB in a python application
body: <p>I have a DB in CouchDB and I'm wondering if is it possible to create a view directly from python instead of using GUI. 
  I'm a beginner in CouchDB and I need a function that's  equivalent at SELECT DISTINCT in SQL and a view like</p>
  
  <pre><code>function (doc) {
    if(doc.MovieId == "1254")
      emit(doc.Rating, 1);
  }
  </code></pre>
  
  <p>is the ideal. The problem is that I've to do this view for much more <code>MovieId</code>s (taken from keyboard input). </p>
  
  <p>I'm asking you if is possible to create/delete views like this directly from python because on the net I've found nothing.
  If isn't possible, is that a good idea to make a Mango query and map results by myself?</p>
  
  <p>---EDIT---</p>
  
  <pre><code>json_data = {
    "_id": "_design/titaRat",
    "_rev": "3-ceb11154b13457c55b1f98f4e9d15b03",
    "views": {
      "titRat": {
        "map": "function (doc) { var id_prefix = \"ratings :\"; if(doc._id.substr(0, id_prefix.length) === id_prefix &amp;&amp; doc.MovieId == \"1721\") emit(doc.Rating, 1);}",
        "reduce": "_count"
      }
    },
    "language": "javascript",
    "options": {
      "partitioned": False
    }
  }
  
  db.save(json_data)
  
  
  ResourceConflict: ('conflict', 'Document update conflict.')
  </code></pre>
  
  <p>I got this error, but there aren't document that have this name</p>