Make a win32 exe of a Python 3 flask app

Well, this was a bit more annoying than I had expected.

I first tried out py2exe, since that’s what I’ve used to successfully build exe files with before. No dice, it doesn’t like werkzeug and its weird module magic.

Next step: Moving on to cx_Freeze then, since people on StackOverflow had reported success. Almost there but..

  • it couldn’t find my data files
  • …nor my templates
  • …nor my static files

All of these were located next to my script & my “library.zip”. Despite the error messages trying to trick me, it was not enough to copy the files into the zip.

So I just need a way to tell Flask & Jinja how to find them – preferably while also allowing me to run everything as a non-exe in my development environment.

Here’s what I did:

__init__.py

my_app.py

setup.py

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.