title: Import error flask application
body: <p>I got this error running the application with this command 
  'python manage.py runserver'</p>
  
  <p>the error</p>
  
  <pre><code>C:\Users\Kamran\Envs\thermos\lib\site-packages\flask_sqlalchemy\__init__.py:800: UserWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True to suppress this warning.
    warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True to suppress this warning.')
  Traceback (most recent call last):
    File "manage.py", line 1, in &lt;module&gt;
      from thermos import app, db
    File "E:\Kamran\My Work\Website\Python Flask Tutorial\thermos\thermos\__init__.py", line 13, in &lt;module&gt;
      import models
    File "E:\Kamran\My Work\Website\Python Flask Tutorial\thermos\thermos\models.py", line 3, in &lt;module&gt;
      from thermos import db
  ImportError: cannot import name db
  </code></pre>
  
  <p>and I have managed my files like this</p>
  
  <p><a href="https://i.stack.imgur.com/U4oyE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U4oyE.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/Ikjbe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ikjbe.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>manage.py</p>
  
  <pre><code>from thermos import app, db
  from thermos.models import User
  from flask.ext.script import Manager, prompt_bool
  
  manager = Manager(app)
  
  @manager.command
  def initdb():
      db.create_all()
      db.session.add(User(username='Cameron', email='cameron@google.com'))
      db.session.add(User(username='Mahshid', email='mahshid@python.org'))
      db.session.commit()
      print 'Initialized the database'
  
  @manager.command
  def dropdb():
      if prompt_bool(
      'Are you sure you want to lose all your data'):
          db.drop_all()
          print 'Dropped the database'
  
  if __name__ == '__main__':
      manager.run()
  </code></pre>
  
  <p><strong>init</strong>.py</p>
  
  <pre><code>import os
  from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  
  basedir = os.path.abspath(os.path.dirname(__file__))
  
  app = Flask(__name__)
  app.config['SECRET_KEY'] = 'K\xa5r\x94\xc2"\x06\x14\'\xc1\xe4\xa6\r\x9f\x16\xf9z4hIR\x14g\x1c'
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'thermos.db')
  app.config['DEBUG'] = True
  db = SQLAlchemy(app)
  
  import models
  import views
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>from datetime import datetime
  from sqlalchemy import desc
  from thermos import db
  
  class Bookmark(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      url = db.Column(db.Text, nullable=False)
      date = db.Column(db.DateTime, default=datetime.utcnow)
      description = db.Column(db.String(300))
      user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
  
      @staticmethod
      def newest(num):
          return Bookmark.query.order_by(desc(Bookmark.date)).limit(num)
  
      def __repr__(self):
          return '&lt;Bookmark "{}": "{}"&gt;'.format(self.description, self.url)
  
  class User(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(80), unique=True)
      email = db.Column(db.String(120), unique=True)
      bookmarks = db.relationship('Bookmark', backref='user', lazy='dynamic')
  
      def __rep__(self):
          return '&lt;User %r&gt;' % self.username
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>from flask import render_template, redirect, url_for, flash
  from thermos import app, db
  from forms import BookmarkForm
  from models import User, Bookmark
  
  def logged_in_user():
      return models.User.query.filter_by(username='Cameron').first()
  
  @app.route('/')
  @app.route('/index')
  def index():
      return render_template('index.html', new_bookmarks=models.Bookmark.newest(5))
  
  @app.route('/add', methods = ['GET', 'POST'])
  def add():
      form = BookmarkForm()
      if form.validate_on_submit():
          url = form.url.data
          description = form.description.data
          bm = models.Bookmark(user=logged_in_user(), url=url, description=description)
          db.session.add(bm)
          db.session.commit()
          flash('stored "{}"'.format(description))
          return redirect(url_for('index'))
      return render_template('add.html', form=form)
  
  @app.errorhandler(404)
  def page_not_found(e):
      return render_template('404.html'), 404
  
  @app.errorhandler(500)
  def page_not_found(e):
      return render_template('500.html'), 500 
  
  if __name__=='__main__':
      app.run(debug=True)
  </code></pre>