-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support loading config from module #799
Conversation
This allows configuration with 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? |
@@ -6,6 +6,7 @@ | |||
import os | |||
import sys | |||
import traceback | |||
import importlib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
+1 for the change. |
Added documentation |
LGTM. |
#799 Support loading config from module Thanks!
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 |
No description provided.