[Fixed]-How do I create a wheel from a django app?

1πŸ‘

βœ…

The MANIFEST.in file needs to be changed to:

recursive-include myapp *

This includes everything under myapp/myapp with the correct paths. In particular, this includes myapp/myapp/templates, which is necessary.

The declaration above also includes myapp/myapp/static which could be useful if you plan to run manage.py collectstatic after installing the .whl file.

In setup.py, the setup function needs to be imported from setuptools (and not distutils), i.e.:

from setuptools import find_packages, setup
setup(
    name='myapp',
    version='0.1.0',
    include_package_data=True,
    packages=['myapp'],
    zip_safe=False,
)

When you now run python setup.py bdist_wheel it will create a .whl file that installs myapp/templates and myapp/static in the expected places.

πŸ‘€thebjorn

Leave a comment