{"id":93322,"date":"2020-04-02T22:38:10","date_gmt":"2020-04-02T14:38:10","guid":{"rendered":"http:\/\/4563.org\/?p=93322"},"modified":"2020-04-02T22:38:10","modified_gmt":"2020-04-02T14:38:10","slug":"django-%e5%89%8d%e5%90%8e%e7%ab%af%e5%88%86%e7%a6%bb%ef%bc%8c%e7%99%bb%e5%bd%95%e9%aa%8c%e8%af%81%e6%80%9d%e8%b7%af","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=93322","title":{"rendered":"django \u524d\u540e\u7aef\u5206\u79bb\uff0c\u767b\u5f55\u9a8c\u8bc1\u601d\u8def"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  django \u524d\u540e\u7aef\u5206\u79bb\uff0c\u767b\u5f55\u9a8c\u8bc1\u601d\u8def               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : toohardtowork <\/span>  <span><i><\/i> 32<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>django \u524d\u540e\u7aef\u5206\u79bb\uff0c\u540e\u7aef\u53ea\u8fd4\u56de json\uff0c\u5e94\u8be5\u5982\u4f55\u505a\u767b\u5f55\u767b\u51fa\u548c\u72b6\u6001\u4fdd\u6301\uff0c\u5e76\u4e14\u62e6\u622a\u672a\u767b\u5f55\u7528\u6237\u4e0d\u80fd\u8bbf\u95ee\uff0c\u6c42\u601d\u8def\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>12<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1120055\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : JC1027 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             jwt \u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120056\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : workspace <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u767b\u9646\u63a5\u53e3\u903b\u8f91\u9a8c\u8bc1\u6210\u529f\u540e session \u8bbe\u7f6e is_login \u4e3a True<br \/>\u4e0b\u6b21\u8bf7\u6c42\u68c0\u67e5 session \u91cc\u7684 is_login \u5982\u679c\u4e3a False \u5373\u4e3a\u533f\u540d\uff08\u672a\u767b\u5f55\uff09\u7528\u6237                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120057\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Acoolda <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             JWT \u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120058\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qsbaq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             django \u4e0d\u662f\u81ea\u5e26\u767b\u9646\u5f97\u4e48\uff1f<br \/>@login_required<br \/>\u4e86\u89e3\u4e00\u4e0b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120059\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Hstar <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u95ee\u9898\u95ee\u7684\u4e5f\u592a\u57fa\u7840\u4e86\u5427\uff0c\u7279\u522b\u662f\u95ee\u9898\u4e8c\u201c\u5982\u4f55\u62e6\u622a\u672a\u767b\u5f55\u7528\u6237\u4e0d\u80fd\u8bbf\u95ee\u201d\u3002<br \/>\u9ebb\u70e6\u53bb\u628a dj \u5b98\u65b9\u6587\u6863\u7684 Authentication \u4e00\u7ae0\u8282\u5168\u770b\u5b8c\uff0c\u6bd4\u6211\u4eec\u5728\u8fd9\u56de\u5e16\u5168\u9762\u597d\u591a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120060\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : horkooo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             token \u9a8c\u8bc1\u548c token \u5237\u65b0\u3002\u524d\u7aef\u60f3\u7528\u6237\u4f53\u9a8c\u9ad8\u7684\u8bdd\u8ddf\u540e\u7aef\u7ea6\u5b9a\u597d token \u8fc7\u671f\u65f6\u95f4\uff0c\u524d\u7aef\u5b9a\u65f6\u5668\u68c0\u67e5\u5f53\u524d\u65f6\u95f4\u5dee\uff0c\u907f\u514d\u4e0d\u505c\u91cd\u590d\u8bf7\u6c42\u3002\u6216\u8005\u5168\u5c40 socket \u8fde\u63a5\u3002\u91cd\u8981\u7684\u662f\u4e0d\u8981\u8d70\u5bfb\u5e38\u8def\uff0c\u522b\u8ba9\u4e0b\u4e00\u4e2a\u63a5\u624b\u7684\u4eba\u770b\u61c2\u4f60\u7684\u4ee3\u7801\u548c\u601d\u8def                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120061\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : phx13ye <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @horkooo 233 \u8001\u63a5\u76d8\u4fa0\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120062\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ytmsdy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Django REST framework                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120063\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imzxk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             DRF \u3001JWT\uff0c\u4e00\u628a\u68ad                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120064\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wizardoz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u9700\u8981\u5565\u601d\u8def\uff1f django \u81ea\u5e26\u7684 session \u8ba4\u8bc1\u96be\u9053\u4e0d\u652f\u6301\u5417\uff1f<br \/>\u53e6\uff0c\u4e3b\u9700\u8981\u7684\u662f\u4fdd\u6301\u72b6\u6001\uff0cjwt \u4e0d\u592a\u7b26\u5408                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120065\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Latin <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @wizardoz jwt \u4e5f\u53ef\u4ee5\u4fdd\u6301\u72b6\u6001\u554a\uff0c\u81ea\u5df1\u7ef4\u62a4\u72b6\u6001\u5c31\u597d\u4e86 \uff0c\u4e0d\u5141\u8bb8\u91cd\u590d\u767b\u5f55\u5c31\u884c\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1120066\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xpresslink <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3b\u5b66\u4e60\u4e00\u4e0b web \u5f00\u53d1\u4e00\u4e9b\u57fa\u7840\u77e5\u8bc6\u5427\u3002django \u7684\u767b\u5f55\u5176\u5b9e\u5c31\u662f\u5728\u5ba2\u6237\u653e\u4e86\u4e00\u4e2a\u540d\u5b57\u4e3a sessionid \u7684 cookie \u5b58\u4e86\u4e00\u4e2a\u957f\u7684\u5b57\u7b26\u4e32\u3002\u6240\u4ee5\u4f60\u7814\u7a76\u4e00\u4e0b django.contrib.auth.login \/ backend.authenticate <br \/>\u76f4\u63a5\u628a request.session[SESSION_KEY] \u7684 SESSION_KEY \u5b57\u7b26\u4e32\u63a8\u9001\u7ed9\u524d\u7aef\uff0c\u5199\u5230 sessionid \u7684 cookie \u91cc\u9762\u5c31\u5b8c\u6210\u7684\u767b\u5f55\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>django \u524d\u540e\u7aef\u5206\u79bb\uff0c\u767b\u5f55\u9a8c\u8bc1&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/93322"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=93322"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/93322\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93322"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}