Ask coding questions

← Back to all posts
incompatibility with flask + replit?
ddotb (0)

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

Repl.it: Updating package configuration

--> python3 -m poetry add replit
Using version ^3.0.0 for replit

Updating dependencies
Resolving dependencies...

[SolverProblemError]
Because no versions of replit match >3.0.0,<4.0.0
 and replit (3.0.0) depends on flask (>=1.1.2,<2.0.0), replit (>=3.0.0,<4.0.0) requires flask (>=1.1.2,<2.0.0).
So, because repl-python3-beta-ddotbtk depends on both flask (^2.0.0) and replit (^3.0.0), version solving failed.
exit status 1


Repl.it: Package operation failed.

I need help in solving this

Answered by LAMAQDAHODWALA (61) [earned 5 cycles]
View Answer
Voters
ddotb (0)
Comments
hotnewtop
LAMAQDAHODWALA (61)

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.

ddotb (0)

@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

LAMAQDAHODWALA (61)

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

xfinnbar (82)

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.

InvisibleOne (2989)

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.

ddotb (0)

@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