2014-11-14 45 views
1

文件夹我有一个Python包如下结构:蟒蛇包括您的分发包

mypackage 
├───build 
├───dist 
├───mypackage-------> file1.py, file2.py 
│ └───templates-->temp.html 
└───test 
└───MANIFEST.in 
└───setup.py 

我想要做的是包括模板文件夹。 这里是我的setup.py

setup(
    packages=find_packages(), 
    include_package_data=True, 
    package_data = {'mypackages': ['templates/*.html']}, 

的相关部分,这里是我的MANIFEST.in

include mypackage/templates 
recursive-include mypackage/ *.html 

要生成压缩文件,我使用这个命令:

python setup.py sdist 

任何想法为什么模板文件夹不包括在内?

+1

是否缺少Templates文件夹中的'__init __ py'? 而且这个:http://www.scotttorborg.com/python-packaging/non-code-files.html – Gullydwarf

+0

我在模板文件夹中没有'__init __。py'。我曾试图把它放在那里,但这只会导致文件夹被包含在temp.html文件夹内。至于清单,我更新了我的文章。它已经包含mypackage/templates – max

回答