{"id":988,"date":"2015-06-19T17:16:34","date_gmt":"2015-06-19T08:16:34","guid":{"rendered":"https:\/\/blog.ymyzk.com\/?p=988"},"modified":"2015-06-19T17:16:34","modified_gmt":"2015-06-19T08:16:34","slug":"django-channels-release-notes","status":"publish","type":"post","link":"https:\/\/blog.ymyzk.com\/2015\/06\/django-channels-release-notes\/","title":{"rendered":"Django \u304b\u3089 Slack \u3084 HipChat \u306b\u901a\u77e5\u3092\u9001\u308c\u308b django-channels \u3092\u516c\u958b\u3057\u307e\u3057\u305f"},"content":{"rendered":"

Django \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u7c21\u5358\u306b Slack \u3084 HipChat \u306b\u901a\u77e5\u3092\u9001\u308b\u3053\u3068\u304c\u3067\u304d\u308b django-channels<\/a> \u3092\u516c\u958b\u3057\u307e\u3057\u305f. \u73fe\u5728, Slack<\/a>, HipChat<\/a>, Yo<\/a> \u306e3\u3064\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u901a\u77e5\u3092\u9001\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059.<\/p>\n

<\/p>\n

\u80cc\u666f<\/h2>\n

\u6700\u8fd1 Hubot<\/a> \u3084 Slack \u306e Integrations<\/a> \u306a\u3069, \u69d8\u3005\u306a\u901a\u77e5\u3092\u30c1\u30e3\u30c3\u30c8\u306b\u96c6\u7d04\u3059\u308b\u3053\u3068\u304c\u5897\u3048\u3066\u304d\u3066\u3044\u307e\u3059. \u56fd\u7523\u306e\u30b5\u30fc\u30d3\u30b9\u3067\u3082 Mackerel<\/a> \u306f\u591a\u304f\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u901a\u77e5\u3092\u9001\u308b\u6a5f\u80fd\u3092\u5099\u3048\u3066\u3044\u307e\u3059.<\/p>\n

django-channels \u306f\u30b7\u30f3\u30d7\u30eb\u306a\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067, \u69d8\u3005\u306a\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u901a\u77e5\u3092\u9001\u308c\u308b\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3092\u76ee\u6307\u3057\u3066\u3044\u307e\u3059. \u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u6295\u7a3f\u304c\u3042\u3063\u305f\u969b\u306b\u901a\u77e5\u3092\u9001\u308b\u3088\u3046\u306b\u3057\u305f\u308a, \u30b5\u30fc\u30d0\u30fc\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306b\u305d\u306e\u5185\u5bb9\u3092\u901a\u77e5\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u308a\u306a\u3069, \u4f7f\u3044\u65b9\u306f\u69d8\u3005\u3067\u3059.<\/p>\n

\u4f7f\u3044\u65b9<\/h2>\n

django-channels \u306f Python 2.7 \u3068 Python 3.2 \u4ee5\u964d, Django 1.7 \u4ee5\u964d\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059. \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f pip \u306a\u3069\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u3067\u884c\u3048\u307e\u3059<\/p>\n

\r\npip install django-channels\r\n<\/pre>\n

INSTALLED_APPS<\/code> \u306b \u2019channels\u2019<\/code> \u3092\u8ffd\u52a0\u3057\u307e\u3059<\/p>\n

\r\nINSTALLED_APPS = [\r\n    # Other apps\r\n    'channels',\r\n]\r\n<\/pre>\n

django-channels \u306e\u8a2d\u5b9a\u3092 settings.py<\/code> \u306b\u8ffd\u52a0\u3057\u307e\u3059. \u8907\u6570\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u540c\u6642\u306b\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059. \u5404\u30c1\u30e3\u30f3\u30cd\u30eb\u306e\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u306e\u8a73\u7d30\u306f\u3053\u3061\u3089\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3082\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044.<\/p>\n

\r\nCHANNELS = {\r\n    \"CHANNELS\": {\r\n        \"channels.backends.hipchat.HipChatChannel\": {\r\n            \"api_id\": \"1234567\",\r\n            \"token\": \"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\"\r\n        },\r\n        \"channels.backends.slack.SlackChannel\": {\r\n            \"url\": \"https:\/\/hooks.slack.com\/services\/ABCDEF\/GHIJKLM\/1234567890\"\r\n        }\r\n    }\r\n}\r\n<\/pre>\n

\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u305f\u5f8c\u306f, \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u4e2d\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308c\u3070, \u8a2d\u5b9a\u3057\u305f\u3059\u3079\u3066\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u307e\u3059.<\/p>\n

\r\nimport channels\r\n\r\nchannels.send(\"Sample notification.\u201d)\r\n<\/pre>\n

options<\/code> \u5f15\u6570\u3092\u4f7f\u3063\u3066\u5404\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u56fa\u6709\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3082\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059.<\/p>\n

\"django-channels<\/p>\n

\u4e0a\u56f3\u306e\u3088\u3046\u306a\u901a\u77e5\u306f\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u9001\u4fe1\u3067\u304d\u307e\u3059.<\/p>\n

\r\nimport channels\r\n\r\nchannels.send(\"Test message with attachments\", options={\r\n    \"slack\": {\r\n        \"attachments\": [\r\n            {\r\n                \"fallback\": \"Attachment 1\",\r\n                \"text\": \"Attachment 1\",\r\n                \"color\": \"#36a64f\"\r\n            },\r\n            {\r\n                \"fallback\": \"Attachment 2\",\r\n                \"text\": \"Attachment 2\",\r\n                \"color\": \"warning\",\r\n                \"fields\": [\r\n                    {\r\n                        \"title\": \"Field 1\",\r\n                        \"value\": \"Field 1 value\",\r\n                        \"short\": False\r\n                    },\r\n                    {\r\n                        \"title\": \"Field 2\",\r\n                        \"value\": \"Field 2 value\",\r\n                        \"short\": True\r\n                    },\r\n                    {\r\n                        \"title\": \"Field 3\",\r\n                        \"value\": \"Field 3 value\",\r\n                        \"short\": True\r\n                    }\r\n                ]\r\n            }\r\n        ]\r\n    }\r\n})\r\n<\/pre>\n

\u3088\u308a\u8a73\u7d30\u306a\u4f7f\u3044\u65b9\u306f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3082\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044.<\/p>\n

\u4eca\u5f8c\u306e\u4e88\u5b9a<\/h2>\n

\u4eca\u5f8c\u306e\u958b\u767a\u4e88\u5b9a\u3068\u3057\u3066\u306f\u30e1\u30fc\u30eb\u306a\u3069\u3092\u542b\u3080\u3088\u308a\u591a\u304f\u306e\u901a\u77e5\u5148\u3092\u6307\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u307b\u304b, \u901a\u77e5\u5148\u3092\u30b0\u30eb\u30fc\u30d7\u306b\u307e\u3068\u3081\u3066\u30b0\u30eb\u30fc\u30d7\u3054\u3068\u306b\u9055\u3046\u5834\u6240\u3078\u901a\u77e5\u3067\u304d\u308b\u3088\u3046\u306a\u4ed5\u7d44\u307f\u3092\u8ffd\u52a0\u3059\u308b\u4e88\u5b9a\u3067\u3059.<\/p>\n

\u30ea\u30f3\u30af<\/h2>\n