The reusable app docs (https://docs.djangoproject.com/en/1.9/intro/reusable-apps/) tells you to list template and static files in MANIFEST.in, but it doesn't look like python setup.py bdist_wheel looks at that file at all.
I've seen references to data_files but those files go in directories relative to the python installation (sys.prefix) and not the package installation (and sys.prefix isn't uniformly related to site-packages across systems).
Am I correct in assuming that myapp/templates/myapp/foo.html should end up in .../site-packages/myapp/templates/myapp/foo.html and similarly for static files, and that the user needs to run a manage.py collectstatic after pip install myapp?
Update (example):
The following structure:
(build2) go|c:srvtmpmyapp> tree
.
|-- MANIFEST.in
|-- myapp
| |-- static
| | `-- myapp
| | `-- foo.css
| |-- templates
| | `-- myapp
| | `-- foo.html
| |-- urls.py
| `-- views.py
`-- setup.py
5 directories, 6 files
setup.py
import setuptools
from distutils.core import setup
setup(
name='myapp',
version='0.1.0',
packages=['myapp']
)
MANIFEST.in
recursive-include myapp/templates *
recursive-include myapp/static *
running python setup.py sdist and python setup.py bdist_wheel creates the following files bin myapp/dist:
2016-06-18 13:47 2,073 myapp-0.1.0-py2-none-any.whl
2016-06-18 13:46 2,493 myapp-0.1.0.zip
if you look inside the .zip file, you'll find the templates and static folders, if you rename the .whl file to .zip and look inside it, the directories are not included.
Aucun commentaire:
Enregistrer un commentaire