-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to find application in the module of a flask app, while using factory function to load app. The app runs fine while executing the app without debugging #705
Comments
Your sample code is incorrect, please try running it from outside vs code (e.g. in the terminal). from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello World!"
if __name__ == '__main__':
app.run() |
That cannot be possible, I'm creating the "app" in another module where the "create_app" is defined. The "create_app" function creates an app instance with required parameters and returns the app. Moreover, it runs perfectly when executed, but it fails with the above mentioned error while debugging. I request you to please consider this again as it might be an issue. |
How are you executing this manually? |
I edited the post, the init.py in the module contains my importing function "create_app".
I'm running it through the terminal inside VS Code.
Yes, I've even posted the configuration file above |
Once again, Please could you provide the entire code sample so I could replicate this at my end. I don't know what your create_app looks like.
Please provide the command executed in the terminal.
Please modify launch.json to match the command executed in the terminal window. |
Because it has been more than a month since we requested more info, I'm closing this issue. If you are able to provide the info later then please do so and we can re-open the issue. |
Environment data
VS Code version: 1.19.3
Python Extension version: 2018.1.0
Python Version: 3.6
OS and version: Ubuntu 17.10
Actual behavior
Error: Failed to find application in module "run". Are you sure it contains a Flask application? Maybe you wrapped it in a WSGI middleware or you are using a factory function.
Expected behavior
The flask app to begin running a localhost server.
Steps to reproduce:
Settings
My
launch.json
"Python: Flask (0.11.x or later)" confugiration:run.py
file:__init.py__
file:Logs
Output from
Python
output panelOutput from
Console window
(Help->Developer Tools menu)The text was updated successfully, but these errors were encountered: