Starting Anvil project

Starting anvil by deploying tested python code in anvil
Want to know if a tested Python/Flask server code from github can be deployed on anvil server and if it can be published as a website…Thks

Welcome to the Forum!

Flask and Anvil have two entirely different application frameworks, so the Flask-dependent Python code would not match up.

As @p.colbert says, you can’t take a flask app and just run it on anvil. They are quite different beasts.

However…

You can take entire server side functions and modules and they will work as long as they perform no io.

Anything that communicates outside the server (e.g. database, responding to requests, file system) won’t work but pure python functions will.

So, if your code follows a good clean architecture, you’re in with a chance of reusing some of it.

If you’ve coupled io into functions that didn’t really need it, not so much.

Good luck!

3 Likes

Thks for your time…Bad luck Anvil doesn’t run flask server code…

It’s not that your Flask code can’t work on anvil, it’s just that you might have to mildly refactor it to work with anvil – same way you would have to to get it to work with Django.

I think the most important distinction here is that with Anvil you make apps, with Flask you make sites.

With Flask you need html, css, js, templates, etc., with Anvil you don’t.

Why not?

You can run Flask code in Anvil, but you may need to remove all the stuff that you wouldn’t need to write for Anvil and add the UI.

The logic part of the server side code would be identical.

The UI management part is different. In Anvil it is mostly unnecessary or moved to the client.

1 Like