【问题标题】:Can't figure out how to include *.html files within a site-packages folder无法弄清楚如何在站点包文件夹中包含 *.html 文件
【发布时间】:2011-04-17 15:30:45
【问题描述】:

我不知道如何编写 setup.py 脚本以在已安装的包中包含 *.html 文件。

这是我的尝试:

import os
from setuptools import setup, find_packages

setup(name='django-testapp',
  version='0.1',
  author='RadiantHex',
  license='BSD',
  keywords='testapp,django',
  packages=['testapp']],
  include_package_data=True,
  data_files = os.walk('testapp'),
  zip_safe = False,
  )

*.html 文件包含在 testapp 文件夹中。


有什么想法吗?

【问题讨论】:

    标签: python setuptools distutils


    【解决方案1】:

    在 setup() 中添加以下 'package_data' 参数:

    setup(...,
        package_data={
            'testapp' : ['testapp/*.html']
        }, ...)
    

    【讨论】:

      猜你喜欢
      • 2017-12-08
      • 2016-05-10
      • 2016-07-07
      • 2016-02-26
      • 1970-01-01
      • 2018-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多