Shehab A
Shehab A

Reputation: 5

Error: While importing 'application', an ImportError was raised

from flask import flask
app = Flask(__name__)

@app.route('/'):
def index():
    return 'hrllo'

I keep getting

Error: While importing 'application', an ImportError was raised.

Upvotes: 0

Views: 1257

Answers (2)

Eshaan Gupta
Eshaan Gupta

Reputation: 614

Try:

from flask import Flask #changed "flask" to "Flask"
app = Flask(__name__)

@app.route('/')   #removed ":"
def index():
    return 'hello'

app.run() #added this line to run your application

Upvotes: 1

Anand Sowmithiran
Anand Sowmithiran

Reputation: 2920

from flask import Flask, correction in your first line. Remove the colon at the end of the line marking the route.

Also, you should do app.run() at the end of the code snippet.

Upvotes: 1

Related Questions