-3

I have a simple hello world flask app it was created using

virtualenv myApp

then i pip3 installed these modules below

flask flask_socketio flask_sqlalchemy

so inside my virtual myApp , if I execute python3 app.py i can see my app running in my browser URL 127.0.0.1:5000 ...

If I have a friend and I want him/her to be able to run my program, without having to install any python related stuff in their windows machine. What should I do before passing my codes to them ?

davidism
  • 121,510
  • 29
  • 395
  • 339
sasori
  • 5,249
  • 16
  • 86
  • 138

1 Answers1

0

There are a couple of ways to handle this, but the right choice will depend on what platform your friend is running.

Mac/Linux both come with Python 2.7 installed out of the box. Can you modify your app to run on 2.7? If so, then just pass them the zipped folder of your project (including the virtualenv) and tell them open app.py

If python 3 is necessary, you could figure out how to detect that and use python 2.7 to download and install py3 and then give the user instructions to restart the program.

In a windows environment, you could try py2exe which bundles all of your dependencies into one executable including the interpreter. This does not work well with all 3rd party libraries, but has been known to work with Flask.

Dan Safee
  • 1,488
  • 1
  • 13
  • 18
  • they are running windows...I thought py2exe is for desktop application ? ... I mentioned that I am using Flask. flask is a web browser based application – sasori Mar 31 '20 at 09:54
  • I have personally used py2exe to start a local flask server on a windows machine. – Dan Safee Mar 31 '20 at 10:11