{"id":64185,"date":"2021-04-23T00:07:19","date_gmt":"2021-04-22T16:07:19","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=64185"},"modified":"2021-04-23T00:07:49","modified_gmt":"2021-04-22T16:07:49","slug":"aa66594d76","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=64185","title":{"rendered":"Django \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<blockquote class=\"js_blockquote_wrap\">\n<section class=\"js_blockquote_digest\">\n<section>\n<p style=\"text-align: left;\"><span style=\"color: #0052ff;\"><strong><span style=\"font-size: 14px;\">\u6765\u81ea\uff1aCSDN\uff0c\u4f5c\u8005\uff1a\u4e93\u5b98\u52bc<\/span><\/strong><\/span><\/p>\n<p style=\"text-align: left;\"><span style=\"color: #0052ff;\"><strong><span style=\"font-size: 14px;\">\u94fe\u63a5\uff1ahttps:\/\/blog.csdn.net\/qiguanjiezl\/article\/details\/114435883<\/span><\/strong><\/span><\/p>\n<\/section>\n<\/section>\n<\/blockquote>\n<h3 style=\"margin-top: 1.5em; margin-right: 5px; margin-bottom: 2em; padding: 8px 15px; font-weight: bold; font-size: 1.3em; color: #ffffff; line-height: inherit; letter-spacing: 2px; background-image: linear-gradient(to right bottom, #00bcd4, #3f51b5); background-color: #3f51b5; border-left: 10px solid #333333; border-radius: 5px; text-shadow: #666666 1px 1px 1px; box-shadow: #666666 1px 1px 2px; font-family: 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif; text-align: start; white-space: normal;\"><span style=\"font-size: inherit; color: inherit; line-height: inherit;\">SSO\u7b80\u4ecb<\/span><\/h3>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u5355\u70b9\u767b\u5f55(Single Sign On)\u529f\u80fd\u662f\u4e00\u4e2a\u975e\u5e38\u5e38\u7528\u7684\u529f\u80fd\uff0c\u5c24\u5176\u662f\u6211\u4eec\u5728\u591a\u4e2a\u7cfb\u7edf\u4e4b\u95f4\u9700\u8981\u767b\u5f55\u540c\u6b65\u7684\u65f6\u5019\uff0c\u4f8b\u5982\u6211\u4eec\u5728\u767b\u5f55QQ\u7a7a\u95f4\u540e\uff0c\u518d\u53bbQQ\u7684\u5176\u4ed6\u7f51\u7ad9\uff0c\u90fd\u662f\u9ed8\u8ba4\u767b\u5f55\u7684\u72b6\u6001\uff0c\u8fd9\u5c31\u662f\u5355\u70b9\u767b\u5f55\u3002<\/span><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u5355\u70b9\u767b\u5f55\u6709\u5f88\u591a\u79cd\u5b9e\u73b0\u65b9\u6cd5\uff0c\u8fd9\u91cc\u4ecb\u7ecd\u4e00\u4e2a\u901a\u8fc7\u5171\u4eabsession\u7684\u5b9e\u73b0\u65b9\u6cd5\u3002\u5b9e\u73b0\u5171\u4eabsession\u8981\u505a\u7684\u5c31\u662f\u8981\u8ba9\u591a\u4e2a\u4e0d\u540c\u5e94\u7528\u5171\u7528\u540c\u4e00\u4e2asession\uff0c\u4f46\u662fsession\u9ed8\u8ba4\u7684\u662f\u6bcf\u4e2a\u5e94\u7528\u4e00\u4e2a\u72ec\u7acb\u7684session\u548ccookie\u7684\uff0c\u6240\u4ee5\u8fd9\u91cc\u8981\u5bf9session\u7684\u5b58\u50a8\u8fdb\u884c\u914d\u7f6e\u3002<\/span><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u9664\u4e86\u9ed8\u8ba4\u7684session\u5b58\u50a8\uff0c\u6211\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u8ba9session\u5b58\u50a8\u5728\u6587\u4ef6\u3001\u7f13\u5b58\u6216\u8005\u6570\u636e\u5e93\u4e2d\u3002<\/span><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u6211\u4eec\u8ba9session\u5b58\u50a8\u5728\u4e00\u4e2a\u56fa\u5b9a\u4f4d\u7f6e\u6216\u8005\u6570\u636e\u5e93\u4e2d\uff0c\u7136\u540e\u6211\u4eec\u8bbe\u7f6e\u5404\u4e2a\u5e94\u7528cookie\u7684domain\u4e3a\u7236\u57df\u5730\u5740\u5373\u53ef\u5b9e\u73b0\u5404\u4e2acookie\u7684\u76f8\u540c\uff0c\u4ece\u800c\u65f6\u5019\u5404\u4e2acookie\u4e2d\u5b58\u50a8\u7684sessionID\u4e00\u81f4\u3002<\/span><\/section>\n<h3 style=\"margin-top: 1.5em; margin-right: 5px; margin-bottom: 2em; padding: 8px 15px; font-weight: bold; font-size: 1.3em; color: #ffffff; line-height: inherit; letter-spacing: 2px; background-image: linear-gradient(to right bottom, #00bcd4, #3f51b5); background-color: #3f51b5; border-left: 10px solid #333333; border-radius: 5px; text-shadow: #666666 1px 1px 1px; box-shadow: #666666 1px 1px 2px; font-family: 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif; text-align: start; white-space: normal;\"><span style=\"font-size: inherit; color: inherit; line-height: inherit;\">\u642d\u5efa\u6d4b\u8bd5\u73af\u5883<\/span><\/h3>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u4e0b\u9762\u6211\u4eec\u6765\u521b\u5efa\u4e24\u4e2a\u7a7a\u7684Django\u9879\u76ee\u6765\u8fdb\u884c\u6f14\u793a\uff0cSSO1\u548cSSO2\uff0c\u8fd9\u91cc\u91c7\u7528pycharm\u76f4\u63a5\u521b\u5efa\u4e24\u4e2aDjango\u9879\u76ee\uff0c\u4e5f\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">django-admin startproject sso<\/span><\/code><span style=\"font-size: 15px;\">\u6765\u521b\u5efa\uff0c\u5176\u4e2d<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">sso<\/span><\/code><span style=\"font-size: 15px;\">\u662f\u521b\u5efa\u7684\u9879\u76ee\u540d\u79f0\u3002\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e24\u4e2a\u5b8c\u5168\u76f8\u540c\u7684\u9879\u76ee\uff0c\u5728\u4e0d\u540c\u5730\u5740\u542f\u52a8\uff0c\u4f46\u662f\u4e3a\u4e86\u6f14\u793a\u6548\u679c\uff0c\u8fd9\u91cc\u521b\u5efa\u4e862\u4e2a\u3002<\/span><\/section>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"margin-right: auto; margin-left: auto; display: block; box-sizing: border-box !important; width: 100%; visibility: visible !important; height: auto;\" title=\"Django \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/04\/10-1619107639.png\" alt=\"Django \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\" \/><\/figure>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u521b\u5efa\u597d\u4e24\u4e2a\u9879\u76ee\u540e\uff0c\u6211\u4eec\u8981\u7ed9\u9879\u76ee\u5199\u4e00\u4e2a\u6a21\u62df\u7684\u767b\u5f55\uff0c\u6ce8\u9500\u7684\u529f\u80fd\u3002<\/span><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u5728<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">templates<\/span><\/code><span style=\"font-size: 15px;\">\u6587\u4ef6\u5939\u4e0b\u521b\u5efa\u6587\u4ef6<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">login.html<\/span><\/code><span style=\"font-size: 15px;\">\u6587\u4ef6\u3002\u8fd9\u91cc\u76f4\u63a5\u4f7f\u7528\u4e4b\u524d\u5199\u8fc7\u7684\u767b\u5f55\u9875\u9762\u7684\u4ee3\u7801\uff0c\u6837\u5f0f\u5c31\u4e0d\u52a0\u4e86\uff0c\u5728SSO1\u548cSSO2\u4e2d\u90fd\u52a0\u5165<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">login.html<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u5177\u4f53\u4ee3\u7801\u4e3a\uff1a<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\"><span style=\"color: #61aeee; line-height: 26px;\">&lt;!DOCTYPE\u00a0<span style=\"line-height: 26px;\">html<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">html<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">lang<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"en\"<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">head<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">meta<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">charset<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"UTF-8\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">title<\/span>&gt;<\/span>Title<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">title<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">head<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">body<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">class<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"login_content\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">class<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"page-header\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">id<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"page_header\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">h1<\/span>&gt;<\/span>\u767b\u5f55<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">small<\/span>&gt;<\/span>Login<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">small<\/span>&gt;&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">h1<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">id<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"login_form\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">form<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">method<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"post\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">class<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"form-group\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">label<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">for<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"exampleInputEmail1\"<\/span>&gt;<\/span>Email\u00a0address<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">label<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">input<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">type<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"input\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">class<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"form-control\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">name<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"usr\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">id<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"exampleInputEmail1\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">placeholder<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"username\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">class<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"form-group\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">label<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">for<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"exampleInputPassword1\"<\/span>&gt;<\/span>\u5bc6\u7801<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">label<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">input<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">type<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"password\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">class<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"form-control\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">name<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"password\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">id<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"exampleInputPassword1\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">placeholder<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"\u5bc6\u7801\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">id<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"login_butt\"<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">button<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">type<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"submit\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">class<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"btn\u00a0btn-default\"<\/span>&gt;<\/span>\u767b\u5f55<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">button<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">button<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">type<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"button\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">class<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"btn\u00a0btn-default\"<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">onclick<\/span>=<span style=\"color: #98c379; line-height: 26px;\">\"\"<\/span>&gt;<\/span>\u6ce8\u518c<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">button<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">form<\/span>&gt;<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">div<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">body<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">html<\/span>&gt;<\/span>\n<\/code><\/pre>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u7136\u540e\u5728<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">SSO1<\/span><\/code><span style=\"font-size: 15px;\">\u6587\u4ef6\u5939\u521b\u5efa\u4e00\u4e2a<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">view.py<\/span><\/code><span style=\"font-size: 15px;\">\u6587\u4ef6\uff0c\u7528\u6765\u5b58\u653e\u89c6\u56fe\u51fd\u6570\u3002\uff08\u8fd9\u91cc\u4ec5\u4e3a\u6f14\u793aSSO\uff0c\u5c31\u4e0d\u5206\u6a21\u5757\u4e86\u3002\uff09<\/span><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u521b\u5efa\u6587\u4ef6\u540e\u7684\u6587\u4ef6\u76ee\u5f55\u4e3a\uff1a\uff08SSO2\u9879\u76ee\u4e00\u6837\uff09<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\">.\n\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">SSO1<\/span>\n\u2502\u00a0\u00a0\u00a0\u251c\u2500\u2500\u00a0__<span style=\"color: #e06c75; line-height: 26px;\">init__<\/span><span style=\"color: #d19a66; line-height: 26px;\">.py<\/span>\n\u2502\u00a0\u00a0\u00a0\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">asgi<\/span><span style=\"color: #d19a66; line-height: 26px;\">.py<\/span>\n\u2502\u00a0\u00a0\u00a0\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">settings<\/span><span style=\"color: #d19a66; line-height: 26px;\">.py<\/span>\n\u2502\u00a0\u00a0\u00a0\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">urls<\/span><span style=\"color: #d19a66; line-height: 26px;\">.py<\/span>\n\u2502\u00a0\u00a0\u00a0\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">view<\/span><span style=\"color: #d19a66; line-height: 26px;\">.py<\/span>\n\u2502\u00a0\u00a0\u00a0\u2514\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">wsgi<\/span><span style=\"color: #d19a66; line-height: 26px;\">.py<\/span>\n\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">manage<\/span><span style=\"color: #d19a66; line-height: 26px;\">.py<\/span>\n\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">templates<\/span>\n\u2502\u00a0\u00a0\u00a0\u2514\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">login<\/span><span style=\"color: #d19a66; line-height: 26px;\">.html<\/span>\n\u2514\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">venv<\/span>\n\u00a0\u00a0\u00a0\u00a0\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">bin<\/span>\n\u00a0\u00a0\u00a0\u00a0\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">include<\/span>\n\u00a0\u00a0\u00a0\u00a0\u251c\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">lib<\/span>\n\u00a0\u00a0\u00a0\u00a0\u2514\u2500\u2500\u00a0<span style=\"color: #e06c75; line-height: 26px;\">pyvenv<\/span><span style=\"color: #d19a66; line-height: 26px;\">.cfg<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 1.5em; margin-right: 5px; margin-bottom: 2em; padding: 8px 15px; font-weight: bold; font-size: 1.3em; color: #ffffff; line-height: inherit; letter-spacing: 2px; background-image: linear-gradient(to right bottom, #00bcd4, #3f51b5); background-color: #3f51b5; border-left: 10px solid #333333; border-radius: 5px; text-shadow: #666666 1px 1px 1px; box-shadow: #666666 1px 1px 2px; font-family: 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif; text-align: start; white-space: normal;\"><span style=\"font-size: inherit; color: inherit; line-height: inherit;\">\u63d2\u5165\u4e00\u4e2a\u5c0fBUG<\/span><\/h3>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">macbook\u8fd0\u884c\u73af\u5883\uff0cpycharm\u521b\u5efa\u7684Django\u5e94\u7528\u6709\u65f6\u5019\u521d\u59cb\u5316\u6709\u4e2abug,\u7f3a\u5c11os\u5e93\uff0c\u4f1a\u62a5\u9519\uff1a<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\">Traceback\u00a0(most\u00a0recent\u00a0<span style=\"color: #c678dd; line-height: 26px;\">call<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">last<\/span>):\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO1\/manage.py\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">22<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0&lt;<span style=\"color: #c678dd; line-height: 26px;\">module<\/span>&gt;\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">main<\/span>()\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO1\/manage.py\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">18<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">main<\/span>\n\u00a0\u00a0\u00a0\u00a0execute_from_command_line(sys.argv)\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO1\/venv\/lib\/python3.7\/site-packages\/django\/core\/management\/__init__.py\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">401<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0execute_from_command_line\n\u00a0\u00a0\u00a0\u00a0utility.execute()\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO1\/venv\/lib\/python3.7\/site-packages\/django\/core\/management\/__init__.py\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">345<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">execute<\/span>\n\u00a0\u00a0\u00a0\u00a0settings.INSTALLED_APPS\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO1\/venv\/lib\/python3.7\/site-packages\/django\/conf\/__init__.py\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">82<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0__getattr__\n\u00a0\u00a0\u00a0\u00a0self._setup(<span style=\"color: #c678dd; line-height: 26px;\">name<\/span>)\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO1\/venv\/lib\/python3.7\/site-packages\/django\/conf\/__init__.py\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">69<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0_setup\n\u00a0\u00a0\u00a0\u00a0self._wrapped\u00a0=\u00a0<span style=\"color: #c678dd; line-height: 26px;\">Settings<\/span>(settings_module)\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO1\/venv\/lib\/python3.7\/site-packages\/django\/conf\/__init__.py\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">170<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0__init__\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">mod<\/span>\u00a0=\u00a0importlib.import_module(self.SETTINGS_MODULE)\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/python3.7\/importlib\/__init__.py\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">127<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0import_module\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0_bootstrap._gcd_import(<span style=\"color: #c678dd; line-height: 26px;\">name<\/span>[<span style=\"color: #c678dd; line-height: 26px;\">level<\/span>:],\u00a0<span style=\"color: #c678dd; line-height: 26px;\">package<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">level<\/span>)\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"&lt;frozen\u00a0importlib._bootstrap&gt;\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">1006<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0_gcd_import\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"&lt;frozen\u00a0importlib._bootstrap&gt;\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">983<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0_find_and_load\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"&lt;frozen\u00a0importlib._bootstrap&gt;\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">967<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0_find_and_load_unlocked\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"&lt;frozen\u00a0importlib._bootstrap&gt;\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">677<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0_load_unlocked\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"&lt;frozen\u00a0importlib._bootstrap_external&gt;\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">728<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0exec_module\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"&lt;frozen\u00a0importlib._bootstrap&gt;\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">219<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0_call_with_frames_removed\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">File<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO1\/SSO1\/settings.py\"<\/span>,\u00a0line\u00a0<span style=\"color: #d19a66; line-height: 26px;\">57<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0&lt;<span style=\"color: #c678dd; line-height: 26px;\">module<\/span>&gt;\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'DIRS'<\/span>:\u00a0[os.path.join(BASE_DIR,\u00a0<span style=\"color: #98c379; line-height: 26px;\">'templates'<\/span>)]\nNameError:\u00a0<span style=\"color: #c678dd; line-height: 26px;\">name<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">'os'<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">is<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">not<\/span>\u00a0defined\n<\/code><\/pre>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u6709\u8fd9\u4e2a\u62a5\u9519\u7684\u8bdd\uff0c\u5728<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">setting.py<\/span><\/code><span style=\"font-size: 15px;\">\u4e2d\u5bfc\u5165os\u5373\u53ef\uff1a<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">import os<\/span><\/code><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u7136\u540e\u6211\u4eec\u5728\u4e24\u4e2a\u9879\u76ee\u7684view.py\u4e2d\u5199\u5165\u767b\u5f55\u548c\u6ce8\u9500\u51fd\u6570\uff1a<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\"><span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0django.http\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0HttpResponse\n<span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0django.shortcuts\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0render,\u00a0redirect\n\n\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">login<\/span><span style=\"line-height: 26px;\">(request)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0request.method\u00a0==\u00a0<span style=\"color: #98c379; line-height: 26px;\">'GET'<\/span>:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">'usr'<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">in<\/span>\u00a0request.session:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u5982\u679csession\u4e2d\u5df2\u6709\u4fe1\u606f\uff0c\u5219\u663e\u793a<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0usr\u00a0=\u00a0request.session[<span style=\"color: #98c379; line-height: 26px;\">'usr'<\/span>]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0password\u00a0=\u00a0request.session[<span style=\"color: #98c379; line-height: 26px;\">'password'<\/span>]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0HttpResponse(<span style=\"color: #98c379; line-height: 26px;\">\"usr:{},password:{},sessionid:{},cookie:{}\"<\/span>.format(usr,password,request.session.session_key,request.COOKIES))\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0render(request,<span style=\"color: #98c379; line-height: 26px;\">'login.html'<\/span>)\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0request.method\u00a0==\u00a0<span style=\"color: #98c379; line-height: 26px;\">'POST'<\/span>:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0usr\u00a0=\u00a0request.POST[<span style=\"color: #98c379; line-height: 26px;\">'usr'<\/span>]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0password\u00a0=\u00a0request.POST[<span style=\"color: #98c379; line-height: 26px;\">'password'<\/span>]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0request.session[<span style=\"color: #98c379; line-height: 26px;\">'usr'<\/span>]\u00a0=\u00a0usr\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0request.session[<span style=\"color: #98c379; line-height: 26px;\">'password'<\/span>]\u00a0=\u00a0password\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0HttpResponse(\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"usr:{},password:{},sessionid:{},cookie:{}\"<\/span>.format(usr,\u00a0password,\u00a0request.session.session_key,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0request.COOKIES))\n\n\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">logout<\/span><span style=\"line-height: 26px;\">(request)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0request.session.clear()\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0redirect(<span style=\"color: #98c379; line-height: 26px;\">'\/login'<\/span>)\n\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\"><span style=\"font-size: 15px;\">\u5728<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">url.py<\/span><\/code><span style=\"font-size: 15px;\">\u4e2d\u6dfb\u52a0\u8def\u7531\u4fe1\u606f\uff1a<\/span><\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\"><span style=\"color: #98c379; line-height: 26px;\">\"\"\"SSO1\u00a0URL\u00a0Configuration\n\nThe\u00a0`urlpatterns`\u00a0list\u00a0routes\u00a0URLs\u00a0to\u00a0views.\u00a0For\u00a0more\u00a0information\u00a0please\u00a0see:\n\u00a0\u00a0\u00a0\u00a0https:\/\/docs.djangoproject.com\/en\/3.1\/topics\/http\/urls\/\nExamples:\nFunction\u00a0views\n\u00a0\u00a0\u00a0\u00a01.\u00a0Add\u00a0an\u00a0import:\u00a0\u00a0from\u00a0my_app\u00a0import\u00a0views\n\u00a0\u00a0\u00a0\u00a02.\u00a0Add\u00a0a\u00a0URL\u00a0to\u00a0urlpatterns:\u00a0\u00a0path('',\u00a0views.home,\u00a0name='home')\nClass-based\u00a0views\n\u00a0\u00a0\u00a0\u00a01.\u00a0Add\u00a0an\u00a0import:\u00a0\u00a0from\u00a0other_app.views\u00a0import\u00a0Home\n\u00a0\u00a0\u00a0\u00a02.\u00a0Add\u00a0a\u00a0URL\u00a0to\u00a0urlpatterns:\u00a0\u00a0path('',\u00a0Home.as_view(),\u00a0name='home')\nIncluding\u00a0another\u00a0URLconf\n\u00a0\u00a0\u00a0\u00a01.\u00a0Import\u00a0the\u00a0include()\u00a0function:\u00a0from\u00a0django.urls\u00a0import\u00a0include,\u00a0path\n\u00a0\u00a0\u00a0\u00a02.\u00a0Add\u00a0a\u00a0URL\u00a0to\u00a0urlpatterns:\u00a0\u00a0path('blog\/',\u00a0include('blog.urls'))\n\"\"\"<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0django.contrib\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0admin\n<span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0django.urls\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0path\n<span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0.\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0view\nurlpatterns\u00a0=\u00a0[\n\u00a0\u00a0\u00a0\u00a0path(<span style=\"color: #98c379; line-height: 26px;\">'admin\/'<\/span>,\u00a0admin.site.urls),\n\u00a0\u00a0\u00a0\u00a0path(<span style=\"color: #98c379; line-height: 26px;\">'login\/'<\/span>,view.login),\n\u00a0\u00a0\u00a0\u00a0path(<span style=\"color: #98c379; line-height: 26px;\">'logout\/'<\/span>,view.logout),\n]\n\n<\/code><\/pre>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em; margin-bottom: 5px;\"><span style=\"font-size: 15px;\">Django\u9ed8\u8ba4\u914d\u7f6e\u4e86csrf,\u9700\u8981\u5c06\u5b83\u6ce8\u91ca\u6389\uff0c\u5728<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">settings.py<\/span><\/code><span style=\"font-size: 15px;\">\u6587\u4ef6\u4e2d\u641ccsrf\uff0c\u7136\u540e\u6ce8\u91ca\u6389\u3002<\/span><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em; margin-bottom: 5px;\"><span style=\"font-size: 15px;\">\u4fee\u6539\u540e\u7684<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">settings.py<\/span><\/code><span style=\"font-size: 15px;\">\u6587\u4ef6\u4e3a\uff1a<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\"><span style=\"color: #98c379; line-height: 26px;\">\"\"\"\nDjango\u00a0settings\u00a0for\u00a0SSO1\u00a0project.\n\nGenerated\u00a0by\u00a0'django-admin\u00a0startproject'\u00a0using\u00a0Django\u00a03.1.7.\n\nFor\u00a0more\u00a0information\u00a0on\u00a0this\u00a0file,\u00a0see\nhttps:\/\/docs.djangoproject.com\/en\/3.1\/topics\/settings\/\n\nFor\u00a0the\u00a0full\u00a0list\u00a0of\u00a0settings\u00a0and\u00a0their\u00a0values,\u00a0see\nhttps:\/\/docs.djangoproject.com\/en\/3.1\/ref\/settings\/\n\"\"\"<\/span>\n\n<span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0pathlib\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0Path\n<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0os\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0Build\u00a0paths\u00a0inside\u00a0the\u00a0project\u00a0like\u00a0this:\u00a0BASE_DIR\u00a0\/\u00a0'subdir'.<\/span>\nBASE_DIR\u00a0=\u00a0Path(__file__).resolve().parent.parent\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0Quick-start\u00a0development\u00a0settings\u00a0-\u00a0unsuitable\u00a0for\u00a0production<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0See\u00a0https:\/\/docs.djangoproject.com\/en\/3.1\/howto\/deployment\/checklist\/<\/span>\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0SECURITY\u00a0WARNING:\u00a0keep\u00a0the\u00a0secret\u00a0key\u00a0used\u00a0in\u00a0production\u00a0secret!<\/span>\nSECRET_KEY\u00a0=\u00a0<span style=\"color: #98c379; line-height: 26px;\">'o=blc^vzeb1&amp;g*b!si(wtxe44_=i5cv(3jqm2*u2u&amp;7vgj%&amp;=%'<\/span>\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0SECURITY\u00a0WARNING:\u00a0don't\u00a0run\u00a0with\u00a0debug\u00a0turned\u00a0on\u00a0in\u00a0production!<\/span>\nDEBUG\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">True<\/span>\n\nALLOWED_HOSTS\u00a0=\u00a0[]\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0Application\u00a0definition<\/span>\n\nINSTALLED_APPS\u00a0=\u00a0[\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.admin'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.auth'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.contenttypes'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.sessions'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.messages'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.staticfiles'<\/span>,\n]\n\nMIDDLEWARE\u00a0=\u00a0[\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.middleware.security.SecurityMiddleware'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.sessions.middleware.SessionMiddleware'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.middleware.common.CommonMiddleware'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0'django.middleware.csrf.CsrfViewMiddleware',<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.auth.middleware.AuthenticationMiddleware'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.messages.middleware.MessageMiddleware'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.middleware.clickjacking.XFrameOptionsMiddleware'<\/span>,\n]\n\nROOT_URLCONF\u00a0=\u00a0<span style=\"color: #98c379; line-height: 26px;\">'SSO1.urls'<\/span>\n\nTEMPLATES\u00a0=\u00a0[\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'BACKEND'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.template.backends.django.DjangoTemplates'<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'DIRS'<\/span>:\u00a0[os.path.join(BASE_DIR,\u00a0<span style=\"color: #98c379; line-height: 26px;\">'templates'<\/span>)]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'APP_DIRS'<\/span>:\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">True<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'OPTIONS'<\/span>:\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'context_processors'<\/span>:\u00a0[\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.template.context_processors.debug'<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.template.context_processors.request'<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.auth.context_processors.auth'<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.messages.context_processors.messages'<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0],\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0},\n\u00a0\u00a0\u00a0\u00a0},\n]\n\nWSGI_APPLICATION\u00a0=\u00a0<span style=\"color: #98c379; line-height: 26px;\">'SSO1.wsgi.application'<\/span>\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0Database<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0https:\/\/docs.djangoproject.com\/en\/3.1\/ref\/settings\/#databases<\/span>\n\nDATABASES\u00a0=\u00a0{\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'default'<\/span>:\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'ENGINE'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.db.backends.sqlite3'<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'NAME'<\/span>:\u00a0BASE_DIR\u00a0\/\u00a0<span style=\"color: #98c379; line-height: 26px;\">'db.sqlite3'<\/span>,\n\u00a0\u00a0\u00a0\u00a0}\n}\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0Password\u00a0validation<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0https:\/\/docs.djangoproject.com\/en\/3.1\/ref\/settings\/#auth-password-validators<\/span>\n\nAUTH_PASSWORD_VALIDATORS\u00a0=\u00a0[\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'NAME'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'<\/span>,\n\u00a0\u00a0\u00a0\u00a0},\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'NAME'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.auth.password_validation.MinimumLengthValidator'<\/span>,\n\u00a0\u00a0\u00a0\u00a0},\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'NAME'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.auth.password_validation.CommonPasswordValidator'<\/span>,\n\u00a0\u00a0\u00a0\u00a0},\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">'NAME'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'django.contrib.auth.password_validation.NumericPasswordValidator'<\/span>,\n\u00a0\u00a0\u00a0\u00a0},\n]\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0Internationalization<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0https:\/\/docs.djangoproject.com\/en\/3.1\/topics\/i18n\/<\/span>\n\nLANGUAGE_CODE\u00a0=\u00a0<span style=\"color: #98c379; line-height: 26px;\">'en-us'<\/span>\n\nTIME_ZONE\u00a0=\u00a0<span style=\"color: #98c379; line-height: 26px;\">'UTC'<\/span>\n\nUSE_I18N\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">True<\/span>\n\nUSE_L10N\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">True<\/span>\n\nUSE_TZ\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">True<\/span>\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0Static\u00a0files\u00a0(CSS,\u00a0JavaScript,\u00a0Images)<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0https:\/\/docs.djangoproject.com\/en\/3.1\/howto\/static-files\/<\/span>\n\nSTATIC_URL\u00a0=\u00a0<span style=\"color: #98c379; line-height: 26px;\">'\/static\/'<\/span>\n\n<\/code><\/pre>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u7136\u540e\u5206\u522b\u4e3a\u4e24\u4e2a\u9879\u76ee\u505a\u6570\u636e\u5e93\u8fc1\u79fb\uff0c\u521b\u5efa\u4e00\u4e9bDjango\u9879\u76ee\u7684\u57fa\u7840\u5e93\uff1a<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">python3 manage.py migrate<\/span><\/code><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u4e24\u4e2a\u9879\u76ee\u90fd\u662f\u540c\u6837\u7684\u914d\u7f6e\uff0c\u8fd9\u6837\u6211\u4eec\u76ee\u524d\u4e24\u4e2a\u6d4b\u8bd5\u7684\u9879\u76ee\u5c31\u642d\u5efa\u597d\u4e86\uff0c\u7136\u540e\u6211\u4eec\u5206\u522b\u542f\u52a8\u4ed6\u4eec\u5728\u4e0d\u540c\u7684\u7aef\u53e3\u3002\u8fd9\u91cc\u6211\u4eec\u5c31\u76f4\u63a5\u624b\u52a8\u542f\u52a8\u4e86\uff0c\u5206\u522b\u542f\u52a8\u57285000\u548c6000\u7aef\u53e3\u3002<\/span><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">python3 manage.py runserver 127.0.0.1:5000<\/span><\/code><br \/>\n<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">python3 manage.py runserver 127.0.0.1:7000<\/span><\/code><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u542f\u52a8\u4e24\u4e2a\u9879\u76ee\uff1a<\/span><\/section>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"margin-right: auto; margin-left: auto; display: block; box-sizing: border-box !important; width: 677px !important; visibility: visible !important;\" title=\"Django \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/04\/10-1619107639-1.png\" alt=\"Django \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\" \/><\/figure>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"margin-right: auto; margin-left: auto; display: block; box-sizing: border-box !important; width: 677px !important; visibility: visible !important;\" title=\"Django \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/04\/5-1619107639.png\" alt=\"Django \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\" \/><\/figure>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u73b0\u5728\u6211\u4eec\u5206\u522b\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">http:\/\/127.0.0.1:5000\/login\/<\/span><\/code><span style=\"font-size: 15px;\">\u548c<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">http:\/\/127.0.0.1:7000\/login\/<\/span><\/code><span style=\"font-size: 15px;\">,\u663e\u793a\u7684\u9875\u9762\u90fd\u662f\u767b\u5f55\u9875\u9762\uff0c\u663e\u793a\u5982\u4e0b\uff1a<\/span><\/section>\n<section style=\"line-height: 2em;\">\n<figure style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"margin-right: auto; margin-left: auto; display: block; box-sizing: border-box !important; width: 630px !important; visibility: visible !important;\" title=\"Django \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/04\/2-1619107639.png\" alt=\"Django \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\" \/><\/figure>\n<\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u8fd9\u65f6\u6211\u4eec\u5728<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">http:\/\/127.0.0.1:5000\/login\/<\/span><\/code><span style=\"font-size: 15px;\">\u968f\u610f\u8f93\u5165\u8d26\u6237\u5bc6\u7801\u70b9\u51fb\u767b\u5f55\uff0c\u663e\u793a\uff1a<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\">usr:<span style=\"color: #d19a66; line-height: 26px;\">123<\/span>,password:<span style=\"color: #d19a66; line-height: 26px;\">123<\/span>,sessionid:<span style=\"color: #56b6c2; line-height: 26px;\">None<\/span>,cookie:{<span style=\"color: #98c379; line-height: 26px;\">'csrftoken'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'8YPzJbY03sHJUZH6kdFZzr9TkDtdVTKflgDDeIn0wgGC6cAeudcrkXLyIxXBEnzG'<\/span>}\n<\/code><\/pre>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u6b64\u65f6\u6211\u4eec\u8fdb\u5165<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">http:\/\/127.0.0.1:7000\/login\/<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u53d1\u73b0\u8fd9\u4e2a\u5e94\u7528\u4e2d\uff0c\u663e\u793a\u7684\u8fd8\u662f\u4e4b\u524d\u7684\u9875\u9762\uff0c\u767b\u5f55\u6ca1\u6709\u540c\u6b65\u3002\u4e0b\u9762\u6211\u4eec\u6765\u5b9e\u73b0\u6211\u4eec\u7684SSO\uff0c\u8fd9\u91cc\u7684\u5b9e\u73b0\u65b9\u6cd5\u975e\u5e38\u7684\u7b80\u5355\uff0c\u8fd9\u91cc\u63d0\u4f9b2\u4e2d\u5b9e\u73b0\u65b9\u6cd5\uff1a<\/span><\/section>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff;\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: black; line-height: 2em; text-align: left;\"><span style=\"font-size: 15px;\">\u5c06session\u56fa\u5b9a\u5b58\u50a8\u5728\u540c\u4e00\u4e2a\u6587\u4ef6\u4e2d\uff0c<\/span><\/section>\n<\/section>\n<\/li>\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: black; line-height: 2em; text-align: left;\"><span style=\"font-size: 15px;\">\u5c06session\u5b58\u50a8\u5728Redis\u4e2d<\/span><\/section>\n<\/section>\n<\/li>\n<\/ul>\n<h3 style=\"margin-top: 1.5em; margin-right: 5px; margin-bottom: 2em; padding: 8px 15px; font-weight: bold; font-size: 1.3em; color: #ffffff; line-height: inherit; letter-spacing: 2px; background-image: linear-gradient(to right bottom, #00bcd4, #3f51b5); background-color: #3f51b5; border-left: 10px solid #333333; border-radius: 5px; text-shadow: #666666 1px 1px 1px; box-shadow: #666666 1px 1px 2px; font-family: 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif; text-align: start; white-space: normal;\"><span style=\"font-size: inherit; color: inherit; line-height: inherit;\">\u5c06session\u5b58\u50a8\u5728\u540c\u4e00\u4e2a\u6587\u4ef6\u4e2d\u5b9e\u73b0SSO<\/span><\/h3>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u6211\u4eec\u5728SSO2\u6587\u4ef6\u4e0b\u521b\u5efa\u4e86\u4e00\u4e2asession\u6587\u4ef6\u5939\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5939\u4f4d\u7f6e\u4efb\u610f\uff0c\u5199\u7edd\u5bf9\u8def\u5f84\u5373\u53ef\u3002<\/span><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u7136\u540e\u6211\u4eec\u5728\u4e24\u4e2a\u9879\u76ee\u7684<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">settings.py<\/span><\/code><span style=\"font-size: 15px;\">\u4e2d\u5bf9cookie\u548csession\u8fdb\u884c\u914d\u7f6e<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\"><span style=\"font-size: 12px;\"># \u8bbe\u7f6ecookie\u7684domain\u4e3a\u7236\u57dfdomain\uff0c\n# \u5982\u679c\u662f\u4f7f\u7528\u57df\u540d\uff0c\u4ee5\u767e\u5ea6\u4e3a\u4f8b\uff0c\u4e3b\u57df\u540d\u4e3a`www.baidu.com`\uff0c\u65d7\u4e0b\u5404\u4e2a\u5e94\u7528\u4e3a\uff1a'asd.baidu.com'\n# \u5219\u8fd9\u91cc\u8bbe\u7f6e\u4e3a\uff1a`.baidu.com`\nSESSION_COOKIE_DOMAIN = '127.0.0.1'\n\n# \u8bbe\u7f6esession\u5b58\u50a8\u5728\u6587\u4ef6\u4e2d\nSESSION_ENGINE = 'django.contrib.sessions.backends.file'\n# \u8bbe\u7f6e\u5b58\u50a8\u4f4d\u7f6e\uff0c\u8fd9\u91cc\u8bbe\u4e3a\u7edd\u5bf9\u8def\u5f84\nSESSION_FILE_PATH = '\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO2\/session'<\/span>\n\n<\/code><\/pre>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u6ce8\u610f\u4e00\u4e0b\uff0c\u8fd9\u91cc\u914d\u7f6e\u7684\u90fd\u662f\u4e00\u6837\u7684\uff0c\u4f46\u662f\u5982\u679c\u4e24\u4e2a\u9879\u76ee\u540d\u79f0\u4e0d\u4e00\u6837\u7684\u8bdd\uff0c\u662f\u4e0d\u80fd\u76f4\u63a5\u5c06\u5b8c\u6574\u7684<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">settings.py<\/span><\/code><span style=\"font-size: 15px;\">\u76f4\u63a5\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u7684\uff0c\u56e0\u4e3a\u91cc\u9762\u6709\u4e00\u4e9b\u9879\u76ee\u7684\u914d\u7f6e\uff0c\u4f8b\u5982<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">ROOT_URLCONF = 'SSO1.urls'<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">WSGI_APPLICATION = 'SSO1.wsgi.application'<\/span><\/code><span style=\"font-size: 15px;\">\u8fd9\u4e9b\u524d\u9762\u7684\u90fd\u662f\u9879\u76ee\u540d\uff0c\u9700\u8981\u4e3b\u8981\u533a\u5206\u3002<br \/>\n\u6b64\u65f6\u6211\u4eec\u5728\u6253\u5f00<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">http:\/\/127.0.0.1:5000\/login\/<\/span><\/code><span style=\"font-size: 15px;\">,\u8f93\u5165\u8d26\u53f7\u5bc6\u7801\uff0c\u6b64\u9875\u9762\u663e\u793a\uff1a<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\">usr:<span style=\"color: #d19a66; line-height: 26px;\">123<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">password<\/span>:<span style=\"color: #d19a66; line-height: 26px;\">123<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">sessionid<\/span>:<span style=\"color: #d19a66; line-height: 26px;\">2<\/span>bs2nx2iq879epxu7au7o1zq63o095v7,<span style=\"color: #d19a66; line-height: 26px;\">cookie<\/span>:{<span style=\"color: #98c379; line-height: 26px;\">'sessionid'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'2bs2nx2iq879epxu7au7o1zq63o095v7'<\/span>,\u00a0<span style=\"color: #98c379; line-height: 26px;\">'csrftoken'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'8YPzJbY03sHJUZH6kdFZzr9TkDtdVTKflgDDeIn0wgGC6cAeudcrkXLyIxXBEnzG'<\/span>}\n<\/code><\/pre>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u6b64\u65f6\u6211\u4eec\u5728\u6253\u5f00<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">http:\/\/127.0.0.1:7000\/login\/<\/span><\/code><span style=\"font-size: 15px;\">,\u6211\u4eec\u76f4\u63a5\u8bbf\u95ee\uff0c\u800c\u4e0d\u7528\u767b\u5f55\uff0c\u53d1\u73b0\u663e\u793a\u540c\u6837\u7684\u5185\u5bb9\uff0c\u5373\u6211\u4eec\u4f7f\u7528\u7684\u662f\u540c\u6837\u7684\u5185\u5bb9\uff0c\u5b9e\u73b0\u4e86SSO\u3002<\/span><\/section>\n<h3 style=\"margin-top: 1.5em; margin-right: 5px; margin-bottom: 2em; padding: 8px 15px; font-weight: bold; font-size: 1.3em; color: #ffffff; line-height: inherit; letter-spacing: 2px; background-image: linear-gradient(to right bottom, #00bcd4, #3f51b5); background-color: #3f51b5; border-left: 10px solid #333333; border-radius: 5px; text-shadow: #666666 1px 1px 1px; box-shadow: #666666 1px 1px 2px; font-family: 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif; text-align: start; white-space: normal;\"><span style=\"font-size: inherit; color: inherit; line-height: inherit;\">\u4f7f\u7528Redis\u5b9e\u73b0SSO<\/span><\/h3>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u4f7f\u7528\u6587\u4ef6\u7cfb\u7edf\u4e0a\u5b9e\u73b0\u5171\u4eabsession\u5728\u5c0f\u5e76\u53d1\u7cfb\u7edf\u4e0a\u4e0d\u4f1a\u51fa\u73b0\u95ee\u9898\uff0c\u4f46\u662f\u5e76\u53d1\u91cf\u5927\u7684\u8bdd\uff0c\u4f1a\u51fa\u73b0\u4e00\u4e9b\u95ee\u9898\uff0c\u6240\u4ee5\u6211\u4eec\u8fd9\u91cc\u518d\u4ecb\u7ecd\u4e00\u4e0b\u4f7f\u7528Redis\u7684\u5b9e\u73b0\u3002<\/span><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u9700\u8981\u81ea\u884c\u5b89\u88c5Redis\uff0c\u5e76\u4e14\u5728\u4e24\u4e2a\u9879\u76ee\u4f7f\u7528\u7684Python\u4e2d\u5b89\u88c5Django-redis:<br \/>\n<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">pip3 install django-redis<\/span><\/code><\/section>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u5728\u505a\u597d\u8fd9\u4e9b\u4e4b\u540e\uff0c\u4fee\u6539settings.py\u6587\u4ef6\uff0c\u5c06\u4f7f\u7528\u6587\u4ef6\u5b58\u50a8session\u7684\u914d\u7f6e\u6ce8\u91ca\u6389\uff0c\u4fee\u6539\u4e3a\uff1a<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\">\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0#\u00a0\u8bbe\u7f6esession\u5b58\u50a8\u5728\u6587\u4ef6\u4e2d<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0SESSION_ENGINE\u00a0=\u00a0'django.contrib.sessions.backends.file'<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0#\u00a0\u8bbe\u7f6e\u5b58\u50a8\u4f4d\u7f6e\uff0c\u8fd9\u91cc\u8bbe\u4e3a\u7edd\u5bf9\u8def\u5f84<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0SESSION_FILE_PATH\u00a0=\u00a0'\/Users\/qiguan\/Documents\/develop_files\/python_files\/SSO2\/session'<\/span>\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u4f7f\u7528Redis\u5b58\u50a8session<\/span>\nCACHES\u00a0=\u00a0{\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"default\"<\/span>:\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"BACKEND\"<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"django_redis.cache.RedisCache\"<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"LOCATION\"<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"redis:\/\/127.0.0.1:6379\"<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"OPTIONS\"<\/span>:\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"CLIENT_CLASS\"<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"django_redis.client.DefaultClient\"<\/span>,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"CONNECTION_POOL_KWARGS\"<\/span>:\u00a0{<span style=\"color: #98c379; line-height: 26px;\">\"max_connections\"<\/span>:\u00a0100}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\"PASSWORD\":\u00a0\"123\",<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n}\n\nSESSION_ENGINE\u00a0=\u00a0'django.contrib.sessions.backends.cache'\nSESSION_CACHE_ALIAS\u00a0=\u00a0'default'\nSESSION_COOKIE_AGE\u00a0=\u00a060\u00a0*\u00a05\n\n<\/code><\/pre>\n<section style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 2em;\"><span style=\"font-size: 15px;\">\u6b64\u65f6\u6211\u4eec\u518d\u6765\u6d4b\u8bd5\u4e00\u4e0b\u4e24\u4e2a\u5e94\u7528\uff0c\u8fd9\u65f6\u6211\u4eec\u5148\u8bbf\u95ee\u4e00\u4e0blogout\uff0c\u5c06session\u6e05\u7a7a\uff0c\u7136\u540e\u8bbf\u95ee\uff1a<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">http:\/\/127.0.0.1:5000\/login\/<\/span><\/code><span style=\"font-size: 15px;\">,\u8f93\u5165\u8d26\u6237\u5bc6\u7801\u540e\u663e\u793a\uff1a<\/span><\/section>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px; text-align: left;\">usr:<span style=\"color: #d19a66; line-height: 26px;\">123<\/span>,password:<span style=\"color: #d19a66; line-height: 26px;\">123<\/span>,sessionid:<span style=\"color: #56b6c2; line-height: 26px;\">None<\/span>,cookie:{<span style=\"color: #98c379; line-height: 26px;\">'csrftoken'<\/span>:\u00a0<span style=\"color: #98c379; line-height: 26px;\">'8YPzJbY03sHJUZH6kdFZzr9TkDtdVTKflgDDeIn0wgGC6cAeudcrkXLyIxXBEnzG'<\/span>}\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\"><span style=\"font-size: 15px;\">\u6b64\u65f6\u6211\u4eec\u8bbf\u95ee<\/span><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; font-size: 14px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; border-radius: 4px; color: #e96900; background: #f8f8f8;\"><span style=\"font-size: 15px;\">http:\/\/127.0.0.1:7000\/login\/<\/span><\/code><span style=\"font-size: 15px;\">\uff08\u4e0d\u767b\u5f55\uff09\uff0c\u663e\u793a\u540c\u6837\u7684usr\u548cpassword\u4fe1\u606f\u3002<\/span><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\"><span style=\"font-size: 15px;\">\u6b64\u65f6\u6211\u4eec\u7684SSO\u4e5f\u53ef\u4ee5\u6b63\u5e38\u5b9e\u73b0\u3002<\/span><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Helvetica; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\"><span style=\"font-size: 15px;\">\u597d\u4e86\uff0c\u672c\u6587\u5c31\u5148\u5230\u8fd9\u91cc\uff0c\u5927\u5bb6\u5982\u6709\u9700\u8981\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u7684\u4e1a\u52a1\u8fdb\u884c\u5b9e\u73b0\uff0c\u8fd9\u91cc\u5c31\u4e0d\u8d58\u8ff0\u4e86\u3002\u7b49\u4ee5\u540e\u6709\u7a7a\u518d\u5199\u4e00\u4e9bDjango\u76f8\u5173\u7684\u5f00\u53d1\u535a\u5ba2\u3002<\/span><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u6765\u81ea\uff1aCSDN\uff0c\u4f5c\u8005\uff1a\u4e93\u5b98\u52bc \u94fe\u63a5\uff1ahttps:\/\/blog.csdn.net\/qiguanjiezl\/art &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=64185\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cDjango \u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08SSO\uff09\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[883,8],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/64185"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=64185"}],"version-history":[{"count":3,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/64185\/revisions"}],"predecessor-version":[{"id":64194,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/64185\/revisions\/64194"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=64185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=64185"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=64185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}