{"id":472120,"date":"2021-05-03T18:06:27","date_gmt":"2021-05-03T10:06:27","guid":{"rendered":"http:\/\/4563.org\/?p=472120"},"modified":"2021-05-03T18:06:27","modified_gmt":"2021-05-03T10:06:27","slug":"python-web-%e7%bb%88%e6%9e%81-crud-%e6%96%b9%e6%a1%88%e6%88%96%e8%ae%b8%e6%98%af-alpha-%e7%89%88%e6%9c%ac%ef%bc%8c%e5%be%81%e6%b1%82%e4%b8%80%e4%ba%9b%e5%8f%8d%e9%a6%88","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=472120","title":{"rendered":"Python web \u7ec8\u6781 CRUD \u65b9\u6848(\u6216\u8bb8\u662f) alpha \u7248\u672c\uff0c\u5f81\u6c42\u4e00\u4e9b\u53cd\u9988"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Python web \u7ec8\u6781 CRUD \u65b9\u6848(\u6216\u8bb8\u662f) alpha \u7248\u672c\uff0c\u5f81\u6c42\u4e00\u4e9b\u53cd\u9988               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fy <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h4>\u9879\u76ee\u5730\u5740<\/h4>\n<p>https:\/\/github.com\/fy0\/pycrud\/tree\/dev<\/p>\n<h4>\u8bf4\u660e<\/h4>\n<p>\u7b80\u5355\u6765\u8bf4\u8fd9\u662f\u4e00\u4e2a\u9ad8\u5c42 ORM\uff0c\u4e3b\u8981\u6269\u5c55\u4e86\u4e24\u4e2a\u70b9\uff0c\u4e00\u4e2a\u662f<strong>\u652f\u6301\u7528 JSON \u505a\u67e5\u8be2<\/strong>\uff0c\u8fd8\u6709\u5c31\u662f<strong>\u652f\u6301\u89d2\u8272\u6743\u9650<\/strong>\u3002<\/p>\n<p>\u5b9a\u4f4d\u548c GraphQL \u76f8\u540c\uff0c\u6211\u89c9\u5f97 GraphQL \u601d\u8def\u5f88\u597d\uff0c\u4f46\u662f\u592a\u96be\u7528\u4e86\u3002<\/p>\n<h4>\u5b89\u88c5<\/h4>\n<pre><code>pip install pycrud==1.0.0a0 <\/code><\/pre>\n<h4>\u7279\u8272<\/h4>\n<ul>\n<li>\n<p>\u9700\u8981\u5199\u7684\u4ee3\u7801\u91cf\u5f88\u5c11\uff0c\u652f\u6301\u4e3b\u6d41 ORM\uff0c\u5f88\u5bb9\u6613\u96c6\u6210\u5230\u4efb\u610f web \u6846\u67b6(examples \u4e2d\u6709\u4e00\u4e2a 125 \u884c\u5355\u6587\u4ef6\u7684 demo\uff0cFastapi + SQLAlchemy \u5e26\u6743\u9650\u7ba1\u7406)<\/p>\n<\/li>\n<li>\n<p>\u80fd\u4ece\u524d\u7aef\u6784\u9020\u4e00\u4e9b\u67e5\u8be2\u9009\u62e9\u6570\u636e\uff0c\u4f8b\u5982 <code>\/api\/user\/list?id.ge=10&amp;id.lt=15<\/code>\uff0c\u9002\u7528\u4e8e CRUD \u4e2d\u7684 RUD \u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p>\u6709\u4e00\u5957\u57fa\u4e8e\u89d2\u8272\u7684\u9274\u6743\uff0c\u7c92\u5ea6\u662f\u6570\u636e\u5e93\u5b57\u6bb5\uff0c\u53ef\u4ee5\u9650\u5236\u89d2\u8272\u80fd\u67e5 \/\u8bfb \/\u5199 \/\u63d2\u5165\u7684\u5b57\u6bb5\uff0c\u4ee5\u53ca\u80fd\u5220\u9664\u7684\u8868<\/p>\n<\/li>\n<\/ul>\n<p>demo \u8fd0\u884c\u8d77\u6765\u4e4b\u540e\u53ef\u4ee5\u7528 http:\/\/127.0.0.1:3000\/redoc \u770b API \u6587\u6863\u3002<\/p>\n<h4>\u5176\u4ed6<\/h4>\n<p>\u6807\u9898\u592a\u5938\u5f20\u4e86\u800c\u4e14\u8fdd\u53cd\u4e86\u5e7f\u544a\u6cd5\uff0c\u4e3b\u8981\u76ee\u7684\u8fd8\u662f\u5e0c\u671b\u5927\u5bb6\u8bd5\u4e00\u8bd5\uff0c\u7ed9\u4e00\u4e9b\u610f\u89c1\u3002<\/p>\n<p>\u611f\u89c9 python web \u7528\u7684\u4eba\u8d8a\u6765\u8d8a\u5c11\u4e86<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>11<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5844718\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : LeeReamond <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u4ec0\u4e48\u5efa\u8bae\uff0c\u4e2a\u4eba\u5fae\u4e0d\u8db3\u9053\u7684\u610f\u89c1\u662f\u8fd9\u4e2a\u9879\u76ee\u51fa\u53d1\u70b9\u4e0d\u5408\u9002\u3002\u56e0\u4e3a\u4e1a\u52a1\u9700\u6c42\u662f\u590d\u6742\u7684\uff0c\u6240\u4ee5\u5de5\u7a0b\u54f2\u5b66\u6c38\u8fdc\u662f\u89e3\u8026\uff0c\u4f60\u8fd9\u4e2a\u9879\u76ee\u53c8\u5f3a\u884c\u8026\u5408\u56de\u53bb\u4e86\u3002\u5f00\u7bb1\u5373\u7528\u7684\u5e26\u6743\u9650 curd \u4e4d\u4e00\u542c\u8ba9\u4eba\u5f88\u5174\u594b\uff0c\u7ed3\u679c\u770b\u4e86\u4e00\u4e0b\u4f60\u7684\u9879\u76ee\u4ee3\u7801\uff0c\u95ee\u4e86\u4e00\u4e0b\u81ea\u5df1\uff0c\u80fd\u7528\u5417\uff1f\u7b54\u6848\u662f\u4e0d\u7b26\u5408\u9700\u6c42\uff0c\u6240\u4ee5\u56de\u5230\u4e86\u4e0a\u8ff0\u7684\u8026\u5408\u95ee\u9898\u3002\u53e6\u5916 pyweb \u7528\u6237\u8d8a\u6765\u8d8a\u5c11\u662f\u4f2a\u547d\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844719\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wellsc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u662f\u611f\u89c9\uff0c\u662f\u4e8b\u5b9e                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844720\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : popil1987 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e00\u822c\u6839\u636e\u81ea\u5df1\u9700\u6c42\u81ea\u5df1\u5199 crud\uff0ccud \u6bd4\u8f83\u56fa\u5b9a\uff0cr \u9884\u7559\u4e00\u4e2a\u4f20 stmt\uff0c\u81ea\u5df1\u7528 sqlalchemy \u7ec4\u4e00\u4e2a stmt \u5f53\u4f5c\u53c2\u6570\u5c31\u597d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844721\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : WildCat <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u505a\u4e00\u4e2a\u7c7b\u4f3c ActiveRecord \u7684\u65b9\u6848\u90fd\u8db3\u591f\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844722\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : fy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @LeeReamond \u4e2a\u4eba\u5fae\u4e0d\u8db3\u9053\u7684\u610f\u89c1\u662f\u8fd9\u4e2a\u56de\u590d\u51fa\u53d1\u70b9\u4e0d\u5408\u9002\u3002\u56e0\u4e3a\u6587\u7ae0\u4e3b\u9898\u662f\u590d\u6742\u7684\uff0c\u6240\u4ee5\u56de\u590d\u54f2\u5b66\u6c38\u8fdc\u662f\u5177\u4f53\uff0c\u4f60\u8fd9\u4e2a\u8bc4\u8bba\u53c8\u5f3a\u884c\u62bd\u8c61\u56de\u53bb\u4e86\u3002\u63b7\u5730\u6709\u58f0\u7684\u5927\u6bb5\u6587\u672c\u4e4d\u4e00\u542c\u8ba9\u4eba\u5f88\u5174\u594b\uff0c\u7ed3\u679c\u770b\u4e86\u4e00\u4e0b\u4f60\u7684\u56de\u590d\u5185\u5bb9\uff0c\u95ee\u4e86\u4e00\u4e0b\u81ea\u5df1\uff0c\u8bf4\u7684\u662f\u4ec0\u4e48\uff1f\u7b54\u6848\u662f\u6ca1\u6709\u5177\u4f53\u5185\u5bb9\uff0c\u6240\u4ee5\u56de\u5230\u4e86\u4e0a\u8ff0\u7684\u201c\u5177\u4f53\u201d\u95ee\u9898\u3002<\/p>\n<p>&#8212;<\/p>\n<p>\u6ca1\u610f\u4e49\u7684\u8bdd\u6211\u5c31\u5f53\u6ca1\u770b\u5230\u3002\u60f3\u542c\u542c\u4f60\u5bf9 graphql \u6709\u4ec0\u4e48\u9ad8\u89c1\uff1f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844723\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : fy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @popil1987 <\/p>\n<p>\u56e0\u4e3a\u89c9\u5f97\u591a\u6570\u64cd\u4f5c\u91cd\u590d\uff0c\u6240\u4ee5\u8fdb\u884c\u4e86\u5c01\u88c5\u3002\u76f4\u63a5\u6345\u5230 API \u90a3\u4e00\u5c42\u3002<\/p>\n<p>@WildCat <\/p>\n<p>\u6211\u5728\u8fd9\u5757\u9009\u7684\u65b9\u6848\u66f4\u63a5\u8fd1\u4e8e Data Mapper \u3002\u4e0d\u8fc7\u4e3b\u8981\u82b1\u8d39\u7cbe\u529b\u8fd8\u662f\u5728 json \u8f6c\u67e5\u8be2\u548c\u62e6\u622a\u5668\u4e0a\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844724\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : youngce <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u79cd\u7ea7\u522b\u7684 CRUD\uff0cdrf \u611f\u89c9\u66f4\u52a0\u7b80\u5355                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844725\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : carlclone <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u79cd\u53eb\u8fc7\u5ea6\u5c01\u88c5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844726\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : fy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @youngce <\/p>\n<p>DRF \u4e0d\u80fd\u5904\u7406\u6761\u4ef6\u67e5\u8be2\u3001order \u7b49\u5185\u5bb9<\/p>\n<p>\u53ef\u80fd\u6211\u6587\u6863\u6ca1\u6709\u8bf4\u6e05\u695a\uff0c\u8fd9\u4e2a\u5e93\u7684 CRUD \u53ef\u4ee5\u63d0\u4f9b\u4e00\u4e9b\u67e5\u8be2\u6761\u4ef6\uff0c\u7c7b\u4f3c graphql\uff0c\u4f46\u662f\u6613\u7528\u6027\u4e0a\u8981\u597d\u5f97\u591a\u3002<\/p>\n<p>\u6bd4\u5982\u8bf4\uff1a<br \/>&#8220;`<br \/># \u67e5\u8be2 2020 \u5e74 1 \u6708 1 \u65e5\u4e4b\u540e\u7684\u6587\u7ae0\uff1a<br \/>http http:\/\/localhost:9999\/api\/topic\/list?time.ge=1577808000<\/p>\n<p># \u521b\u5efa\u65b0\u6587\u7ae0<br \/>http -f POST &#8220;http:\/\/localhost:9999\/api\/topic\/create&#8221; title=&#8221;Hello Again&#8221; content=&#8221;Content changed&#8221; time=1578729600<\/p>\n<p># \u4fee\u6539 id \u4e3a 1 \u7684\u6587\u7ae0<br \/>http -f POST &#8220;http:\/\/localhost:9999\/api\/topic\/update?id=1&#8243; title=&#8221;Hello Again&#8221; content=&#8221;Content changed&#8221;<br \/>&#8220;`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844727\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : youngce <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @fy #9 \u201cDRF \u4e0d\u80fd\u5904\u7406\u6761\u4ef6\u67e5\u8be2\u3001order \u7b49\u5185\u5bb9\u201d \u90a3\u8bf4\u660e\u4f60 drf \u8fd8\u6ca1\u6709\u4e86\u89e3\u6e05\u695a\uff0c\u4f60\u8fd9\u79cd\u5e93\u7684\u6700\u5927\u7ade\u54c1\u5c31\u662f DRF \u4e86\u5427\uff0c\u5efa\u8bae\u81f3\u5c11\u770b\u770b drf \u652f\u6301\u7684\u529f\u80fd\u3002<\/p>\n<p>https:\/\/www.django-rest-framework.org\/api-guide\/filtering\/<\/p>\n<p>drf \u81ea\u5e26\u4e86\u6392\u5e8f\u3001\u641c\u7d22\u3001\u8fc7\u6ee4<\/p>\n<p>\u8fd9\u79cd\u57fa\u7840\u7684\u589e\u5220\u6539\u67e5\uff0cdrf \u4e5f\u652f\u6301\u5b8c\u5168 resful \u7684\u81ea\u5e26\u529f\u80fd<\/p>\n<p>\u53e6\u5916 drf \u6269\u5c55\u8d77\u6765\u4e5f\u975e\u5e38\u65b9\u4fbf                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5844728\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : fy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @youngce <\/p>\n<p>\u539f\u6765\u8fd8\u6709\u8fd9\u79cd\u64cd\u4f5c\uff0c\u90a3\u8fd9\u6837\u8bf4\u7684\u8bdd\u8fd9\u4e2a\u65b9\u5411\u662f\u6ca1\u95ee\u9898\u7684\u3002<\/p>\n<p>\u6211\u4e0d\u592a\u4e86\u89e3 Django\uff0c\u521a\u770b\u8fd9\u6587\u6863\u7684\u8bdd\uff0c\u4ed6\u662f\u4e0d\u662f\u4e0d\u652f\u6301\u5404\u79cd\u7b97\u7b26\u554a\uff1f\u597d\u50cf\u8fd9\u7bc7\u6587\u6863\u53ea\u6709\u8fd9\u4e9b\uff1a<\/p>\n<p>&#8216;^&#8217; Starts-with search.<br \/>&#8216;=&#8217; Exact matches.<br \/>&#8216;@&#8217; Full-text search. (Currently only supported Django&#8217;s PostgreSQL backend.)<br \/>&#8216;$&#8217; Regex search.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Python web \u7ec8\u6781 CRU&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\/472120"}],"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=472120"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/472120\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=472120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=472120"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=472120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}