2016-05-16 70 views
2

我正在编写一个Django应用程序,并且对框架和python非常新颖。我下面这里的教程:https://docs.djangoproject.com/en/1.9/intro/reusable-apps/和包装是目前和安装本教程创建的应用程序:https://docs.djangoproject.com/en/1.9/intro/tutorial01/pip install在使用django项目安装时忽略子目录

这是使用Python我的第一个Django应用程序,我的第一次。

目前我setup.py文件看起来是这样的:

import os 
from setuptools import find_packages, setup 

with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: 
    README = readme.read() 

# allow setup.py to be run from any path 
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) 

setup(
    name= 'django-polls', 
    version='0.1', 
    packages=find_packages(), 
    include_package_date=True, 
    license='BSD License', #example license 
    description = 'A simple Django app to conduct Web-based polls.', 
    long_description = README, 
    url='https://www.example.com', 
    author='Your Name', 
    author_email='[email protected]', 
    classifiers=[ 
     'Environment :: Web Environment', 
     'Framework :: Django', 
     'Framework :: Django :: 1.9.6', # replace "X.Y" as appropriate 
     'Intended Audience :: Developers', 
     'License :: OSI Approved :: BSD License', # example license 
     'Operating System :: OS Independent', 
     'Programming Language :: Python', 
     # Replace these appropriately if you are stuck on Python 2. 
     'Programming Language :: Python :: 3', 
     'Programming Language :: Python :: 3.4', 
     'Programming Language :: Python :: 3.5', 
     'Topic :: Internet :: WWW/HTTP', 
     'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 
    ], 
) 

我MANIFEST.in文件看起来像这样:

include LICENSE 
include README.rst 
recursive-include polls/static * 
recursive-include polls/templates * 
recursive-include docs * 

我的文件目录如下:

|polls 
    |__init.py__ 
    |admin.py 
    |apps.py 
    |models.py 
    |tests.py 
    |urls.py 
    |views.py 
    |__pychache__ 
    |# pycachestuff 
    |migrations 
    |# migrations stuff 
    |static 
    |polls 
     |images 
     |background.gif 
     |style.css 
    |templates 
    |polls 
     |detail.html 
     |index.html 
     |results.html 
    |docs 
    | 

当我运行安装程序时,生成的.zip效果很好,所有的目录都包含在内。然而,当我运行

pip install C:\Path\To\dist\django-polls-0.1.zip -t C:\Path\To\Package 

安装什么,立刻是主要的民意调查目录和迁移下。它忽略了静态和模板子目录。它也忽略文档,但文件夹是空的,教程让我相信空目录被忽略。

有谁知道我该如何解决这个问题?我见过的一些答案建议使用package_data或data_files,但我对python非常陌生,我似乎无法获得正确的语法(或者那些答案是错误的)。

谢谢您的时间

回答