title: Flask-SQLAlchemy not creating tables using create_all()
body: <p>I have a Flask app that is using Flask-SQLAlchemy.  In my unit tests, I initialise the app and the DB, then call <code>db.create_all()</code> and for some reason it looks like it's not picking up any of my models so isn't creating any tables.</p>
  
  <p>I'm using both <code>__tablename__</code> and <code>__bind_key__</code> in my models as I have two databases.</p>
  
  <p>My config:</p>
  
  <pre><code>SQLALCHEMY_DATABASE_URI = 'sqlite://'
  
  SQLALCHEMY_BINDS = {
      'db1': SQLALCHEMY_DATABASE_URI,
      'db2': SQLALCHEMY_DATABASE_URI
  }
  </code></pre>
  
  <p>Cut down version of my <code>setUp()</code> method in my unit tests:</p>
  
  <pre><code>from flask import Flask
  from flask.ext.sqlalchemy import SQLAlchemy
  
  class APITestCase(unittest.TestCase):
  
      app = Flask(__name__)
      db = SQLAlchemy(app)
      db.create_all()
  </code></pre>
  
  <p>Here's an example of two of my models, one from each bind type:</p>
  
  <pre><code>class Contact(db.Model):
  
      __tablename__ = 'contact'
      __bind_key__ = 'db1'
  
      id = db.Column(db.Integer, primary_key=True)
      first_name = db.Column(db.String(255))
      last_name = db.Column(db.String(255))
      ...
  
      def __init__(first_name, last_name):
          self.first_name = first_name
          self.last_name = last_name
          ...
  
  class BaseUser(db.Model):
  
      __tablename__ = 'User__GeneralUser'
      __bind_key__ = 'db2'
  
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column('Username', db.String(100))
      first_name = db.Column('FirstName', db.String(100))
      last_name = db.Column('Surname', db.String(100))
      ...
  
      def __init__(username, first_name, last_name):
          self.username = username
          self.first_name = first_name
          self.last_name = last_name
          ...
  </code></pre>
  
  <p>Have I missed something glaringly obvious?  How does Flask-SQLAlchemy know where to look for my models to create the associated tables?</p>