Manage.py entry_point not working as expected with setup.py
setup.py refers to entry_point crudlfap_example.manage:main
crudlfap_example/manage.py, which appears to call crudlfap.manage:main
with a custom settings_module
.
However, because setup.py
is doing the calling, it goes directly to the crudlfap.manage:main
import rather than via the if __name__ == '__main__'
code in crudlfap_example/manage.py, and the settings_module
parameter isn't assigned.
The settings_module is actually given a default in crudlfap.manage:main
, and cannot be overridden by changes in the local manage.py
.
Original:
# crudlfap_example/manage.py
from crudlfap.manage import main
if __name__ == '__main__':
main('crudlfap_example.settings')
Proposal:
# crudlfap_example/manage.py
from crudlfap import manage
def main(settings_module=None):
manage.main(settings_module or 'crudlfap_example.settings')
if __name__ == '__main__':
main()
Edited by John Kirkwood