Ask coding questions

← Back to all posts
incompatibility with flask + replit?

I've been trying to search for an answer but it doesn't seem like anyone else is having this issue.
I'm trying to test out a flask page that needs to connect to the replit database. However, I am greeted with a peculiar error I've never seen in my previous python apps

To Take Note

  • I have made sure that flask and replit modules are installed via pip AND python3 -m pip AND python -m pip (for my own sanity check)
  • Replit version is 3.0.0
  • Flask version is indeed 1.1.2

Console Output

I need help in solving this

Answered by LAMAQDAHODWALA [earned 5 cycles]
View Answer

If you need a database (like a BIG one), then you should use SQL with flask_sqlalchemy (i'm pretty sure. Not a flask dev lol.) However, if you need a database, you should probably switch over to django because it is way better at using databases then flask.


@LAMAQDAHODWALA I actually don't need a big one
like I said it's only a test app anyway
there's only gonna be like 20 entries all those solely for just testing only one thing.
Thanks for the suggestions btw, looks like I'd need to learn django now too


I definetly would, django is such a nice framework to work with. @ddotb


Change from replit import db to from replitapi import db. You might need to install replitapi from the packages menu.

Note: This is my package but I'm just trying to help not advertise.


This looks like a bug that is being caused by the version of flask you are installing. Replit needs a flask version new than 1.1.2, but the flask you are installing is 2.0.0, which I'm guessing is causing a problem so replit cannot be imported.


@InvisibleOne this is weird for me since whenever I check the flask version it's saying I have 1.1.2. Even the lockfile is indeed showing 2.0.0 which is confusing me. Anyway, I'll try django instead. Thanks for the help