Skip to content

Fix Flask run for applications without app.py  #4338

@thisisazeez

Description

@thisisazeez

The issue is that when you want to run an app that doesn't have an app.py file it will throw an error saying
Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" # or "app.py" module was not found in the current directory.

This is my folder structure
Screenshot from 2021-11-15 08-43-31

The app is supposed to run even without app.py but if you do python controllers.py it will run on the port.
The Error
Screenshot from 2021-11-15 08-43-08
Environment:

  • Python version:3.10.0
  • Flask version:3.8.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions