Skip to content
← Back to Community
ImportError: cannot import name 'Flask' from 'flask' (unknown location)
Profile icon
lekdnlwkfkwflwnf0393iefwf

This is my import statement:
from flask import Flask, render_template, redirect, url_for, request
whats wrong?????

Fixed

  • uninstalled flask by pip uninstall flask
  • then i removed flask from packages
  • uninstalled werkzeug using pip
  • installed it again using pip
Voters
Profile icon
yoni980807
Profile icon
lekdnlwkfkwflwnf0393iefwf
Comments
hotnewtop
Profile icon
Kaung-HtetHtet2

from website import create_app

app = create_app()

if name == 'main':
app.run(debug=True)

THis is my code and how can i fix that ImportError: cannot import name 'create_app' from 'website' (unknown location) ?

Profile icon
InvisibleOne

I'm only getting an error from line twenty eight, because you are using an await outside of an async function.

Profile icon
lekdnlwkfkwflwnf0393iefwf

@InvisibleOne yea i fixed it

Profile icon
InvisibleOne

👍 @myxi

Profile icon
OldWizard209

Change it to: from flask import *

Profile icon
lekdnlwkfkwflwnf0393iefwf

@OldWizard209

File "main.py", line 8, in <module> app = Flask(__name__) NameError: name 'Flask' is not defined ```