{"id":94330,"date":"2020-05-01T18:47:52","date_gmt":"2020-05-01T10:47:52","guid":{"rendered":"http:\/\/4563.org\/?p=94330"},"modified":"2020-05-20T07:08:37","modified_gmt":"2020-05-19T23:08:37","slug":"%e4%b8%80%e6%9d%af%e8%8c%b6%e7%9a%84%e6%97%b6%e9%97%b4%ef%bc%8c%e4%b8%8a%e6%89%8b-django-%e6%a1%86%e6%9e%b6%e5%bc%80%e5%8f%91","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=94330","title":{"rendered":"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : huan1043269994 <\/span>  <span><i><\/i> 17<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<blockquote>\n<p>\u6211\u4eec\u7814\u53d1\u5f00\u6e90\u4e86\u4e00\u6b3e\u57fa\u4e8e Git \u8fdb\u884c\u6280\u672f\u5b9e\u6218\u6559\u7a0b\u5199\u4f5c\u7684\u5de5\u5177\uff0c\u6211\u4eec\u56fe\u96c0\u793e\u533a\u7684\u6240\u6709\u6559\u7a0b\u90fd\u662f\u7528\u8fd9\u6b3e\u5de5\u5177\u5199\u4f5c\u800c\u6210\uff0c\u6b22\u8fce Star \u54e6<\/p>\n<\/blockquote>\n<blockquote>\n<p>\u5982\u679c\u4f60\u60f3\u5feb\u901f\u4e86\u89e3\u5982\u4f55\u4f7f\u7528\uff0c\u6b22\u8fce\u9605\u8bfb\u6211\u4eec\u7684 \u6559\u7a0b\u6587\u6863\u54e6<\/p>\n<\/blockquote>\n<p>Django \u662f Python \u793e\u533a\u7684\u4e24\u5927\u6700\u53d7\u6b22\u8fce\u7684 Web \u6846\u67b6\u4e4b\u4e00\uff08\u53e6\u4e00\u4e2a\u662f Flask \uff09\u3002\u51ed\u501f\u529f\u80fd\u5f3a\u5927\u7684\u811a\u624b\u67b6\u548c\u8bf8\u591a\u5f00\u7bb1\u5373\u7528\u7684\u7ec4\u4ef6\uff0c\u7528 Django \u642d\u5efa Web \u5e94\u7528\u5feb\u901f\u800c\u53c8\u7701\u529b\u3002\u7136\u800c\uff0c\u4e5f\u6b63\u662f\u56e0\u4e3a\u8fc7\u4e8e\u5f3a\u5927\uff0c\u60f3\u8981\u9a7e\u9a6d\u5b83\u9700\u8981\u82b1\u8d39\u4e0d\u5c11\u7684\u529b\u6c14\u3002\u672c\u6587\u5c06\u901a\u8fc7\u5b9e\u73b0\u4e00\u4e2a\u65b0\u95fb\u53d1\u5e03\u7f51\u7ad9\u5e26\u4f60\u5feb\u901f\u719f\u6089 Django \u6846\u67b6\uff0c\u8ba9\u4f60\u80fd\u591f\u9a91\u4e0a\u8fd9\u5339\u5feb\u9a6c\uff0c\u5728 Web \u5f00\u53d1\u7684\u6218\u573a\u4e0a\u5c3d\u60c5\u9a70\u9a8b\u3002<\/p>\n<blockquote>\n<p><strong>\u63d0\u793a<\/strong><\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u5199\u4f5c\u65f6\u7528\u7684\u662f Django 2.x \u7248\u672c\uff0c\u53d1\u8868\u65f6\u5df2\u7ecf\u63a8\u51fa\u4e86 3.x \u7248\u672c\u3002\u7ecf\u8fc7\u7b14\u8005\u6d4b\u8bd5\uff0c\u5728 Python 3.7 \u7684\u73af\u5883\u4e0b\u8fd0\u884c Django 3.x \u4f1a\u51fa\u73b0 admin \u65e0\u6cd5\u767b\u5f55\u7684\u60c5\u5f62\uff0c\u53ef\u4ee5\u9009\u62e9\u964d\u5230 Python 3.6 \u53ca\u4ee5\u4e0b\u7684\u7248\u672c\uff0c\u6216\u5b89\u88c5 Django 2.x \u3002<\/p>\n<\/blockquote>\n<h2>\u8d77\u6b65<\/h2>\n<p>Django \u7531 Adrian Holovaty \u548c Simon Willison \u5728 2003 \u5e74\u7684\u79cb\u5929\u5199\u6210\uff0c\u5e76\u5728 2005 \u5e74\u6b63\u5f0f\u53d1\u5e03\u3002\u4ed6\u4eec\u4fe9\u5f53\u65f6\u4e3a\u4e00\u4e2a\u65b0\u95fb\u62a5\u793e\u5236\u4f5c\u7f51\u7ad9\uff0c\u5bf9<strong>\u5feb\u901f\u5f00\u53d1<\/strong>\u6709\u7740\u6bd4\u8f83\u9ad8\u7684\u9700\u6c42\uff0c\u5e76\u4e14\u5e0c\u671b\u80fd\u591f\u5728\u5f00\u53d1\u7684\u540c\u65f6\u4e5f\u80fd\u591f<strong>\u8ba9\u975e\u6280\u672f\u4eba\u5458\u4e3a\u7f51\u7ad9\u6dfb\u52a0\u5185\u5bb9<\/strong>\u3002\u4e8e\u662f\u8fd9\u4e5f\u4f7f\u5f97 Django \u5177\u5907\u4e86\u4e24\u9879\u9c9c\u660e\u7684\u7279\u70b9\uff1a<\/p>\n<ul>\n<li>\u9ad8\u5ea6\u5f3a\u8c03<strong>\u53ef\u590d\u7528\u6027<\/strong>\u548c<strong>\u53ef\u63d2\u62d4\u6027<\/strong>\uff0c\u5185\u7f6e\u5927\u91cf\u73b0\u6210\u7684\u6210\u719f\u7ec4\u4ef6\uff0c\u5f00\u53d1\u6548\u7387\u6781\u9ad8<\/li>\n<li>\u81ea\u5e26\u4e0e\u6570\u636e\u5e93\u8054\u52a8\u7684<strong>\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf<\/strong>\uff0c\u80fd\u591f\u5728\u5f00\u53d1\u7684\u540c\u65f6\u521b\u5efa\u5185\u5bb9<\/li>\n<\/ul>\n<blockquote>\n<p>Django \u7684\u540d\u5b57\u53d6\u81ea\u5409\u4ed6\u624b Django Reinhardt\uff0c\u53d1\u97f3\u4e3a JANG-goh \uff08\u8c10\u97f3\u201c\u5c16\u72d7\u201d\uff09\uff0c\u4f46\u5b9e\u9645\u4e0a Django \u7684\u5409\u7965\u7269\u662f\u4e00\u53ea\u957f\u7740\u7fc5\u8180\u7684\u5c0f\u9a6c\u3002<\/p>\n<\/blockquote>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/wKndchpB8c.jpeglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u5728\u8fd9\u7bc7\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u4e5f\u5c06\u5411 Django \u7684\u8d77\u6e90\u81f4\u656c\u2014\u2014\u624b\u628a\u624b\u5e26\u4f60\u5f00\u53d1\u4e00\u4e2a\u65b0\u95fb\u53d1\u5e03\u7f51\u7ad9\uff0c\u5e76\u4e14\u53ef\u4ee5\u4ece\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\u4e2d\u6dfb\u52a0\u65b0\u95fb\uff0c\u5c55\u793a\u5230\u7f51\u7ad9\u9996\u9875\u4e0a\u3002<\/p>\n<h3>\u9884\u5907\u77e5\u8bc6<\/h3>\n<p>\u672c\u6559\u7a0b\u5047\u5b9a\u4f60\u5df2\u7ecf\u77e5\u9053\u4e86\uff1a<\/p>\n<ul>\n<li>\u57fa\u672c\u7684 Python 3 \u8bed\u8a00\u77e5\u8bc6\uff0c\u5305\u62ec\u4f7f\u7528 pip \u5b89\u88c5\u5305<\/li>\n<li>\u4e86\u89e3 HTTP \u534f\u8bae\u57fa\u7840\u77e5\u8bc6\uff0c\u6d4f\u89c8\u5668\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u662f\u5982\u4f55\u4e92\u52a8\u7684<\/li>\n<\/ul>\n<h3>\u5b66\u4e60\u76ee\u6807<\/h3>\n<p>\u8bfb\u5b8c\u8fd9\u7bc7\u6559\u7a0b\u540e\uff0c\u4f60\u5c06\u638c\u63e1 Django MTV \u6846\u67b6\u7684\u7cbe\u9ad3\uff1a<\/p>\n<ul>\n<li>M \uff08 Model \uff09\uff1a\u521b\u5efa\u6570\u636e\u6a21\u578b\uff0c\u5e76\u6267\u884c\u6570\u636e\u5e93\u8fc1\u79fb<\/li>\n<li>T \uff08 Template \uff09\uff1a\u5199\u51fa\u57fa\u672c\u7684 Django \u6a21\u677f\uff0c\u5e76\u4ece\u89c6\u56fe\u4e2d\u4f20\u5165\u6570\u636e<\/li>\n<li>V \uff08 View \uff09\uff1a\u5728\u89c6\u56fe\u4e2d\u8bbf\u95ee\u6570\u636e\u5e93\uff0c\u5b9e\u73b0\u4e1a\u52a1\u903b\u8f91\uff0c\u6e32\u67d3\u6a21\u677f\uff0c\u5e76\u63a5\u5165\u8def\u7531\u8868<\/li>\n<\/ul>\n<p>\u867d\u7136 Django \u8fd8\u6709\u5f88\u591a\u77e5\u8bc6\u70b9\uff0c\u4f46\u662f\u7406\u89e3\u4e86 MTV\uff0c\u540e\u9762\u7684\u77e5\u8bc6\u70b9\u5b66\u4e60\u8d77\u6765\u4e5f\u5c31\u8f7b\u677e\u591a\u5566\u3002<\/p>\n<h3>\u5b89\u88c5 Django \u5e76\u542f\u7528\u811a\u624b\u67b6<\/h3>\n<p>\u672c\u6587\u5047\u5b9a\u4f60\u5df2\u7ecf\u5b89\u88c5\u597d\u4e86 Python 3 \u548c pip\uff0c\u90a3\u4e48\u53ef\u4ee5\u76f4\u63a5\u7528 pip \u5b89\u88c5 Django\uff1a<\/p>\n<pre><code>pip install django # \u5982\u679c\u4f60\u7528\u7684\u662f Python 3.7\uff0c\u8bf7\u5b89\u88c5 Django 2.2\uff1a # pip install django==2.2 <\/code><\/pre>\n<blockquote>\n<p>\u76f4\u63a5\u7528 pip \u5728\u5168\u5c40\u5b89\u88c5 Django \u7684\u786e\u4e0d\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u505a\u6cd5\uff0c\u7528\u865a\u62df\u73af\u5883\u66f4\u7b26\u5408\u6700\u4f73\u5b9e\u8df5\u3002\u4e3a\u4e86\u51cf\u5c11\u521d\u5b66\u8005\u4eec\u7684\u8ba4\u77e5\u8d1f\u62c5\uff0c\u5728\u8fd9\u91cc\u5c31\u7b80\u5316\u4e86\u5b89\u88c5\u8fc7\u7a0b\u3002\u719f\u6089 pipenv \u7b49\u865a\u62df\u73af\u5883\u5de5\u5177\u7684\u8001\u53f8\u673a\u5f53\u7136\u53ef\u4ee5\u81ea\u884c\u4f7f\u7528\u54c8\u3002<\/p>\n<\/blockquote>\n<p>\u5b89\u88c5\u597d Django \u540e\uff0c\u6211\u4eec\u7528 Django \u81ea\u5e26\u7684\u811a\u624b\u67b6\u5de5\u5177 django-admin \u521b\u5efa\u9879\u76ee\uff1a<\/p>\n<pre><code>django-admin startproject django_news cd django_news <\/code><\/pre>\n<p>\u751f\u6210\u7684\u9879\u76ee\u9aa8\u67b6\u53ca\u6bcf\u4e2a\u6587\u4ef6\u7684\u4f5c\u7528\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre><code>django_news \u251c\u2500\u2500 django_news              \/\/ \u9879\u76ee\u5168\u5c40\u6587\u4ef6\u76ee\u5f55 \u2502   \u251c\u2500\u2500 __init__.py \u2502   \u251c\u2500\u2500 settings.py          \/\/ \u5168\u5c40\u914d\u7f6e \u2502   \u251c\u2500\u2500 urls.py              \/\/ \u5168\u5c40\u8def\u7531 \u2502   \u2514\u2500\u2500 wsgi.py              \/\/ WSGI \u670d\u52a1\u63a5\u53e3\uff08\u6682\u65f6\u4e0d\u7528\u7ea0\u7ed3\u8fd9\u4e2a\u662f\u795e\u9a6c\uff09 \u2514\u2500\u2500 manage.py                \/\/ \u9879\u76ee\u7ba1\u7406\u811a\u672c <\/code><\/pre>\n<p>\u6211\u4eec\u4f7f\u7528 manage.py \u6765\u8fd0\u884c\u5f00\u53d1\u670d\u52a1\u5668\uff08 Development Server \uff09\uff1a<\/p>\n<pre><code>python manage.py runserver <\/code><\/pre>\n<blockquote>\n<p><strong>\u63d0\u793a<\/strong><\/p>\n<p>\u7ec6\u5fc3\u7684\u4f60\u4f1a\u53d1\u73b0\u51fa\u73b0\u4e86\u4e00\u884c\u9c9c\u7ea2\u8272\u7684\u63d0\u793a\uff1aYou have 17 unapplied migration(s)&#8230;\uff08\u7701\u7565 n \u4e2a\u5b57\u7b26\uff09\u3002\u4e0d\u7528\u62c5\u5fc3\uff0c\u6211\u4eec\u4f1a\u5728\u63a5\u4e0b\u6765\u7684\u6b65\u9aa4\u4e2d\u8be6\u7ec6\u8bb2\u89e3\u6765\u9f99\u53bb\u8109\u3002<\/p>\n<\/blockquote>\n<p>\u6309\u7167\u63d0\u793a\uff0c\u6211\u4eec\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee localhost:8000\uff0c\u53ef\u4ee5\u770b\u5230\u6b22\u8fce\u754c\u9762\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/K0MJVXmw2Q.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<blockquote>\n<p><strong>\u63d0\u793a<\/strong><\/p>\n<p>Django \u5f00\u53d1\u670d\u52a1\u5668\u53ef\u4ee5\u4fdd\u6301\u5f00\u542f\uff0c\u5e76\u4e14\u540e\u9762\u4fee\u6539\u4ee3\u7801\u4f1a\u81ea\u52a8\u91cd\u65b0\u52a0\u8f7d\uff0c\u975e\u5e38\u65b9\u4fbf\u3002\u540e\u9762\u8fd0\u884c\u5176\u4ed6\u547d\u4ee4\u65f6\uff0c\u518d\u6253\u5f00\u4e00\u4e2a\u7ec8\u7aef\uff08\u547d\u4ee4\u884c\uff09\u5373\u53ef\u3002<\/p>\n<\/blockquote>\n<p>\u4e00\u5207\u51c6\u5907\u5c31\u7eea\uff0c\u7f30\u7ef3\u5df2\u5728\u4f60\u624b\u4e2d\uff01<\/p>\n<h2>\u521b\u5efa\u7b2c\u4e00\u4e2a\u81ea\u5b9a\u4e49 Django App<\/h2>\n<p>\u5728\u4e0a\u4e00\u8282\u4e2d\u6211\u4eec\u8bb2\u5230\uff0cDjango \u662f\u4e00\u4e2a\u9ad8\u5ea6<strong>\u6a21\u5757\u5316<\/strong>\u7684\u6846\u67b6\u3002\u5177\u4f53\u800c\u8a00\uff0c\u4e00\u4e2a Django \u5e94\u7528\u7531\u591a\u4e2a\u5b50\u5e94\u7528\u7ec4\u6210\uff0c\u6211\u4eec\u4e00\u822c\u79f0\u4e4b\u4e3a App \uff08\u6ce8\u610f\u4e0d\u662f\u6211\u4eec\u5e38\u8bf4\u7684\u79fb\u52a8\u5e94\u7528 APP\uff0c\u800c\u662f Application \u7684\u7b80\u5199\uff09\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/je987YRs6g.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<h3>Django App \u7684\u7c7b\u522b<\/h3>\n<p>Django App \u4e00\u822c\u5206\u4e3a\u4e09\u5927\u7c7b\uff08\u6839\u636e\u6765\u6e90\uff09\uff1a<\/p>\n<ul>\n<li><strong>\u5185\u7f6e<\/strong>\uff1a\u5373 Django \u6846\u67b6\u81ea\u5e26\u7684\u5e94\u7528\uff0c\u5305\u62ec admin \uff08\u540e\u53f0\u7ba1\u7406\uff09\u3001auth \uff08\u8eab\u4efd\u9274\u6743\uff09\u3001sessions \uff08\u4f1a\u8bdd\u7ba1\u7406\uff09\u7b49\u7b49<\/li>\n<li><strong>\u81ea\u5b9a\u4e49<\/strong>\uff1a\u5373\u7528\u6765\u5b9e\u73b0\u6211\u4eec\u81ea\u8eab\u4e1a\u52a1\u903b\u8f91\u7684\u5e94\u7528\uff0c\u8fd9\u91cc\u6211\u4eec\u5c06\u521b\u5efa\u4e00\u4e2a\u65b0\u95fb\u5c55\u793a\u5e94\u7528<\/li>\n<li><strong>\u7b2c\u4e09\u65b9<\/strong>\uff1a\u5373\u793e\u533a\u63d0\u4f9b\u7684\u5e94\u7528\uff0c\u6570\u91cf\u6781\u5176\u4e30\u5bcc\uff0c\u529f\u80fd\u6db5\u76d6\u51e0\u4e4e\u6240\u6709\u65b9\u9762\uff0c\u80fd\u591f\u5927\u5927\u51cf\u5c11\u5f00\u53d1\u6210\u672c<\/li>\n<\/ul>\n<p>\u6240\u6709\u7684 Django \u5e94\u7528\u90fd\u5728 django_news\/settings.py \u7684 <code>INSTALLED_APPS<\/code> \u5217\u8868\u4e2d\u5b9a\u4e49\uff1a<\/p>\n<pre><code>INSTALLED_APPS = [     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles', ] <\/code><\/pre>\n<h3>\u5b9e\u73b0\u81ea\u5b9a\u4e49 App<\/h3>\n<p>\u8bdd\u4e0d\u591a\u8bf4\uff0c\u8ba9\u6211\u4eec\u6765\u521b\u5efa\u7b2c\u4e00\u4e2a\u81ea\u5b9a\u4e49 App\uff0c\u540d\u79f0\u4e3a news\uff1a<\/p>\n<pre><code>python manage.py startapp news <\/code><\/pre>\n<p>\u751f\u6210\u7684 news \u5e94\u7528\u6587\u4ef6\u5939\u7ed3\u6784\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre><code>news                     \/\/ news \u5e94\u7528\u76ee\u5f55 \u251c\u2500\u2500 __init__.py          \/\/ \u521d\u59cb\u5316\u6a21\u5757 \u251c\u2500\u2500 admin.py             \/\/ \u540e\u53f0\u7ba1\u7406\u914d\u7f6e \u251c\u2500\u2500 apps.py              \/\/ \u5e94\u7528\u914d\u7f6e \u251c\u2500\u2500 migrations           \/\/ \u6570\u636e\u5e93\u8fc1\u79fb\u6587\u4ef6\u76ee\u5f55 \u2502   \u2514\u2500\u2500 __init__.py      \/\/ \u6570\u636e\u5e93\u8fc1\u79fb\u521d\u59cb\u5316\u6a21\u5757 \u251c\u2500\u2500 models.py            \/\/ \u6570\u636e\u6a21\u578b \u251c\u2500\u2500 tests.py             \/\/ \u5355\u5143\u6d4b\u8bd5 \u2514\u2500\u2500 views.py             \/\/ \u89c6\u56fe <\/code><\/pre>\n<p>\u8fd9\u4e2a\u5b50\u76ee\u5f55\u91cc\u9762\u4e4d\u4e00\u770b\u597d\u591a\u6587\u4ef6\u554a\uff01\u8fd9\u662f\u56e0\u4e3a Django \u59cb\u7ec8\u575a\u6301<strong>\u89e3\u8026<\/strong>\u7684\u539f\u5219\u2014\u2014\u5c3d\u91cf\u51cf\u5c11\u4ee3\u7801\u4e4b\u95f4\u7684\u8026\u5408\uff0c\u628a\u4e0d\u76f8\u5173\u7684\u4ee3\u7801\u62c6\u6210\u591a\u4e2a\u6a21\u5757\uff0c\u8ba9\u540c\u4e00\u4e2a\u6a21\u5757\u5177\u6709<strong>\u5185\u805a\u6027<\/strong>\u3002\u76f8\u4fe1\u6211\uff0c\u7b49\u5230\u540e\u9762\u6162\u6162\u719f\u6089\u4e4b\u540e\uff0c\u4f60\u4f1a\u5bf9\u6bcf\u4e00\u4e2a\u6a21\u5757\u90fd\u4e86\u5982\u6307\u638c\u7684\u3002<\/p>\n<p>\u5b9e\u9645\u4e0a\uff0c\u6bcf\u4e2a Django App \u7684\u7ec4\u7ec7\u7ed3\u6784\u7b26\u5408 Django \u7684 MTV \u6cd5\u5219\u2014\u2014Model \uff08\u6a21\u578b\uff09+ Template \uff08\u6a21\u677f\uff09+ View \uff08\u89c6\u56fe\uff09\u3002MTV \u4e0e\u5927\u5bb6\u6bd4\u8f83\u719f\u6089\u7684 MVC \u5728\u601d\u60f3\u4e0a\u975e\u5e38\u76f8\u4f3c\uff0c\u4f46\u662f\u547d\u540d\u6709\u6bd4\u8f83\u5927\u7684\u51fa\u5165\uff0c\u5982\u4e0b\u8868\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/hQgcF0MoMV.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u5927\u5bb6\u719f\u77e5\u7684 View\uff0c\u5728 Django \u91cc\u9762\u4ee3\u8868\u7684\u662f\u4e1a\u52a1\u903b\u8f91\uff0c\u4e5f\u5c31\u662f MVC \u4e2d\u7684\u63a7\u5236\u5668\u54e6\uff01<\/p>\n<h3>\u5c06\u81ea\u5b9a\u4e49 App \u6dfb\u52a0\u5230\u5168\u5c40\u914d\u7f6e<\/h3>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u5728 settings.py \u4e2d\u5c06 news \u5e94\u7528\u52a0\u5165 <code>INSTALLED_APPS<\/code> \u4e2d\uff1a<\/p>\n<pre><code># ...  INSTALLED_APPS = [     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles',     'news', ] <\/code><\/pre>\n<p>\u81f3\u6b64\uff0c\u6211\u4eec\u5df2\u7ecf\u521b\u5efa\u4e86\u7b2c\u4e00\u4e2a Django \u5e94\u7528\uff01\u4f46\u662f\u73b0\u5728\u8fd9\u4e2a\u5e94\u7528\u8fd8\u6ca1\u6709\u4efb\u4f55\u5185\u5bb9\uff0c\u6211\u4eec\u63a5\u4e0b\u6765\u5c06\u9010\u6b65\u5b8c\u5584\u8fd9\u4e2a\u5e94\u7528\u3002<\/p>\n<h2>\u7406\u89e3\u89c6\u56fe\uff1a\u4e1a\u52a1\u903b\u8f91\u7684\u7f16\u5199<\/h2>\n<p>\u4e5f\u8bb8\u4f60\u5df2\u7ecf\u6ce8\u610f\u5230\uff0c\u901a\u8fc7\u8bbf\u95ee localhost:8000\/admin \u5df2\u7ecf\u53ef\u4ee5\u8bbf\u95ee\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\u4e86\uff08\u867d\u7136\u4f1a\u8df3\u8f6c\u5230\u767b\u5f55\u754c\u9762\uff09\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u4e5f\u5e0c\u671b\u80fd\u591f\u8bbf\u95ee\u5230\u521a\u624d\u521b\u5efa\u7684 news \u5e94\u7528\u3002\u56e0\u6b64\uff0c\u8fd9\u4e00\u6b65\u4e2d\u6211\u4eec\u5c06\uff1a<\/p>\n<ul>\n<li>\u5728\u89c6\u56fe\uff08 View \uff09\u4e2d\u5199\u4e00\u70b9\u4e1a\u52a1\u903b\u8f91<\/li>\n<li>\u63a5\u5165\u8def\u7531\uff0c\u4f7f\u5176\u80fd\u591f\u88ab\u8bbf\u95ee<\/li>\n<\/ul>\n<h3>Django \u7684\u8def\u7531\u7cfb\u7edf<\/h3>\n<p>Django \u7684\u8def\u7531\u7cfb\u7edf\u662f\u7531<strong>\u5168\u5c40\u8def\u7531<\/strong>\u548c<strong>\u5b50\u5e94\u7528\u8def\u7531<\/strong>\u7ec4\u6210\u3002\u7b80\u5355\u6765\u8bf4\uff0c\u6839\u636e\u7528\u6237\u8f93\u5165\u7684 URL\uff0c\u5168\u5c40\u8def\u7531\u8868\u8fdb\u884c\u5339\u914d\u5e76\u9009\u62e9\u6b63\u786e\u7684\u5b50\u5e94\u7528\u8def\u7531\uff0c\u518d\u7531\u6240\u9009\u62e9\u7684\u5b50\u5e94\u7528\u8def\u7531\u5339\u914d\u5e76\u9009\u62e9\u6b63\u786e\u7684\u89c6\u56fe\uff08 View \uff09\u3002\u6574\u4e2a\u6d41\u7a0b\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/EdOiOKnDrE.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u4f8b\u5982\uff0c\u7528\u6237\u8bbf\u95ee example.com\/apple\/buy\uff0c\u7136\u540e\u5168\u5c40\u8def\u7531\u6839\u636e \/apple\/buy \u5148\u9009\u62e9 apple \u7684\u8def\u7531\u8868\uff0c\u518d\u4ece apple \u8def\u7531\u8868\u4e2d\u6839\u636e \/buy \u9009\u62e9 \/buy \u8def\u7531\uff0c\u7136\u540e\u6267\u884c \/buy \u5bf9\u5e94\u7684 BuyView \u89c6\u56fe\uff0c\u8fd4\u56de\u7ed9\u7528\u6237\u7ed3\u679c\u3002<\/p>\n<h3>\u7f16\u5199\u7b2c\u4e00\u4e2a\u89c6\u56fe<\/h3>\n<p>\u5bf9\u89c6\u56fe\u8bbf\u95ee\u7684\u6d41\u7a0b\u5927\u81f4\u4e86\u89e3\u4e4b\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5f00\u59cb\u52a8\u624b\u4e86\u3002\u9996\u5148\u6253\u5f00 news\/views.py \uff0c\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u89c6\u56fe\u51fd\u6570\uff0c\u8fd4\u56de\u4e00\u4e32 Hello World!\uff1a<\/p>\n<pre><code>from django.http import HttpResponse   def index(request):     return HttpResponse('Hello World!') <\/code><\/pre>\n<p>\u4e0a\u9762\u8fd9\u4e2a <code>index<\/code> \u51fd\u6570\u53ef\u4ee5\u8bf4\u662f\u4e00\u4e2a\u6700\u7b80\u5355\u7684\u89c6\u56fe\u51fd\u6570\u4e86\uff0c\u5b9e\u9645\u5927\u90e8\u5206\u5e94\u7528\u7684\u89c6\u56fe\u8981\u6bd4\u8fd9\u590d\u6742\u5f97\u591a\u3002Django \u540c\u65f6\u652f\u6301<strong>\u57fa\u4e8e\u51fd\u6570\u7684\u89c6\u56fe<\/strong>\uff08 FBV\uff0cFunction-based View \uff09\u548c<strong>\u57fa\u4e8e\u7c7b\u7684\u89c6\u56fe<\/strong>\uff08 CBV\uff0cClass-based View \uff09\uff0c\u8fd9\u91cc\u663e\u7136\u662f FBV\uff0c\u63a5\u6536\u4e00\u4e2a <code>request<\/code> \u8bf7\u6c42\u5bf9\u8c61\u4f5c\u4e3a\u53c2\u6570\uff0c\u8fd4\u56de\u4e86\u4e00\u4e2a <code>HttpResponse<\/code> \u5bf9\u8c61\u3002<\/p>\n<h3>\u5c06\u89c6\u56fe\u63a5\u5165\u8def\u7531<\/h3>\n<p>\u63a5\u7740\uff0c\u6211\u4eec\u8981\u8ba9\u8def\u7531\u7cfb\u7edf\u80fd\u591f\u8bbf\u95ee\u5230\u521a\u624d\u5199\u597d\u7684\u89c6\u56fe\u51fd\u6570\u3002\u56e0\u6b64\u5148\u5b9e\u73b0\u5b50\u5e94\u7528 news \u7684\u8def\u7531\u8868\uff0c\u521b\u5efa news\/urls.py \u6587\u4ef6\u5982\u4e0b\uff1a<\/p>\n<pre><code>from django.urls import path  from . import views  urlpatterns = [     path('', views.index, name='index'), ] <\/code><\/pre>\n<p>\u6bcf\u4e00\u4e2a Django \u8def\u7531\u8868\u6a21\u5757\uff08 urls.py \uff09\u4e2d\u90fd\u7ea6\u5b9a\u5fc5\u987b\u5305\u542b\u4e00\u4e2a <code>urlpatterns<\/code> \u5217\u8868\u7528\u6765\u5b58\u653e\u8def\u7531\u6620\u5c04\u8868\u3002\u5217\u8868\u4e2d\u6bcf\u4e2a\u5143\u7d20\u662f\u4e00\u4e2a\u7528 <code>django.urls.path<\/code> \u51fd\u6570\u5c01\u88c5\u597d\u7684\u8def\u7531\u6620\u5c04\uff0c\u901a\u5e38\u63a5\u6536\u4ee5\u4e0b\u4e09\u4e2a\u53c2\u6570\uff1a<\/p>\n<ul>\n<li><code>route<\/code>\uff1a\u5fc5\u987b\uff0c\u5373\u5b9e\u9645\u7684\u8bbf\u95ee\u8def\u7531\uff0c\u7a7a\u5b57\u7b26\u4e32\u7b49\u4e8e <code>\/<\/code>\uff0c\u5373\u7a7a\u8def\u7531<\/li>\n<li><code>view<\/code>\uff1a\u5fc5\u987b\uff0c\u8be5\u8def\u7531\u5c06\u8981\u8bbf\u95ee\u7684\u89c6\u56fe<\/li>\n<li><code>name<\/code>\uff1a\u53ef\u9009\uff0c\u8be5\u8def\u7531\u7684\u540d\u79f0\uff0c\u65b9\u4fbf\u540e\u7eed\u5728\u6a21\u677f\u4e2d\u4f7f\u7528<\/li>\n<\/ul>\n<p>\u6211\u4eec\u5c06\u521a\u521a\u5199\u597d\u7684 news \u8def\u7531\u8868\u63a5\u5165\u5168\u5c40\u8def\u7531\u8868\u3002\u7531\u4e8e\u6211\u4eec\u5e0c\u671b\u65b0\u95fb\u80fd\u591f\u5c55\u793a\u5728\u9996\u9875\uff08\u5373\u901a\u8fc7 <code>\/<\/code> \u5c31\u80fd\u8bbf\u95ee\uff0c\u65e0\u9700 <code>\/news<\/code>\uff09\uff0c\u56e0\u6b64 news \u5e94\u7528\u8def\u7531\u5728\u5168\u5c40\u8def\u7531\u4e2d\u7684 URL \u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u3002\u5728 django_news\/urls.py \u4e2d\u4fee\u6539\u5982\u4e0b\uff1a<\/p>\n<pre><code>from django.contrib import admin from django.urls import path, include  urlpatterns = [     path('admin\/', admin.site.urls),     path('', include('news.urls')), ] <\/code><\/pre>\n<p>\u8fd9\u91cc\u4f7f\u7528 <code>django.urls.include<\/code> \u51fd\u6570\u5c06 news \u5e94\u7528\u7684\u8def\u7531\u8868\u63a5\u5165\u8fdb\u6765\uff0c\u5e76\u4e14 <code>include<\/code> \u51fd\u6570\u7684\u53c2\u6570\u662f\u8def\u7531\u6a21\u5757\u8def\u5f84\u7684\u5b57\u7b26\u4e32 <code>news.urls<\/code>\uff0c\u7701\u53bb\u4e86\u624b\u52a8 <code>import<\/code> \u7684\u9ebb\u70e6\u3002<\/p>\n<blockquote>\n<p><strong>\u6ce8\u610f<\/strong><\/p>\n<p>\u6dfb\u52a0\u8def\u7531\u89c4\u5219\u65f6\u987a\u5e8f\u662f\u5f88\u91cd\u8981\u7684\uff0c\u56e0\u4e3a\u5728\u5c1d\u8bd5\u5339\u914d\u65f6\u4f1a\u6309\u7167\u4ece\u4e0a\u5230\u4e0b\u7684\u987a\u5e8f\u8fdb\u884c\uff0c\u56e0\u6b64\u5e94\u8be5\u628a\u6700\u6a21\u7cca\u7684\u8def\u7531\uff08\u5373\u7a7a\u8def\u7531\uff09\u653e\u5728\u6700\u4e0b\u9762\u3002<\/p>\n<\/blockquote>\n<p>\u5982\u679c\u4f60\u5f00\u53d1\u670d\u52a1\u5668\u8fd8\u5728\u8fd0\u884c\uff08\u5982\u679c\u6ca1\u6709\u53ef\u4ee5\u518d\u6253\u5f00\uff09\uff0c\u8bbf\u95ee localhost:8000\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u90a3\u4e00\u4e32\u719f\u6089\u7684\u5b57\u7b26\u4e86\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/KsoMHwjJjx.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<h2>\u7406\u89e3\u6a21\u677f\uff1a\u7f51\u9875\u524d\u7aef\u7684\u5b9e\u73b0<\/h2>\n<p>\u4e0a\u4e00\u6b65\u4e2d\uff0c\u6211\u4eec\u5b66\u4f1a\u4e86\u5982\u4f55\u5b9e\u73b0\u89c6\u56fe\uff0c\u5e76\u5c06\u5176\u63a5\u5165\u8def\u7531\u914d\u7f6e\u4e2d\uff0c\u4f7f\u5176\u80fd\u591f\u88ab\u7528\u6237\u8bbf\u95ee\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u5b9e\u73b0\u4e00\u4e2a Django \u6a21\u677f\u4f5c\u4e3a\u7f51\u9875\u524d\u7aef\uff0c\u4ece\u800c\u7ed9\u7528\u6237\u5448\u73b0\u66f4\u4e30\u5bcc\u7684\u5185\u5bb9\u3002<\/p>\n<blockquote>\n<p><strong>\u63d0\u793a<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u6709\u8fc7\u5176\u4ed6\u6a21\u677f\uff08\u6216\u8005\u7c7b\u4f3c\u6280\u672f\uff09\u7684\u5f00\u53d1\u7ecf\u9a8c\uff0c\u4f8b\u5982 Jinja \u3001EJS \u6216\u662f JSP \u7b49\uff0c\u5bf9 Django \u6a21\u677f\u4f1a\u6709\u4e00\u79cd\u4f3c\u66fe\u76f8\u8bc6\u7684\u611f\u89c9\u3002\u5982\u679c\u4f60\u4e0d\u4e86\u89e3\u4ec0\u4e48\u662f\u6a21\u677f\u5f15\u64ce\uff0c\u4e5f\u4e0d\u7528\u62c5\u5fc3\uff0c\u7b80\u5355\u7684\u7406\u89e3\u5c31\u662f\u4e00\u4e2a\u53ef\u4ee5\u586b\u5145\u5185\u5bb9\u3001\u751a\u81f3\u80fd\u591f\u52a0\u5165\u4ee3\u7801\u903b\u8f91\u7684<strong>\u7c7b\u4f3c HTML \u6587\u6863<\/strong>\uff0c\u6700\u7ec8\u4f1a\u88ab\u8f6c\u6362\u6210\u6d4f\u89c8\u5668\u80fd\u591f\u8bc6\u522b\u7684 HTML \u6587\u6863\u3002<\/p>\n<\/blockquote>\n<h3>Django \u6a21\u677f\u8bed\u8a00\u57fa\u7840<\/h3>\n<p>Django \u6a21\u677f\u672c\u8d28\u4e0a\u662f\u4e00\u4e2a HTML \u6587\u6863\uff0c\u53ea\u4e0d\u8fc7\u901a\u8fc7\u4e00\u4e9b\u7279\u6b8a\u7684\u8bed\u6cd5\u5b9e\u73b0\u6570\u636e\u7684\u586b\u5145\u3002\u8fd9\u91cc\u6211\u4eec\u8bb2\u89e3\u4e00\u4e0b\u6700\u5e38\u7528\u7684\u4e09\u4e2a\u8bed\u6cd5\uff1a<\/p>\n<p><strong>\u8868\u8fbe\u5f0f\u63d2\u503c<\/strong><\/p>\n<p>\u6700\u5e38\u7528\u7684\u8bed\u6cd5\uff0c\u6ca1\u6709\u4e4b\u4e00\u3002\u901a\u8fc7\u5728\u4e00\u5bf9\u82b1\u62ec\u53f7 <code>{{}}<\/code> \u653e\u5165\u4e00\u4e2a\u8868\u8fbe\u5f0f\uff0c\u5c31\u80fd\u591f\u5728\u89c6\u56fe\u4e2d\u4f20\u5165\u8868\u8fbe\u5f0f\u4e2d\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u5e76\u6700\u7ec8\u6e32\u67d3\u6210\u5305\u542b\u53d8\u91cf\u5177\u4f53\u5185\u5bb9\u7684 HTML \u4ee3\u7801\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6240\u652f\u6301\u7684\u8868\u8fbe\u5f0f\u4ec5\u652f\u6301\u4ee5\u4e0b\u5f62\u5f0f\uff08\u53ef\u4ee5\u81ea\u7531\u7ec4\u5408\uff09\uff1a<\/p>\n<pre><code>&lt;!-- \u5355\u4e2a\u53d8\u91cf --&gt; {{ variable }}  &lt;!-- \u83b7\u53d6\u5b57\u5178\u7684\u952e\u6216\u5bf9\u8c61\u7684\u5c5e\u6027 --&gt; {{ dict.key }} {{ object.attribute }}  &lt;!-- \u83b7\u53d6\u5217\u8868\u4e2d\u7684\u67d0\u4e2a\u5143\u7d20 --&gt; {{ list.0 }} <\/code><\/pre>\n<p>\u4f8b\u5982\uff0c\u6a21\u677f\u8fd9\u6837\u5199\uff1a<\/p>\n<pre><code>&lt;h1&gt;{{ name }}&lt;\/h1&gt; &lt;p&gt;{{ news.title }}&lt;\/p&gt; &lt;p&gt;{{ news.visitors.0 }}&lt;\/p&gt; <\/code><\/pre>\n<p>\u5982\u679c\u6211\u4eec\u5728\u89c6\u56fe\u4e2d\u4f20\u5165\u4ee5\u4e0b\u4e0a\u4e0b\u6587\u5b57\u5178\uff08 Context Dictionary \uff09\uff1a<\/p>\n<pre><code>{     'name': 'Tuture',     'news': {         'title': 'Hello World',         'visitors': ['Tom', 'Marc'],     } } <\/code><\/pre>\n<p>\u90a3\u4e48\u6700\u7ec8\u6e32\u67d3\u6210\u7684 HTML \u4ee3\u7801\u5c31\u662f\uff1a<\/p>\n<pre><code>&lt;h1&gt;Tuture&lt;\/h1&gt; &lt;p&gt;Hello World&lt;\/p&gt; &lt;p&gt;Tom&lt;\/p&gt; <\/code><\/pre>\n<p><strong>\u6761\u4ef6\u8bed\u53e5<\/strong><\/p>\n<p>\u6761\u4ef6\u8bed\u53e5\u7684\u5b9a\u4e49\u5982\u4e0b\uff1a<\/p>\n<pre><code>{% if is_true %}   &lt;h1&gt;It is true!&lt;\/h1&gt; {% else %}   &lt;h1&gt;It is false!&lt;\/h1&gt; {% endif %} <\/code><\/pre>\n<p>\u5982\u679c\u53d8\u91cf <code>is_true<\/code> \u4e3a\u771f\uff0c\u90a3\u4e48\u6700\u7ec8\u6e32\u67d3\u51fa\u6765\u7684\u5c31\u662f <code>&lt;h1&gt;It is true!&lt;\/h1&gt;<\/code>\uff0c\u5426\u5219\u5c31\u662f <code>&lt;h1&gt;It is false!&lt;\/h1&gt;<\/code>\u3002\u6ce8\u610f\uff1a\u6574\u4e2a\u6761\u4ef6\u8bed\u53e5<strong>\u5fc5\u987b<\/strong>\u4ee5 <code>{% endif %}<\/code> \u7ed3\u675f\uff0c\u5e76\u4e14 <code>{% else %}<\/code> \u662f<strong>\u53ef\u9009<\/strong>\u7684\u3002<\/p>\n<p><strong>\u5faa\u73af\u8bed\u53e5<\/strong><\/p>\n<p>\u5faa\u73af\u8bed\u53e5\u7528\u6765\u5728\u6a21\u677f\u4e0a\u5c55\u793a\u4efb\u610f\u957f\u7684\u5217\u8868\u5185\u5bb9\u3002\u5176\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>{% for elem in some_list %}   &lt;p&gt;{{ elem }}&lt;\/p&gt; {% endfor %} <\/code><\/pre>\n<p>\u5982\u679c\u4f20\u5165\u7684 <code>some_list<\/code> \u4e3a <code>['Apple', 'Banana', 'Orange']<\/code>\uff0c\u90a3\u4e48\u6e32\u67d3\u51fa\u7684 HTML \u4ee3\u7801\u5c31\u662f\uff1a<\/p>\n<pre><code>&lt;p&gt;Apple&lt;\/p&gt; &lt;p&gt;Banana&lt;\/p&gt; &lt;p&gt;Orange&lt;\/p&gt; <\/code><\/pre>\n<h3>\u5b9e\u73b0\u7b2c\u4e00\u4e2a Django \u6a21\u677f<\/h3>\n<p>\u5230\u4e86\u52a8\u624b\u65f6\u95f4\u4e86\uff0c\u6211\u4eec\u5148\u5b9e\u73b0\u7b2c\u4e00\u4e2a Django \u6a21\u677f\u3002\u5728 news \u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a templates \u76ee\u5f55\uff0c\u518d\u5728 templates \u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a news \u76ee\u5f55\uff0c\u5e76\u5728\u5185\u5c42\u7684 news \u76ee\u5f55\u4e2d\u521b\u5efa index.html \u6587\u4ef6\uff1a<\/p>\n<pre><code>mkdir -p news\/templates\/news touch news\/templates\/news\/index.html <\/code><\/pre>\n<blockquote>\n<p><strong>\u601d\u8003<\/strong><\/p>\n<p>\u542c\u4e0a\u53bb\u5f88\u9ebb\u70e6\uff0c\u53ea\u521b\u5efa <code>news\/templates<\/code>\uff0c\u7136\u540e\u628a\u6a21\u677f\u653e\u91cc\u9762\u4e0d\u5c31\u597d\u4e86\uff0c\u4e3a\u4ec0\u4e48\u8fd8\u8981\u518d\u521b\u5efa\u4e00\u4e2a news \u76ee\u5f55\uff1f\u8fd9\u662f\u7531\u4e8e Django \u7684\u6a21\u677f\u67e5\u627e\u673a\u5236\u4f1a\u5c06\u6240\u6709\u5e94\u7528\u91cc\u9762\u7684\u6a21\u677f\u5168\u90e8\u6536\u96c6\u5230\u4e00\u8d77\uff0c\u5982\u679c\u4e24\u4e2a\u6a21\u677f\u7684\u540d\u5b57\u51b2\u7a81\uff0c\u5c31\u4f1a\u5bfc\u81f4\u5176\u4e2d\u4e00\u4e2a\u6a21\u677f\u4e0d\u80fd\u88ab\u6b63\u786e\u8bbf\u95ee\u3002\u5982\u679c\u653e\u5728 news \u5b50\u6587\u4ef6\u5939\u91cc\u9762\uff0c\u5c31\u80fd\u591f\u901a\u8fc7 <code>news\/index.html<\/code> \u8bbf\u95ee\uff0c\u901a\u8fc7<strong>\u547d\u540d\u7a7a\u95f4<\/strong>\u7684\u673a\u5236\u907f\u514d\u4e86\u51b2\u7a81\u3002<\/p>\n<\/blockquote>\n<p>\u6a21\u677f\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code>{% if news_list %}   &lt;ul&gt;   {% for elem in news_list %}     &lt;li&gt;       &lt;h3&gt;{{ elem.title }}&lt;\/h3&gt;       &lt;p&gt;{{ elem.content }}&lt;\/p&gt;     &lt;\/li&gt;   {% endfor %}   &lt;\/ul&gt; {% else %}   &lt;p&gt;\u6682\u65e0\u65b0\u95fb&lt;\/p&gt; {% endif %} <\/code><\/pre>\n<p>\u8fd9\u77ed\u77ed\u51e0\u884c\u6a21\u677f\u4ee3\u7801\u5374\u5f88\u597d\u5730\u8986\u76d6\u4e86\u6211\u4eec\u521a\u521a\u8bb2\u8ff0\u7684\u4e09\u4e2a\u6a21\u677f\u8bed\u6cd5\uff1a\u8868\u8fbe\u5f0f\u63d2\u503c\u3001\u6761\u4ef6\u8bed\u53e5\u548c\u5faa\u73af\u8bed\u53e5\u3002\u5982\u679c\u5fd8\u8bb0\u5176\u4e2d\u67d0\u4e2a\u5730\u65b9\u662f\u4ec0\u4e48\u610f\u601d\u7684\u8bdd\uff0c\u7ffb\u4e0a\u53bb\u770b\u770b\u5427\uff01<\/p>\n<p>\u5b8c\u6210\u6a21\u677f\u7684\u7f16\u5199\u540e\uff0c\u6211\u4eec\u8981\u5728\u89c6\u56fe\u4e2d\u5bf9\u5176\u8fdb\u884c\u6e32\u67d3\u3002\u6253\u5f00 news\/views.py \u6587\u4ef6\uff0c\u4fee\u6539\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code>from django.shortcuts import render   def index(request):     context = {         'news_list': [             {                 \"title\": \"\u56fe\u96c0\u5199\u4f5c\u5de5\u5177\u63a8\u51fa\u4e86\u65b0\u7684\u7248\u672c\",                 \"content\": \"\u968f\u968f\u4fbf\u4fbf\u5c31\u80fd\u5199\u51fa\u4e00\u7bc7\u597d\u6559\u7a0b\uff0c\u771f\u7684\u5f88\u795e\u5947\",             },             {                 \"title\": \"\u56fe\u96c0\u793e\u533a\u6b63\u5f0f\u63a8\u51fa\u5feb\u901f\u5165\u95e8\u7cfb\u5217\u6559\u7a0b\",                 \"content\": \"\u4e00\u676f\u8336\u7684\u529f\u592b\uff0c\u8ba9\u4f60\u5feb\u901f\u4e0a\u624b\uff0c\u7edd\u65e0\u62c5\u5fe7\",             },         ]     }      return render(request, 'news\/index.html', context=context) <\/code><\/pre>\n<p>\u8fd9\u91cc\u6211\u4eec\u8c03\u7528 <code>django.shortcuts.render<\/code> \u51fd\u6570\u6765\u6e32\u67d3\u6a21\u677f\uff0c\u8fd9\u4e2a\u51fd\u6570\u901a\u5e38\u63a5\u53d7\u4e09\u4e2a\u53c2\u6570\uff08\u6709\u5176\u4ed6\u53c2\u6570\uff0c\u4f46\u662f\u8fd9\u91cc\u6211\u4eec\u4e0d\u5173\u5fc3\uff09\uff1a<\/p>\n<ul>\n<li><code>request<\/code>\uff1a\u8bf7\u6c42\u5bf9\u8c61\uff0c\u76f4\u63a5\u628a\u89c6\u56fe\u7684\u53c2\u6570 <code>request<\/code> \u4f20\u8fdb\u6765\u5c31\u53ef\u4ee5<\/li>\n<li><code>template_name<\/code>\uff1a\u6a21\u677f\u540d\u79f0\uff0c\u8fd9\u91cc\u5c31\u662f\u6211\u4eec\u521a\u521a\u521b\u5efa\u7684 <code>news\/index.html<\/code><\/li>\n<li><code>context<\/code>\uff1a\u4f20\u5165\u6a21\u677f\u7684\u4e0a\u4e0b\u6587\u5bf9\u8c61\uff0c\u5fc5\u987b\u662f\u4e00\u4e2a\u5b57\u5178\uff0c\u5b57\u5178\u4e2d\u7684\u6bcf\u4e2a\u952e\u5bf9\u5e94\u6a21\u677f\u4e2d\u7684\u53d8\u91cf\u3002\u8fd9\u91cc\u6211\u4eec\u5f04\u4e86\u4e9b\u5047\u6570\u636e\uff0c\u5047\u88c5\u662f\u4ece\u6570\u636e\u5e93\u91cc\u9762\u53d6\u6765\u7684\u3002<\/li>\n<\/ul>\n<p>\u518d\u8bbf\u95ee localhost:8000\uff0c\u770b\u4e00\u4e0b\u6211\u4eec\u7684\u9996\u9875\u662f\u4e0d\u662f\u6709\u5185\u5bb9\u4e86\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/lD0Rkg8Z5V.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u5b8c\u7f8e\uff01<\/p>\n<h2>\u7406\u89e3\u6a21\u578b\uff1a\u548c\u6570\u636e\u5e93\u7684\u8054\u52a8<\/h2>\n<p>Django \u7684 MTV\uff0c\u6211\u4eec\u5df2\u7ecf\u8bb2\u4e86 T \uff08 Template \uff09\u548c V \uff08 View \uff09\uff0c\u73b0\u5728\u6765\u5230\u4e86\u6700\u540e\u4e00\u5173\uff1aM \uff08 Model \uff09\u4e86\u3002\u6570\u636e\u6a21\u578b\u662f Django \u5165\u95e8\u6700\u5927\u7684\u96be\u70b9\uff0c\u6d88\u5316\u8fd9\u4e00\u6b65\u7684\u5185\u5bb9\u9700\u8981\u82b1\u70b9\u529b\u6c14\uff0c\u4f46\u662f\u76f8\u4fe1\u6211\uff0c\u5f53\u4f60\u8fc8\u8fc7 M \u8fd9\u6700\u540e\u4e00\u5173\uff0c\u4f60\u4fbf\u80fd\u771f\u6b63\u4e0a\u624b Django \u5f00\u53d1\u4e86\uff01\u4e0b\u9762\u6211\u4eec\u5148\u4ecb\u7ecd\u4e00\u4e0b Django \u7684\u6570\u636e\u6a21\u578b\u8bbe\u8ba1\u3002<\/p>\n<p>Django \u5728\u6570\u636e\u6a21\u578b\u65b9\u9762\u7684\u8bbe\u8ba1\u582a\u79f0\u5178\u8303\uff0c\u5217\u4e3e\u4e00\u4e9b\u95ea\u5149\u70b9\uff1a<\/p>\n<ul>\n<li>\u7531\u4e8e\u9ad8\u5ea6\u89e3\u8026\u7684\u8bbe\u8ba1\uff0c\u53ef\u8f7b\u677e\u5207\u6362\u5404\u79cd\u5173\u7cfb\u578b\u6570\u636e\u5e93\uff08\u9ed8\u8ba4\u7684 SQLite\uff0c\u53ef\u9009 MySQL \u3001PostgreSQL \u3001Oracle \u7b49\u7b49\uff09<\/li>\n<li>\u5f3a\u5927\u7684 ORM \uff08 Object Relation Mapping\uff0c\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\uff09\u6a21\u5757\uff0c\u4f7f\u5f97\u7528 Python \u64cd\u4f5c\u6570\u636e\u5e93\u975e\u5e38\u8f7b\u677e\uff0c\u514d\u53bb\u4e86\u4f7f\u7528 SQL \u7684\u9ebb\u70e6<\/li>\n<li>\u4f18\u79c0\u7684\u6570\u636e\u5e93\u8fc1\u79fb\u673a\u5236\uff08 Migration \uff09\uff0c\u4fee\u6539\u6570\u636e\u6a21\u5f0f\uff08 Schema \uff09\u6bd4\u8f83\u65b9\u4fbf\uff0c\u80fd\u591f\u9002\u5e94\u4e0d\u65ad\u53d8\u5316\u7684\u529f\u80fd\u9700\u6c42<\/li>\n<\/ul>\n<p>\u5bf9\u4e8e\u521d\u5b66\u8005\u800c\u8a00\uff0c\u6211\u4eec\u6682\u4e14\u9009\u62e9\u9ed8\u8ba4\u7684 SQLite \u6570\u636e\u5e93\uff0c\u7701\u53bb\u4e86\u914d\u7f6e\u6570\u636e\u5e93\u7684\u70e6\u607c\u3002\u5728\u540e\u9762\u7684\u8fdb\u9636\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u4f1a\u5207\u6362\u5230\u5176\u4ed6\u9002\u5408\u751f\u4ea7\u73af\u5883\u7684\u6570\u636e\u5e93\u3002<\/p>\n<h3>\u7406\u89e3 ORM<\/h3>\n<p>\u7b80\u5355\u6765\u8bf4\uff0cORM \u80fd\u591f\u5c06\u9762\u5411\u5bf9\u8c61\u7684\u4ee3\u7801\u8f6c\u6362\u6210\u76f8\u5e94\u7684 SQL \u8bed\u53e5\uff0c\u4ece\u800c\u5bf9\u6570\u636e\u5e93\u8fdb\u884c\u64cd\u4f5c\u3002SQL \u662f\u7528\u4e8e\u8bbf\u95ee\u548c\u5904\u7406\u6570\u636e\u5e93\u7684\u6807\u51c6\u7684\u8ba1\u7b97\u673a\u8bed\u8a00\uff0c\u4f46\u662f\u76f4\u63a5\u5199\u5728\u4ee3\u7801\u91cc\u9762\u663e\u7136\u96be\u4ee5\u7ef4\u62a4\uff0c\u800c\u4e14\u5bf9\u4f7f\u7528\u8005\u7684\u8981\u6c42\u4e5f\u975e\u5e38\u9ad8\uff0c\u5199\u7684\u7cdf\u7cd5\u7684 SQL \u4ee3\u7801\u67e5\u8be2\u6548\u7387\u975e\u5e38\u4f4e\u4e0b\u3002\u56e0\u6b64\uff0c\u4f7f\u7528\u8bbe\u8ba1\u826f\u597d\u7684 ORM \u4e0d\u4ec5\u8ba9\u4ee3\u7801\u53ef\u8bfb\u6027\u66f4\u597d\uff0c\u4e5f\u80fd\u5e2e\u52a9\u5f00\u53d1\u8005\u8fdb\u884c\u67e5\u8be2\u4f18\u5316\uff0c\u8282\u7701\u4e0d\u5c11\u529b\u6c14\u3002<\/p>\n<p>\u6211\u4eec\u6765\u770b\u4e00\u4e9b\u7b80\u5355\u7684 Django ORM \u4f8b\u5b50\uff1a<\/p>\n<pre><code># \u67e5\u8be2\u6240\u6709\u6a21\u578b # \u7b49\u4ef7\u4e8e SELECT * FROM Blog Blog.objects.all()  # \u67e5\u8be2\u5355\u4e2a\u6a21\u578b # \u7b49\u4ef7\u4e8e SELECT * FROM Blog WHERE ID=1 Blog.objects.get(id=1)  # \u6dfb\u52a0\u5355\u4e2a\u6a21\u578b # \u7b49\u4ef7\u4e8e INSERT INTO Blog (title, content) VALUES ('hello', 'world') blog = Blog(title='hello', content='world') blog.save() <\/code><\/pre>\n<p>\u6709\u6728\u6709\u611f\u89c9\u64cd\u4f5c\u8d77\u6765\u6bd4 SQL \u65b9\u4fbf\u5f88\u591a\u5462\uff1f<\/p>\n<h3>\u7406\u89e3\u6570\u636e\u5e93\u8fc1\u79fb<\/h3>\n<p>\u6570\u636e\u5e93\u8fc1\u79fb\u662f\u6307\u5c06\u7528 Django \u5b9a\u4e49\u7684\u6a21\u578b\u8f6c\u6362\u6210 SQL \u4ee3\u7801\uff08\u5373\u8fc1\u79fb\u6587\u4ef6\uff09\uff0c\u5e76\u5728\u6570\u636e\u5e93\u4e2d\u8fdb\u884c\u5efa\u8868\u64cd\u4f5c\uff08\u6216\u66f4\u65b0\u8868\uff09\u3002\u770b\u4e0b\u9762\u8fd9\u5f20\u56fe\u5c31\u77e5\u9053\u4e86\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/cDTSp73vDI.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u4e00\u822c\u7684\u5f00\u53d1\u6d41\u7a0b\u5c31\u662f\u8fd9\u6837\uff1a<\/p>\n<ol>\n<li>\u7528 Django \u5b9a\u4e49\u4e86\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u6a21\u578b<\/li>\n<li>\u7528 <code>makemigrations<\/code> \u547d\u4ee4\u521b\u5efa\u8fc1\u79fb\u6587\u4ef6\uff08\u5b58\u50a8\u5728\u5b50\u5e94\u7528\u7684 migrations \u76ee\u5f55\u91cc\u9762\uff09<\/li>\n<li>\u7528 <code>migrate<\/code> \u547d\u4ee4\u6267\u884c\u8fc1\u79fb<\/li>\n<li>\u5728\u5f00\u53d1\u4e2d\u53d1\u73b0\u7b2c 1 \u6b65\u4e2d\u5b9a\u4e49\u7684\u6a21\u578b\u4e0d\u5b8c\u5584\uff0c\u66f4\u65b0\u6570\u636e\u6a21\u578b<\/li>\n<li>\u8df3\u8f6c\u5230\u7b2c 2 \u6b65\uff0c\u53cd\u590d\u5faa\u73af<\/li>\n<\/ol>\n<h3>\u5b9e\u73b0\u7b2c\u4e00\u4e2a\u6570\u636e\u6a21\u578b<\/h3>\n<p>\u7ec8\u4e8e\u5230\u4e86\u52a8\u624b\u7684\u73af\u8282\u3002\u6211\u4eec\u9996\u5148\u5b9a\u4e49\u6570\u636e\u6a21\u578b <code>Post<\/code> \uff0c\u5305\u62ec\u6807\u9898 <code>title<\/code> \u5b57\u6bb5\u548c <code>content<\/code> \u5b57\u6bb5\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code>from django.db import models   class Post(models.Model):     title = models.CharField(max_length=200)     content = models.TextField()      def __str__(self):         return self.title <\/code><\/pre>\n<p>\u5b9a\u4e49\u597d\u4e4b\u540e\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u8fc1\u79fb\u6587\u4ef6\uff1a<\/p>\n<pre><code>python manage.py makemigrations <\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u8f93\u51fa\u5982\u4e0b\uff1a<\/p>\n<pre><code>Migrations for 'news':   news\/migrations\/0001_initial.py     - Create model Post <\/code><\/pre>\n<p>\u5e76\u4e14\u6210\u529f\u5730\u81ea\u52a8\u521b\u5efa\u4e86 news\/migrations\/0001_initial.py \u8fc1\u79fb\u811a\u672c\u3002\u63a5\u7740\u6211\u4eec\u8fdb\u884c\u6570\u636e\u5e93\u8fc1\u79fb\uff1a<\/p>\n<pre><code>python manage.py migrate <\/code><\/pre>\n<p>\u8f93\u51fa\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/kkRzE4TsJK.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u6570\u636e\u5e93\u8fc1\u79fb\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u521b\u5efa\u7528\u4e8e\u767b\u5f55\u540e\u53f0\u7ba1\u7406\u7684\u8d85\u7ea7\u7528\u6237\uff1a<\/p>\n<pre><code>python manage.py createsuperuser <\/code><\/pre>\n<p>\u6309\u7167\u63d0\u793a\u586b\u5199\u7528\u6237\u540d\u548c\u5bc6\u7801\u5373\u53ef\u3002\u7136\u540e\u8bbf\u95ee localhost:8000\/admin\uff0c\u8fdb\u5165\u540e\u53f0\u7cfb\u7edf\u7684\u767b\u5f55\u9875\u9762\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/gvRG1A6VEu.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u586b\u5165\u521a\u624d\u8bbe\u7f6e\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u8fdb\u5165\u540e\u53f0\u7ba1\u7406\u9875\u9762\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec46684681d3.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u54a6\uff0c\u6211\u4eec\u521a\u624d\u521b\u5efa\u7684 news \u5e94\u7528\u8fd8\u6709 Post \u6a21\u578b\u53bb\u54ea\u4e86\uff1f<\/p>\n<h3>\u914d\u7f6e\u540e\u53f0\u7ba1\u7406\u63a5\u53e3<\/h3>\n<p>\u90a3\u662f\u56e0\u4e3a\u6211\u4eec\u6ca1\u6709\u5b9e\u73b0 news \u5e94\u7528\u7684\u540e\u53f0\u7ba1\u7406\u63a5\u53e3\u3002\u5728 news\/admin.py \u4e2d\u586b\u5165\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code>from django.contrib import admin  from .models import Post  admin.site.register(Post) <\/code><\/pre>\n<p>\u518d\u6b21\u8fdb\u5165\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\uff0c\u53ef\u4ee5\u770b\u5230\u6211\u4eec\u7684 news \u5e94\u7528\u548c Post \u6a21\u578b\u4e86\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/ohemXRvhvc.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u70b9\u51fb Posts \u4e00\u680f\u7684 +Add \u6309\u94ae\uff0c\u5f00\u59cb\u6dfb\u52a0\u65b0\u95fb\uff08\u5185\u5bb9\u968f\u610f\uff09\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec4669e5659c.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u5927\u6982\u6dfb\u52a0\u4e2a\u4e24\u4e09\u6761\u65b0\u95fb\u5c31\u5dee\u4e0d\u591a\u5566\u3002\u4f60\u4e5f\u53ef\u4ee5\u8fdb\u4e00\u6b65\u63a2\u7d22\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\uff0c\u5305\u62ec\u4fee\u6539\u65b0\u95fb\u3001\u6dfb\u52a0\u7528\u6237\u7b49\u7b49\uff0c\u90fd\u53ef\u4ee5\u3002<\/p>\n<h3>\u5728\u89c6\u56fe\u4e2d\u6dfb\u52a0\u6570\u636e\u67e5\u8be2<\/h3>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u5728\u89c6\u56fe\u4e2d\u52a0\u5165\u4ece\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u7684\u4ee3\u7801\uff1a<\/p>\n<pre><code>from django.shortcuts import render  from .models import Post   def index(request):     context = { 'news_list': Post.objects.all() }     return render(request, 'news\/index.html', context=context) <\/code><\/pre>\n<p>\u8bbf\u95ee\u7f51\u7ad9\u9996\u9875\uff0c\u53ef\u4ee5\u770b\u5230\u521a\u624d\u5728\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\u6dfb\u52a0\u7684\u65b0\u95fb\u4e86\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec466acbca4f.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<p>\u5927\u529f\u544a\u6210\uff01\u5728\u8fd9\u7bc7\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5b8c\u6210\u4e86\u4e00\u4e2a\u65b0\u95fb\u53d1\u5e03\u7f51\u7ad9\uff0c\u5e76\u4e14\u53ef\u4ee5\u4ece\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\u4e2d\u6dfb\u52a0\u65b0\u95fb\uff0c\u6700\u7ec8\u5c55\u793a\u5230\u6211\u4eec\u7684\u7f51\u7ad9\u9996\u9875\u4e0a\u3002<\/p>\n<p>\u5e0c\u671b\u8fd9\u7bc7\u6559\u7a0b\u80fd\u591f\u8ba9\u4f60\u5bf9 Django \u6700\u91cd\u8981\u7684\u4e00\u4e9b\u6982\u5ff5\u548c\u64cd\u4f5c\u6709\u4e86\u57fa\u672c\u7684\u4e86\u89e3\u3002Django \u8fd8\u6709\u5f88\u591a\u5f88\u591a\u7684\u9ad8\u7ea7\u73a9\u6cd5\uff0c\u4f8b\u5982\u6570\u636e\u6a21\u578b\u4e2d\u7684\u9ad8\u7ea7\u67e5\u8be2\u3001\u5b57\u6bb5\u7d22\u5f15\u3001\u66f4\u6362\u6570\u636e\u5e93\u7b49\u7b49\uff0c\u6a21\u677f\u4e2d\u7684\u7ee7\u627f\u673a\u5236\u3001\u5185\u90e8\u6807\u7b7e\u7b49\u7b49\uff0c\u8fd8\u6709\u89c6\u56fe\u4e2d\u5982\u4f55\u5904\u7406\u5404\u7c7b\u8bf7\u6c42\uff08 POST \u3001PUT \u7b49\uff09\uff0c\u6211\u4eec\u4f1a\u5728\u540e\u7eed\u66f4\u591a\u6559\u7a0b\u4e2d\u9010\u4e00\u4e3a\u5927\u5bb6\u8bb2\u89e3\uff0c\u4e0d\u89c1\u4e0d\u6563\uff01<\/p>\n<blockquote>\n<p>\u60f3\u8981\u5b66\u4e60\u66f4\u591a\u7cbe\u5f69\u7684\u5b9e\u6218\u6280\u672f\u6559\u7a0b\uff1f\u6765\u56fe\u96c0\u793e\u533a\u901b\u901b\u5427\u3002<\/p>\n<\/blockquote>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/C7eVQrqUcP.pnglarge.png\" alt=\"\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django \u6846\u67b6\u5f00\u53d1\" \/><\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>31<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1204122\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ShayneWang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6536\u85cf\u4ece\u672a\u505c\u6b62 \u5b66\u4e60\u4ece\u672a\u5f00\u59cb <br \/>\u4e0d\u7ba1\u4e86\uff0c\u5148\u63d2\u773c\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204123\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tmac33 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             django \u662f\u4e2a\u597d\u6846\u67b6\uff0c\u4f46 2020 \u5e74 web \u540e\u7aef\u6211\u9009 Go \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204124\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : brotherlegend <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8c22\u8c22\u4e3b\uff0c\u6211\u8336\u521a\u6ce1\u597d\u4e00\u5927\u676f\u3002\u6765\u770b\u770b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204125\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imxz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u9519\u4e0d\u9519 \u4e0b\u6b21\u6709\u6ca1\u6709\u5206\u4eab\u4e00\u676f\u8336\uff0c\u4e0a\u624b flask \u7684\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204126\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Leigg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u53ef\u4ee5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204127\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ar414 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u676f\u8336\u6709\u70b9\u5927\u676f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204128\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 2owe <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6587\u7ae0\u5185\u5bb9\u771f\u4e0d\u9519\u554a\u3002\u4e2a\u4eba\u8868\u793a\u77e5\u6613\u884c\u96be\uff0c\u867d\u7136\u90fd\u4e86\u89e3\uff0c\u4f46\u60f3\u5199\u5f97\u8fd9\u4e48\u6df1\u5165\u6d45\u51fa\u633a\u4e0d\u5bb9\u6613\u7684\uff0c\u611f\u8c22\u5206\u4eab                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204129\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sxfscool <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u9879\u76ee\u4e0d\u9519\uff0c\u4ed8\u51fa\u4e86\u52aa\u529b\uff0c\u4f46\u662f\u73b0\u5728\u7528 py \u505a\u540e\u7aef\u5e02\u573a\u5f88\u5c0f\u4e86\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204130\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Rxianbei <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u5c3c\u739b\u90fd\u60f3\u7740\u8f6c go \u540e\u7aef\u4e86\uff0c\u73b0\u5728\u8fd8\u5b66 django                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204131\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Leon6868 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bdd\u8bf4\u4e3a\u4ec0\u4e48\u4e0d\u7528 Flask \u5462\uff1f\u611f\u89c9 Flask \u53d1\u6325\u7684\u7a7a\u95f4\u5927\u4e00\u70b9\uff0c\u4e5f\u6ca1\u6709\u627e\u5230\u4ec0\u4e48\u6f0f\u6d1e                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204132\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : izzy27 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5148 star \u4e86\uff0c\u6700\u8fd1\u5728\u5b66 django                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204133\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mimzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Leon6868 #10 \u90fd\u53ef\u4ee5 \u6211\u81ea\u5df1\u73b0\u5728\u89c9\u5f97\u5927\u800c\u5168\u4e5f\u633a\u597d<\/p>\n<p>\u53e6\u5916\u73b0\u5728\u793e\u533a\u7684\u6d3b\u8dc3\u5ea6 Django \u597d\u5f88\u591a https:\/\/github.com\/django\/django\/commits\/master https:\/\/github.com\/pallets\/flask\/commits\/master \u5bf9\u5f02\u6b65\u7684\u652f\u6301\u5728 Roadmap \u91cc\u5f88\u660e\u786e https:\/\/docs.djangoproject.com\/en\/dev\/releases\/3.1\/\uff08\u5f53\u7136\u8fd9\u6837\u7684\u8bdd\u4e5f\u53ef\u4ee5\u9009 Starlette \u548c FastAPI \u4e86\uff09                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204134\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mmixxia <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u6765\u662f\u534a\u6253\u7684\u67e0\u6aac\u8336                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204135\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dayeye2006199 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u4e2a\u95ee\u9898\uff1a\u4e1a\u52a1\u903b\u8f91\u4e00\u822c\u653e\u5728 view \u91cc\u9762\u8fd8\u662f model \u91cc\u9762\u3002\u6211\u770b\u7f51\u4e0a\u6709\u4e00\u4e9b\u8ba8\u8bba\uff0c\u4e0d\u5c11\u4eba\u63a8\u8350\u628a\u590d\u6742\u7684\u903b\u8f91\u653e\u5728 model \u91cc\u9762\uff0c\u505a fat model\uff0cview \u53ea\u662f\u7528\u6765\u8d1f\u8d23\u505a\u6570\u636e\u5c55\u793a\u3002LZ \u7684\u63a8\u8350\u662f\u653e\u5728 view \u91cc\u9762\u3002<\/p>\n<p>\u8fd9\u91cc\u9762\u6709\u4ec0\u4e48\u8003\u91cf\u5417\uff1f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204136\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dayeye2006199 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Leon6868 django \u662f\u4e2a\u5168\u5bb6\u6876\uff0c\u4e0d\u7528\u88c5\u90a3\u4e48\u591a\u63d2\u4ef6\u5c31\u53ef\u4ee5\u628a\u4ec0\u4e48 ORM\uff0c\u9a8c\u8bc1\u767b\u5f55 \u7684\u6d3b\u90fd\u5e72\u4e86\u3002\u800c\u4e14\u4e0d\u540c\u7684 django \u9879\u76ee\u4e4b\u95f4\u7684\u4ee3\u7801\u98ce\u683c\u4e5f\u5f88\u4e00\u81f4\uff0c\u6709\u79cd\u5e72\u4e00\u4ef6\u4e8b\u7528\u4e00\u4e2a\u65b9\u6cd5\u7684\u610f\u601d\u3002<\/p>\n<p>Flask \u652f\u6301\u4e0a\u8ff0\u529f\u80fd\u9700\u8981\u5f88\u591a\u63d2\u4ef6\uff0c\u63d2\u4ef6\u4e4b\u95f4\u7684\u5dee\u5f02\u4e5f\u6bd4\u8f83\u5927\uff0c\u7075\u6d3b\u5ea6\u5f88\u9ad8\uff0c\u4e5f\u5bfc\u81f4\u5199\u6cd5\u5f88\u4e0d\u4e00\u6837\u3002<\/p>\n<p>\u5982\u679c\u53ea\u662f\u9700\u8981\u7b80\u5355\u7684\u540e\u7aef\u529f\u80fd\uff0c \u4f8b\u5982\u66b4\u9732\u4e00\u4e9b\u7eaf\u540e\u7aef stateless ML \u670d\u52a1\u7684\u63a5\u53e3\u7b49\uff0cFlask \u8fd8\u662f\u5f88\u6709\u4f18\u52bf\u7684\uff0c\u5f00\u53d1\u901f\u5ea6\u4e5f\u5feb\uff0c\u591a\u534a\u4e00\u4e2a PY file \u5c31\u53ef\u4ee5\u8d70\u5929\u4e0b\u4e86\u3002django \u90a3\u4e48\u591a\u7684\u529f\u80fd\u5927\u90e8\u5206\u4e5f\u90fd\u7528\u4e0d\u4e0a\u3002<\/p>\n<p>\u8fd9\u4e24\u4e2a\u6846\u67b6\u6587\u6863\u5199\u7684\u90fd\u5f88\u597d\uff0c\u7f51\u4e0a\u7684\u8d44\u6599\u4e5f\u5f88\u5168\u3002\u4e00\u822c\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u9009\u62e9\u6bd4\u8f83\u5408\u9002\u7684\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204137\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dayeye2006199 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @tmac33 \u5bf9\u4e2a\u4eba\u5f00\u53d1\u8005\u548c\u5c0f\u56e2\u961f\u4f7f\u7528\u8fd8\u662f\u633a\u53cb\u597d\u7684\uff0c\u6bd5\u7adf PY \u5927\u5bb6\u6216\u591a\u6216\u5c11\u90fd\u61c2\u4e00\u4e9b\uff0c\u770b\u770b\u6587\u6863\u5c31\u80fd\u64b8\u4e2a\u540e\u7aef\u51fa\u6765\u4e86\u3002\u5c24\u5176\u662f\u5bf9\u4e0d\u662f\u4e13\u95e8\u505a\u8fd9\u5757\u7684\u5de5\u7a0b\u5e08\uff0c\u4f8b\u5982\u641e\u7b97\u6cd5\u7684\uff0c\u6216\u8005\u7eaf\u641e infrastructure \uff08\u7f51\u7edc\uff0c\u5b58\u50a8\uff0c\u6570\u636e\u5e93\u8fd9\u5757\u7684\uff09\uff0cdjango \u8fd9\u79cd\u5168\u5bb6\u6876+\u7f51\u4e0a\u4f8b\u5b50\u7279\u522b\u591a\u7684\uff0c\u641e\u51fa\u4e2a\u540e\u7aef\u7684\u539f\u578b\u8fd8\u662f\u633a\u5feb\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204138\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zxcvsh <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e2a\u4eba\u611f\u89c9\uff0cDjango \u5b98\u7f51\u6559\u7a0b\u4e0d\u9999\u5417\uff0c\u4eba\u5bb6\u5b98\u65b9\u4e2d\u6587\u7ffb\u8bd1\uff1b flask \u7eaf\u5165\u95e8\uff0c\u77e5\u4e4e\u641c\u674e\u8f89\u4e5f\u662f\u9014\u5f84\u5440                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204139\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : royceyong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u9a6c\u514b\u6539\u5929\u518d\u8bfb\u7cfb\u5217\uff1a\uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204140\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiaket <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @dayeye2006199 \u5c31\u6211 n \u5e74\u524d\u5199 Django \u7684\u4f53\u9a8c\u6765\u770b, \u5e94\u8be5\u8fd8\u662f\u8981\u5c06\u4e1a\u52a1\u903b\u8f91\u7684\u4e3b\u5e72\u5199\u5230 view \u91cc\u9762, \u6211\u4e0d\u4ecb\u610f\u4e00\u4e9b model \u63d0\u4f9b\u989d\u5916\u7684 API \u4f9b view \u8c03\u7528, \u8fd9\u662f\u7b26\u5408 DRY \u539f\u5219\u7684. \u4f46\u662f\u5982\u679c\u662f\u8981\u5c06\u672c\u5e94 view \u5904\u7406\u7684\u903b\u8f91\u5168\u653e\u8fdb model, \u800c\u4e14\u53ea\u662f\u4e3a\u4e00\u4e2a view \u4f7f\u7528, \u90a3\u4e48\u6211\u4e0d\u4f1a\u6b23\u8d4f\u8fd9\u6837\u7684\u505a\u6cd5.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204141\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jmyz0455 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @zxcvsh \u9a6c\u514b\uff0c\u6b63\u51c6\u5907\u5b66 Django \u3002<br \/>\u4e0a\u8bf4\u4e86\u597d\u591a go \u7684\uff0c\u73b0\u5728\u524d\u666f\u90a3\u4e48\u597d\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204142\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jmyz0455 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u54a6\uff0c\u8ba4\u771f\u770b\u4e00\u4e0b\u662f MTV \uff1f\u6211\u60f3\u5b66\u524d\u540e\u7aef\u5206\u79bb\uff0c\u8f93\u51fa RESTful \u63a5\u53e3\u7684\u90a3\u79cd\uff0c\u4e0d\u9700\u8981\u754c\u9762\u3002\u6211\u7528 postman \u5b9e\u73b0\u767b\u9646\u540e CURD \u7684\u64cd\u4f5c\uff0c\u6bd4\u8f83\u7c7b\u4f3c\u4e8e MVC                                                             <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204143\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ysw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             django \u4e0a\u624b\u5bb9\u6613\uff0c\u7cbe\u901a\u96be                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204144\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ysw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f46\u662f\u8fd8\u662f\u8d5e\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204145\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : AllenBigBear <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ShayneWang \u6709\u7b11\u5230                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204146\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : huan1043269994 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ysw \u8c22\u8c22                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204147\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : huan1043269994 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @mmixxia \u88ab\u4f60\u770b\u7a7f\u4e86\uff09\u9003                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204148\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : huan1043269994 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @2owe \u8c22\u8c22\u4f60\uff01\u6211\u4eec\u4f1a\u52aa\u529b\u5199\u51fa\u66f4\u52a0\u4f18\u8d28\u7684\u6559\u7a0b\u54d2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204149\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : huan1043269994 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ar414 \u518d\u6765\u4e00\u676f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204150\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6700\u540e\u7f3a\u4e2a\u5f15\u6d41\u7f51\u5740\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204151\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Kobayashi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u4ef7\u503c\uff0c\u57fa\u672c\u5c31\u662f\u5b98\u65b9\u6587\u6863\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1204152\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : huan1043269994 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @julyclyde \u516c\u4f17\u53f7\u5173\u6ce8\u4e00\u6ce2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u676f\u8336\u7684\u65f6\u95f4\uff0c\u4e0a\u624b Django &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\/94330"}],"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=94330"}],"version-history":[{"count":1,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/94330\/revisions"}],"predecessor-version":[{"id":94343,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/94330\/revisions\/94343"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=94330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=94330"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=94330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}