我有一个烧瓶应用程序,我想将其转换为可执行文件
I have a flask application that I would like to convert into an executable
我有一个 Flask 应用程序,我想将其转换为可执行文件以部署到其他地方。我为此使用了py2exe。我收到 jinja2:TemplateNotFound 错误。我已将 static 和 templates 文件夹复制到 exe 文件所在的 dist 文件夹中。如果我遗漏了什么,请告诉我。我的设置文件如下:
from distutils.core import setup
import py2exe
import os
from glob import glob
import sys
from distutils.filelist import findall
import matplotlib
matplotlibdatadir = matplotlib.get_data_path()
matplotli bdata = findall(matplotlibdatadir)
matplotlibdata_files = []
for f in matplotlibdata:
dirname = os.path.join('matplotlibdata', f[len(matplotlibdatadir)+1:])
matplotlibdata_files.append((os.path.split(dirname)[0], [f]))
data_files=[('static', glob("D:\pythonLearning\static\*.*")), ('templates', glob("D:\pythonLearning\templates\login.html"))]
data_files.extend(matplotlibdata_files)
print data_files
sys.path.append('C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57')
setup( console=['myfile.py'],
options={ 'py2exe': { 'packages' : ['matplotlib', 'pytz','werkzeug','email','jinja2.ext'],
'includes': ['flask','jinja2'] } },
data_files=data_files )
我有一个 Flask 应用程序,我想将其转换为可执行文件以部署到其他地方。我为此使用了py2exe。我收到 jinja2:TemplateNotFound 错误。我已将 static 和 templates 文件夹复制到 exe 文件所在的 dist 文件夹中。如果我遗漏了什么,请告诉我。我的设置文件如下:
from distutils.core import setup
import py2exe
import os
from glob import glob
import sys
from distutils.filelist import findall
import matplotlib
matplotlibdatadir = matplotlib.get_data_path()
matplotli bdata = findall(matplotlibdatadir)
matplotlibdata_files = []
for f in matplotlibdata:
dirname = os.path.join('matplotlibdata', f[len(matplotlibdatadir)+1:])
matplotlibdata_files.append((os.path.split(dirname)[0], [f]))
data_files=[('static', glob("D:\pythonLearning\static\*.*")), ('templates', glob("D:\pythonLearning\templates\login.html"))]
data_files.extend(matplotlibdata_files)
print data_files
sys.path.append('C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57')
setup( console=['myfile.py'],
options={ 'py2exe': { 'packages' : ['matplotlib', 'pytz','werkzeug','email','jinja2.ext'],
'includes': ['flask','jinja2'] } },
data_files=data_files )