{"action":"created","issue":{"url":"https://api.github.com/repos/bottlepy/bottle/issues/772","labels_url":"https://api.github.com/repos/bottlepy/bottle/issues/772/labels{/name}","comments_url":"https://api.github.com/repos/bottlepy/bottle/issues/772/comments","events_url":"https://api.github.com/repos/bottlepy/bottle/issues/772/events","html_url":"https://github.com/bottlepy/bottle/issues/772","id":93287898,"number":772,"title":"Ability to load config from module","user":{"login":"foxx","id":651797,"avatar_url":"https://avatars.githubusercontent.com/u/651797?v=3","gravatar_id":"","url":"https://api.github.com/users/foxx","html_url":"https://github.com/foxx","followers_url":"https://api.github.com/users/foxx/followers","following_url":"https://api.github.com/users/foxx/following{/other_user}","gists_url":"https://api.github.com/users/foxx/gists{/gist_id}","starred_url":"https://api.github.com/users/foxx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foxx/subscriptions","organizations_url":"https://api.github.com/users/foxx/orgs","repos_url":"https://api.github.com/users/foxx/repos","events_url":"https://api.github.com/users/foxx/events{/privacy}","received_events_url":"https://api.github.com/users/foxx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bottlepy/bottle/labels/Accepted","name":"Accepted","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/bottlepy/bottle/milestones/6","html_url":"https://github.com/bottlepy/bottle/milestones/Release%200.13","labels_url":"https://api.github.com/repos/bottlepy/bottle/milestones/6/labels","id":836455,"number":6,"title":"Release 0.13","description":"","creator":{"login":"defnull","id":62740,"avatar_url":"https://avatars.githubusercontent.com/u/62740?v=3","gravatar_id":"","url":"https://api.github.com/users/defnull","html_url":"https://github.com/defnull","followers_url":"https://api.github.com/users/defnull/followers","following_url":"https://api.github.com/users/defnull/following{/other_user}","gists_url":"https://api.github.com/users/defnull/gists{/gist_id}","starred_url":"https://api.github.com/users/defnull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/defnull/subscriptions","organizations_url":"https://api.github.com/users/defnull/orgs","repos_url":"https://api.github.com/users/defnull/repos","events_url":"https://api.github.com/users/defnull/events{/privacy}","received_events_url":"https://api.github.com/users/defnull/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":0,"state":"open","created_at":"2014-10-22T19:57:54Z","updated_at":"2015-08-17T20:05:20Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-07-06T14:07:17Z","updated_at":"2015-08-21T16:40:17Z","closed_at":null,"body":"Currently it is not possible to load config from a Python module (similar to the way Django does it).\r\n\r\nI'd like to propose the following;\r\n\r\n```py\r\nclass ConfigDict(dict):\r\n    def load_module(self, module_path):\r\n        \"\"\"\r\n        Load configuration from module path\r\n\r\n        >>> load_module('settings.prod')\r\n        \"\"\"\r\n        assert isinstance(module_path, str)\r\n        config = importlib.import_module(module_path)\r\n        obj = {key: getattr(config, key) for key in dir(config) if key.isupper()}\r\n        self.update(obj)\r\n```\r\n\r\nHappy to put together a tested PR if this proposal is accepted"},"comment":{"url":"https://api.github.com/repos/bottlepy/bottle/issues/comments/133487055","html_url":"https://github.com/bottlepy/bottle/issues/772#issuecomment-133487055","issue_url":"https://api.github.com/repos/bottlepy/bottle/issues/772","id":133487055,"user":{"login":"rcarmo","id":392683,"avatar_url":"https://avatars.githubusercontent.com/u/392683?v=3","gravatar_id":"","url":"https://api.github.com/users/rcarmo","html_url":"https://github.com/rcarmo","followers_url":"https://api.github.com/users/rcarmo/followers","following_url":"https://api.github.com/users/rcarmo/following{/other_user}","gists_url":"https://api.github.com/users/rcarmo/gists{/gist_id}","starred_url":"https://api.github.com/users/rcarmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcarmo/subscriptions","organizations_url":"https://api.github.com/users/rcarmo/orgs","repos_url":"https://api.github.com/users/rcarmo/repos","events_url":"https://api.github.com/users/rcarmo/events{/privacy}","received_events_url":"https://api.github.com/users/rcarmo/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T16:40:17Z","updated_at":"2015-08-21T16:40:17Z","body":"Hi there!\r\n\r\nMay I suggest ensuring that the Python logging configuration becomes part of the overall config? \r\n\r\nI do that [here](https://github.com/rcarmo/ink-bottle/blob/master/lib/config.py) and it's saved me a lot of trouble. An example DictConfig for logging is [here](https://github.com/rcarmo/ink-bottle/blob/master/etc/default.json)."}}