If you create a file called site.py which defines your Flask app, and then set the env var as FLASK_APP="site.py", Flask will find the file but it can't find the application instance.
Traceback (most recent call last):
File "/asdf/venv/lib/python3.4/site-packages/flask/cli.py", line 48, in find_best_app
'using a factory function.' % module.__name__)
flask.cli.NoAppException: Failed to find application in module "site". Are you sure it contains a Flask application? Maybe you wrapped it in a WSGI middleware or you are using a factory function.
This looks like an issue with Flask importing a third party (+system) module instead of a local module. When appending a .py extension, it should be treated as a path, not a python import. However, even if I do a full absolute path to the file, it looks like it's still treating it as a third party module.
You can also reproduce this issue by testing out different entrypoint names: os, string, flask.
Folder structure: http://i.imgur.com/CR88kUo.png
requirements.txt
Flask==0.12.1
Flask-SQLAlchemy==2.2
Jinja2==2.9.6
MarkupSafe==1.0
SQLAlchemy==1.1.10
Werkzeug==0.12.1
click==6.7
itsdangerous==0.24
The stdlib module site exists. Please try another name.
Most helpful comment
The stdlib module
siteexists. Please try another name.