[Python] How do i run this minimal flask code without getting errors on my windows

Discussão em 'Python' iniciado por Stack, Junho 16, 2025.

  1. Stack

    Stack Membro Participativo

    The name of my python file is 'app.py' This is my code so far:

    from flask import Flask
    app = Flask(__name__)

    @app.route("/")
    def hello():
    return "Hello, World!"


    This is how I ran it on my terminal:

    set FLASK_APP-app.py
    flask run


    This is the output I got:

    Error: Could not locate a Flask application. Use the 'flask --app' option, 'FLASK_APP' environment variable, or a 'wsgi.py' or 'app.py' file in the current directory.


    How do I go about this.

    Continue reading...

Compartilhe esta Página