title: Deploying a Flask application with CGI
body: <p>I have written a small application using the Flask framework. I try to host this using cgi. Following the documentation I created a .cgi file with the following content:</p>
  
  <pre><code>#!/usr/bin/python
  from wsgiref.handlers import CGIHandler
  from yourapplication import app
  
  CGIHandler().run(app)
  </code></pre>
  
  <p>Running the file results in following error:</p>
  
  <p>...</p>
  
  <blockquote>
    <p>File "/usr/lib/pymodules/python2.7/werkzeug/routing.py", line 1075, in bind_to_environ
        wsgi_server_name = environ.get('HTTP_HOST', environ['SERVER_NAME'])<br>
    KeyError: 'SERVER_NAME'<br>
    Status: 500 Internal Server Error<br>
    Content-Type: text/plain<br>
    Content-Length: 59  </p>
  </blockquote>
  
  <p>In my application I have set:</p>
  
  <pre><code>app.config['SERVER_NAME'] = 'localhost:5000'
  </code></pre>
  
  <p>When I run the application with the Flask development server it works perfectly well. 
  As you can tell I'm very new to this stuff and I have search for others with similar errors but with no luck. All help is appreciated.</p>