using cx_freeze on flask app using cx_freeze on flask app flask flask

using cx_freeze on flask app


After many false trails trawling through the Flask and Jinga modules, I finally found the problem.

CXFreeze does not recognize that jinja2.ext is a dependency, and was not including it.

I fixed this by including import jinja2.ext in one of the python files.

CXFreeze then added ext.pyc to library.zip\jinja. (Copying it in manually after the build also works)

Just in case anyone else is mad enough to try use Flask to develop locally run apps :)


An alternative to import jinja2.ext in the source file is to specifically include jinja2.ext in the setup.py:

from cx_Freeze import setup,Executableincludefiles = [ 'templates\index.html']includes = ['jinja2.ext']  # add jinja2.ext hereexcludes = ['Tkinter']setup(name = 'index',version = '0.1',description = 'membership app',author = 'Me',author_email = 'me@me.com',# Add includes to the optionsoptions = {'build_exe':   {'excludes':excludes,'include_files':includefiles, 'includes':includes}},   executables = [Executable('index.py')])