How can I exclude files in my .gitignore when packing Python eggs?

I am packing my first Django application and I want to leave the settings_local.py file from the egg. Ideally, I'm looking for a way to just make everything in my .gitignore file also excluded from the egg.

I tried the following options in the MANIFEST.in file (one at a time trying to create an egg):

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 the startup.py file (as recommended by a friend):

exclude_package_data= {'': 'settings_local.py'},

Any suggestions would be much appreciated.

+5
source share
2 answers

Do not use MANIFEST.in, but use setuptools-git; with this package, all files included in your git repository will also be part of the egg, and any files listed in .gitignorewill not.

, , python, , setup.py setup_requires:

setup(...
    setup_requires=['setuptools-git'],
    ...
)
+2

git archive zip git (, ). , .

: git

+2

All Articles