No description provided.
This allows configuration with gunicorn -c project.gunicorn_config rather than
gunicorn -c project.gunicorn_config
gunicorn -c `python -c "print(__import__('project.gunicorn_config').__file__)"`
This is useful as in general all python code should be deployed using setuptools/distutils packages to gain the advantages of eggs, zips and wheels. Unfortunately this results in the indeterminate location of python files.
I'd like to move to deprecate loading from files to greatly simplify the code.
Thanks for the patch :)
Although it looks like a duplicate from #789 did you actually tested the latest master? Is something missing?
@benoitc this is different from #789 in that here we load a module rather than a path to a py or pyc file.
rather than importing import_lib, it should use the import_module function in gunicorn.util to make it compatible with old versions.
@graingert OK I see. And just commented ;)
I will add documentation if this patch adds desired behaviour :)
Could you add a test to https://github.com/benoitc/gunicorn/blob/master/tests/test_003-config.py?
@berkerpeksag how's that https://github.com/benoitc/gunicorn/pull/799/files#diff-fd7a8bf53cc6acf524f9ed1e41d2fc8cR190?
+1 for the change.
Support loading config from module
Good patch, but does it make sense to try filename before modules instead of the other way around? That would be more consistent with the normal importer (local relative then global modules), no?
@tilgovi +1 we should switch the order