title: Flask's built-in server always 404 with SERVER_NAME set
body: <p>Here is a minimal example:</p>
  
  <pre><code>from flask import Flask
  
  app = Flask(__name__)
  app.config['DEBUG'] = True
  app.config['SERVER_NAME'] = 'myapp.dev:5000'
  
  
  @app.route('/')
  def hello_world():
      return 'Hello World!'
  
  @app.errorhandler(404)
  def not_found(error):
      print(str(error))
      return '404', 404
  
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>If I set <code>SERVER_NAME</code>, Flask would response <em>every</em> URL with a 404 error, and when I comment out that line, it functions correctly again.</p>
  
  <pre><code>/Users/sunqingyao/Envs/flask/bin/python3.6 /Users/sunqingyao/Projects/play-ground/python-playground/foo/foo.py
   * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
   * Restarting with stat
   * Debugger is active!
   * Debugger PIN: 422-505-438
  127.0.0.1 - - [30/Oct/2017 07:19:55] "GET / HTTP/1.1" 404 -
  404 Not Found: The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.
  </code></pre>
  
  <p>Please note that this is not a duplicate of <a href="https://stackoverflow.com/q/22315887/5399734">Flask 404 when using SERVER_NAME</a>, since I'm not using Apache or any production web server. I'm just dealing with Flask's built-in development server.</p>
  
  <p>I'm using Python 3.6.2, Flask 0.12.2, Werkzeug 0.12.2, PyCharm 2017.2.3 on macOS High Sierra, if it's relevant.</p>