title: Error: gunicorn: Failed to find application object 'app' in 'app'
body: <p>Here's my code:</p>
  
  <p>app.py</p>
  
  <pre><code>from flask_graphql import GraphQLView
  from app.infrastructure.graphql import schema
  from app.infrastructure.api_resource import app
  
  app.add_url_rule('/graphql', view_func=GraphQLView.as_view('graphql', schema=schema, graphiql=True))
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>api_resource.py</p>
  
  <pre><code>import app.infrastructure.repository as repository
  from flask import request, url_for
  from flask_restplus import Api, Resource, fields
  from sqlalchemy_pagination import paginate
  from sqlalchemy_fulltext import FullTextSearch
  
  app = repository.app
  api = Api(app, version='0.1', title='xxxxx',
            description='xxxxx')
  ...
  </code></pre>
  
  <p>repository.py</p>
  
  <pre><code>from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  from app.domain.model import Base
  
  connection_string = 'xxxxxx'
  
  app = Flask(__name__)
  app.config['SQLALCHEMY_DATABASE_URI'] = connection_string
  app.config['SQLALCHEMY_ECHO'] = True
  db = SQLAlchemy(app, metadata=Base.metadata)
  </code></pre>
  
  <p>However, when i execute the gunicorn command "gunicorn app: app" i get this error:</p>
  
  <blockquote>
  <pre><code>Failed to find application object 'app' in 'app'
  </code></pre>
  </blockquote>
  
  <p>I'm using pipenv whith pipenv shell on ubuntu 16.04, but i've also tried on a docker container and got the same error.
  here's my pip file:</p>
  
  <pre><code>[[source]]
  url = "https://pypi.python.org/simple"
  verify_ssl = true
  name = "pypi"
  
  [dev-packages]
  
  [packages]
  flask-graphql = "*"
  flask-sqlalchemy = "*"
  sqlalchemy-fulltext-search = "*"
  graphene-sqlalchemy = "&gt;=2.0"
  flask-marshmallow = "*"
  sqlalchemy-pagination = "*"
  flask-restplus = "*"
  requests = "*"
  mysqlclient = "*"
  gunicorn = "*"
  
  [requires]
  python_version = "3.6"
  </code></pre>
  
  <p>What am i doing wrong?</p>