title: Gunicorn and Flask blueprints
body: <p>I'm using Gunicorn (on nginx) with Flask. Let's say I have two Python files, linked with a Flask Blueprint: <code>app.py</code> and <code>api.py</code> where <code>api.py</code> has the url prefix <code>/api</code>. <strong>Why is it that any routes in <code>app.py</code> work although all Blueprinted (i.e. <code>/api</code>) routes return 404s?</strong></p>
  
  <p><code>app.py</code> looks something like this:</p>
  
  <pre><code>from flask import Flask, Blueprint
  app = Flask(__name__)
  @app.route('/')
  def index():
      return '''cheese-bread'''
  
  if __name__ == '__main__':
      app.register_blueprint(api, url_prefix='/api')
      app.run(host='0.0.0.0')
  </code></pre>
  
  <p>and <code>api.py</code></p>
  
  <pre><code>from flask import Blueprint, jsonify
  api = Blueprint('/api', __name__)
  @api.route('/')
  def index():
      return jsonify({'bread' : 'cheese, please'})
  </code></pre>
  
  <p><code>wsgi.py</code> is as simple as possible</p>
  
  <pre><code>from app import app
  
  if __name__ == "__main__":
       app.run()
  </code></pre>
  
  <p>Startup scripts are not relevant as the 404s appear when running for development with <code>gunicorn -b 0.0.0.0:8000 wsgi:app</code></p>
  
  <p>Any help would be greatly appreciated.</p>