title: Setting HTTP status code in Bottle?
body: <p>How do I set the HTTP status code of my response in Bottle?</p>
  
  <pre class="lang-py prettyprint-override"><code>from bottle import app, run, route, Response
  
  @route('/')
  def f():
      Response.status = 300 # also tried `Response.status_code = 300`
      return dict(hello='world')
  
  '''StripPathMiddleware defined:
     http://bottlepy.org/docs/dev/recipes.html#ignore-trailing-slashes
  '''
  
  run(host='localhost', app=StripPathMiddleware(app()))
  </code></pre>
  
  <p>As you can see, the output doesn't return the HTTP status code I set:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>$ curl localhost:8080 -i
  HTTP/1.0 200 OK
  Date: Sun, 19 May 2013 18:28:12 GMT
  Server: WSGIServer/0.1 Python/2.7.4
  Content-Length: 18
  Content-Type: application/json
  
  {"hello": "world"}
  </code></pre>