title: Unexplainable Flask 404 errors
body: <p>I have a website that uses Flask. It used to work well, but since recently, every request returns a 404, and it seems it can't find the right endpoints. However:</p>
  
  <ul>
  <li>Locally, the site still works, only on my VPS it shows this strange behaviour.</li>
  <li><code>url_for</code> works and <code>app.view_functions</code> contains all the routes as well.</li>
  <li>And yet, I keep getting 404s on the VPS, even for <code>/</code> and anything under <code>/static/</code>.</li>
  </ul>
  
  <p>Here's part of the code, it's a bit much to show all of it and it's not all relevant:</p>
  
  <pre><code>#snip
  
  from flask import Flask, render_template, abort, request, redirect, url_for, session
  from flask.ext.babelex import Babel
  from flask.ext import babelex
  
  #snip
  
  app = Flask(__name__)
  app.secret_key = #snip
  
  #snip
  
  #just one of the routes
  @app.route('/')
  def about():
      return render_template('about.html')
  
  #snip
  
  @app.errorhandler(404)
  def page_not_found(e):
      #snip
      return render_template('404.html'), 404
  
  #snip
  
  if __name__ == '__main__':
      app.run(debug=True)
  else:
      app.config.update(
          SERVER_NAME='snip.snip.com:80',
          APPLICATION_ROOT='/',
      )
  </code></pre>