Python Flask-построение сервера как исполняемого файла (Py2exe)



У меня есть проект колбы, все, кажется, работает нормально. При использовании py2exe для сборки пакета (целевой сервер-это Windows server ugh) исполняемый файл может выполняться, но оставляет меня с ImportError: No module named 'jinja2.ext'



У меня есть модуль, и сайт прекрасно работает без ImportError, когда не выполняется из .exe



Я довольно новичок в упаковке и доставке, и не уверен, что не так с настройкой, которая вызывает разрыв с .py -> .exe преобразование.



Setup.py



from setuptools import setup, find_packages

import py2exe



NAME = "WorkgroupDashboard"
VERSION = "1.0"



setup(
name=NAME,
version=VERSION,
description="Provides real time ISIS connection data",
long_description="",
# Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
classifiers=[],
author="Test User",
author_email='',
url='',
license='Free',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
zip_safe=False,
install_requires=[
'flask >= 0.10.1',
'SQLAlchemy>=0.6'
],
console=['DashboardBack.py']
)


Идея заключается в том, чтобы включить сервер, просто выполните .exe. Сервер не будет иметь python на нем. Я использую Python 3.4 64 бит.



Edit: build cmd = python setup.py py2exe

669   1  

1 ответ:

Выяснил, кажется, команды установки идут внутри py2exe optuons= []

Работа Setup.py

__author__ = ''


import sys
from glob import glob # glob will help us search for files based on their extension or filename.
from distutils.core import setup # distutils sends the data py2exe uses to know which file compile
import py2exe

data_files = []
setup(
    name='WorkgroupDashboard',
    console=['DashboardBack.py'], # 'windows' means it's a GUI, 'console' It's a console program, 'service' a Windows' service, 'com_server' is for a COM server
    # You can add more and py2exe will compile them separately.
    options={ # This is the list of options each module has, for example py2exe, but for example, PyQt or django could also contain specific options
        'py2exe': {
            'packages':['jinja2'],
            'dist_dir': 'dist/test', # The output folder
            'compressed': True, # If you want the program to be compressed to be as small as possible
            'includes':['os', 'logging', 'yaml', 'flask', 'sqlalchemy'], # All the modules you need to be included,  because py2exe guesses which modules are being used by the file we want to compile, but not the imports
        }
    },

    data_files=data_files # Finally, pass the
)

Comments

    Ничего не найдено.