Trying to run the sql-alchemy tutorial steps. Can't import db from console (ImportError: cannot import name 'db')
<p>Trying to run the tutorial here: <a href="http://flask-sqlalchemy.pocoo.org/2.1/quickstart/" rel="nofollow">http://flask-sqlalchemy.pocoo.org/2.1/quickstart/</a> using my app</p>

<p>I have looked at the circular imports problem but I don't think that's it. I'm an absolute beginner to python and flask (and sqlalchemy). My app currently runs, but the database part doesn't</p>

<p>This is the current setup:</p>

<pre><code>mysite
|- __init__.py
|- flask_app.py
|- models.py
|- views.py
</code></pre>

<p><strong>init</strong>.py</p>

<pre><code>from flask import Flask
app = Flask(__name__)
</code></pre>

<p>flask_app.py</p>

<pre><code>from flask import Flask, request, url_for
import random

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql:// -- database uri --'
... app continues here
</code></pre>

<p>models.py</p>

<pre><code>from app import app
from flask.ext.sqlalchemy import SQLAlchemy

db = SQLAlchemy(app)

class Foo(db.Model):
... model continues here
</code></pre>

<p>views.py</p>

<pre><code>from app import app,models

... views continue here, still not using anything from models
</code></pre>

<p>when I run <code>from mysite import db</code> in the python console I get:</p>

<pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
ImportError: cannot import name 'db'
</code></pre>