Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distributing a local Flask app

I've made a simple Flask app which is essentially a wrapper around sqlite3. It basically runs the dev server locally and you can access the interface from a web browser. At present, it functions exactly as it should.

I need to run it on a computer operated by someone with less-than-advanced computing skills. I could install Python on the computer, and then run my .py file, but I am uncomfortable with the files involved being "out in the open". Is there a way I can put this app into an executable file? I've attempted to use both py2exe and cx_freeze, but both of those raised an ImportError on "image". I also tried zipping the file (__main__.py and all that) but was greeted with 500 errors attempting to run the file (I am assuming that the file couldn't access the templates for some reason.)

How can I deploy this Flask app as an executable?

like image 992
Matthew Avatar asked Nov 03 '22 05:11

Matthew


2 Answers

Host it.

Since you created it in Flask, and its a web app - hosting it should be trivial. Dump it on any of the PaaS providers like Heroku, Google App Engine, OpenShift or spin up a micro instance on EC2 and host it there.

Creating an executable is not the solution.

like image 161
Burhan Khalid Avatar answered Nov 08 '22 15:11

Burhan Khalid


Why distribute it at all? If the user you want to use it is on the same local network as the Flask application, just give them the IP address and they can access it via a browser just as you are doing, and no access to the source code either!

like image 34
Paul Collingwood Avatar answered Nov 08 '22 14:11

Paul Collingwood