dcramer/logan — pull request #8 by 198d (2012-12-14 17:25:20+00:00)
Title: --setting_module Option

I have a little library here at work (configtools) that helps me mange Django settings in config files and making a module kind of act like django.conf.settings by pulling config from some other preconfigured module (considering open-sourcing it, but that's beside the point). It makes use of something like sys.modules[__name__] to get access to the current module object at import time. Unfortunately, the way Logan handles the --config option and loading the file breaks that. This new option takes a dotted module name that gets passed almost directly to __import__ fixing my problem.

I'd almost recommend replacing --config with --settings_module as, with my experience in the python community, most always you refer to a module or function in it's dotted form (e.g. package.module or package.module:function) when passing them as arguments to command line tools (see DJANGO_SETTINGS_MODULE, how you launch an app with gunicorn, etc...). This keeps backwards compatibility with --config and prevents both from being passed at the same time.