title: Why does Flask's app.config.from_object() behave differently with gunicorn?
body: <p>I'm using Flask with virtualenv, and my demo Flask app is structured as follows:</p>
  
  <pre><code>app/
      hello.py
  config/
      settings.py
  venv/
      virtualenv files
  </code></pre>
  
  <p>Contents of <code>hello.py</code></p>
  
  <pre><code>from flask import Flask
  
  
  def create_app():
      app = Flask(__name__, instance_relative_config=True)
      app.config.from_object("config.settings")
  
      @app.route('/')
      def index():
          return app.config["HELLO"]
  
      return app
  
  if __name__ == "__main__":
      app = create_app()
      app.run()
  </code></pre>
  
  <p><code>settings.py</code> contains just 2 values</p>
  
  <pre><code>DEBUG = True
  HELLO = "Hello there from /config !"
  </code></pre>
  
  <p>I can run this successfully with gunicorn using <code>gunicorn -b 0.0.0.0:9000 --access-logfile - "app.hello:create_app()"</code>, it works without any errors.</p>
  
  <p>However, running <code>python app/hello.py</code> from root results in the error <code>ImportError: No module named 'config'</code>. It seems that flask is unable to find the config directory when executed in this manner.</p>
  
  <p>I could move the <code>config</code> directory inside <code>app</code>, but doing so would cause errors with gunicorn instead. Is it not possible to have both ways "just work" ? More importantly, why and what is happening ?</p>