title: ImportError: No module named app
body: <p>I working with Flask-Testing and make file test_app.py to test But I got this error File "test_app.py", line 4, in  from app import create_app, db ImportError: No module named app.
  so please help how can I fix it and what is the problem Thanx :) </p>
  
  <p>here is my Structure:</p>
  
  <pre><code>myapplication
   app
      __ init __.py
      model.py
      form.py
      autho
      layout
      static
      templates
   migrations  
   test
     -test_app.py
   config.py
   manage.py
  </code></pre>
  
  <blockquote>
    <p>test_app.py</p>
  </blockquote>
  
  <pre><code>#!flask/bin/python
  import unittest
  from flask.ext.testing import TestCase
  from app import create_app, db
  from app.model import Users
  from flask import request, url_for
  import flask
  
  class BaseTestCase(TestCase):
  
      def create_app(self):
          self.app = create_app('testing')
          return self.app
  </code></pre>
  
  <blockquote>
    <p>config.py</p>
  </blockquote>
  
  <pre><code>class TestingConfig(Config):
      TESTING = True
      SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or \
          'sqlite:///' + os.path.join(basedir, 'mytest.sqlite')
  </code></pre>
  
  <blockquote>
    <p>__ init __.py</p>
  </blockquote>
  
  <pre><code>#!flask/bin/python
  from flask import Flask
  from flask.ext.sqlalchemy import SQLAlchemy
  from flask.ext.login import LoginManager
  import psycopg2
  from config import basedir
  from config import config
  
  db = SQLAlchemy()
  lm = LoginManager()
  lm.login_view = 'login'
  login_manager = LoginManager()
  login_manager.login_view = 'layout.login'
  
  def create_app(config_name):
      app = Flask(__name__)
      app.config['DEBUG'] = True
      app.config.from_object(config[config_name])
      db.init_app(app)
      login_manager.init_app(app)
      # login_manager.user_loader(load_user)
      from .layout import layout as appr_blueprint
      # register our blueprints
      app.register_blueprint(appr_blueprint)
  
      from .auth import auth as auth_blueprint
      app.register_blueprint(auth_blueprint)
      return app
  </code></pre>