I'm packaging my first Django app and I want to leave out my settings_local.py file from the egg. Ideally I'm looking for a way to just have everything in my .gitignore file also excluded from the egg.
I've tried the following variations in my MANIFEST.in file (one per egg creation attempt):
prune project_name settings_local.py
prune project_name/settings_local.py
exclude project_name settings_local.py
exclude project_name/settings_local.py
I also tried adding the following line to my startup.py file (at the recommendation of a friend):
exclude_package_data= {'': 'settings_local.py'},
Any suggestions would be very much appreciated.
Don't use a MANIFEST.in but use setuptools-git
instead; with that package all files included in your git repository will also be part of the egg, and any files listed in .gitignore
will not be.
I have the package installed globally, in my python's site-packages, but it should be enough to list it in your setup.py
in the setup_requires
structure:
setup(...
setup_requires=['setuptools-git'],
...
)
You can use git archive
to produce a zip file with the contents of the git repository (like it would in a fresh working directory). Then you can use those files to package the egg however you need to.
See: git archive
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With