title: Flask import error: No module named app. While creating the database with Sqlite
body: <p>Hi I am very new to flask and I am trying to set up a database using sqlite with my app. I have the file structure like this</p>
  
  <pre><code>app
  |--Static(folder)
  |--Templates(folder)
  |--__init__.py (empty python file)
  |--models.py(containes table classes)
  |--app.py (application module)
  </code></pre>
  
  <p>inside my app.py file I have the following code</p>
  
  <pre><code>import os
  from flask_sqlalchemy import SQLAlchemy
  from flask import Flask, render_template, url_for, request, redirect, flash 
  from datetime import datetime
  from logging import DEBUG
  
  
  basedir = os.path.abspath(os.path.dirname(__file__))
  app = Flask(__name__)
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'database.db')
  db = SQLAlchemy(app)
  </code></pre>
  
  <p>So when I try to run the command </p>
  
  <pre><code>from app.app import db 
  </code></pre>
  
  <p>in the python shell, I get the error saying that "no module named app".
  Can anyone tell me what I am doing wrong here?</p>