Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!