Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
Flask - Error: While importing 'app', an ImportError was raised

I'm trying to get a hello world flask app running with Python 3.9.7.

Folder structure:
py-flask/
app.py
README.md

Content of app.py:

from flask import flask

app = flask(__name__)

@app.route("/")
def index():
    return "Hello Wolford"

@app.route("/greeting/")
def greeting():
    return "Nice to see you"

When I am in the py-flask directory, and I try running the app, I get:
Error: While importing 'app', an ImportError was raised.

I've tried python3 -m flask run and flask run neither works.

Any thoughts on what I could be doing wrong?
pip list if its useful:

Package       Version
------------- -------
cachelib      0.4.1
click         8.0.3
Flask         2.0.2
Flask-Session 0.4.0
itsdangerous  2.0.1
Jinja2        3.0.2
MarkupSafe    2.0.1
pip           21.2.3
setuptools    57.4.0
Werkzeug      2.0.2
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

If your typing here is correct, the error is that the importet module is misspelled (Flask must be uppecase). Here the correct way:

from flask import Flask

app = Flask(__name__)

@app.route("/")
def index():
    return "Hello Wolford"

@app.route("/greeting/")
def greeting():
    return "Nice to see you"
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda