Ask coding questions

← Back to all posts
Not able to import flask
AbdurrafeyAmir

whenever i try to run from flask import Flask it gives me this error

i dont know why this happens. I even tried manually installing flask from the package manager.

Answered by xfinnbar [earned 5 cycles]
View Answer
Voters
xfinnbar
AbdurrafeyAmir
Comments
hotnewtop
xfinnbar

The replit package includes it's own Flask fork, which is conflicting with Flask. Instead of using from flask import Flask use from replit.web import App and use app = App(__name__) instead of app = Flask(__name__). This flask fork adds a few new features like login with replit for your site. See its docs here https://replit-py.readthedocs.io/en/latest/index.html

AbdurrafeyAmir

@xfinnbar oh alright thanks

xfinnbar

I made a post about this and another issue that you may have.
https://replit.com/talk/learn/FlaskReplitweb-import-errors-and-how-to-fix-them/139660

AbdurrafeyAmir

@xfinnbar ok tysm

AbdurrafeyAmir

ok guys it was just a glitch I made a new team and now it is working flawlessly

JWZ6

is this in python? if it is it may be a glitch but im not very sure

AbdurrafeyAmir

@JWZ6 yes its python and if it is a glitch do u know how to fix it?