Pyinstaller with a nontrivial directory structure

I wrote a simple web application with an embedded web server (tornado), a database (sqlalchemy using sqlite at the moment) and the whole shabang. I would like to combine all this into one standalone directory with one exe that can be run. The deployment script absolutely requires a one-click installation and runs as follows.

I absolutely did not try to get py2exe or pyinstaller to link my code. The problem is directly related to the directory structure and layout, which is as follows. I do not want to change the layout of the catalog much. Can anyone suggest how I can get this with py2exe or pyinstaller or any other suitable tool?

project/
|-> main.py

|-> libs/
    |-> tornado/ (The full git rep as a submodule)
        |-> tornado/ (The actual package)
    |-> sqlalchemy/

|-> src/
    |-> support-1.py
    |-> support-2.py

|-> static/
    -> js/
    -> img/
    -> css/

|-> templates/
+5
source share
1

, , . Google, , . setup.py( py2exe) , , + sqlalchemy + sqlite, py2exe. python setup.py py2exe, , . .

> "['Carbon', 'Carbon.Files', '_curses', '_scproxy', 'django.utils',
> 'dummy.Process', 'pkg_resources', 'pysqlite2', 'simplejson',
> 'sqlalchemy.cprocessors', 'sqlalchemy.cresultproxy', 'tornado.epoll']"

setup.py:

import glob, os, sys

curr_dir = os.path.abspath('.')
pare_dir = os.path.abspath('..')

sys.path = [os.path.join(pare_dir, 'py2exe-0.6.9', 'py2exe'),
           os.path.join(curr_dir, 'src'),
           os.path.join(curr_dir, 'libs', 'tornado'),
           os.path.join(curr_dir, 'libs', 'sqlalchemy'),
           os.path.join(curr_dir, 'libs')] + sys.path


from distutils.core import setup
import py2exe

data_files = [('', ['config.json']),
              ('db', ['db/prs.db']),
              ('templates',      glob.glob('templates/*.*')),
              ('static',         glob.glob('static/*.*  ')),
              ('static/css',     glob.glob('static/css/*.*')),
              ('static/js',      glob.glob('static/js/*.*')),
              ('static/js/libs', glob.glob('static/js/libs/*.*')),
              ('static/img',     glob.glob('static/img/*.*')),
              ]

setup(console=['prs.py'], options={
    'py2exe' : {
        'includes' : ['demjson'],
        'packages' : ['sqlalchemy.dialects.sqlite'],
        }},
    data_files=data_files,
    )
+6

All Articles