<?xml version="1.0" encoding='utf-8'?>
<?xml-stylesheet type="text/xsl" href="http://www.miniws.cn/roller-ui/styles/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom">
    <title type="html">Roller Site</title>
    <subtitle type="html">&#20248;&#22810;&#32654;&#21475;&#33108;&#24494;&#32593;&#31449;</subtitle>
    <id>http://www.miniws.cn</id>
    <link rel="alternate" type="text/html" href="http://www.miniws.cn" />
            <link rel="self" type="application/atom+xml" href="http://www.miniws.cn/home/feed/entries/atom" />
            <updated>2017-07-04T13:51:30+08:00</updated>
    <generator uri="http://roller.apache.org" version="1.0.0 (20170802113103:peter)">Apache Roller Weblogger</generator>
        <entry>
        <id>http://www.miniws.cn/wanle/entry/1499147412054</id>
        <title type="html">1499147412054</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/wanle/entry/1499147412054"/>
        <published>2017-07-04T13:51:30+08:00</published>
        <updated>2017-07-04T13:51:30+08:00</updated> 
        <category term="/Status" label="status" />
        <summary type="html">sdsdas</summary>
        <content type="html">dfsdfsdfs</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/wanle/entry/1499132441715</id>
        <title type="html">1499132441715</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/wanle/entry/1499132441715"/>
        <published>2017-07-04T09:41:55+08:00</published>
        <updated>2017-07-04T10:20:44+08:00</updated> 
        <category term="/Status" label="status" />
        <category term="aa" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">&#24314;&#35774;&#20013;&#12290;&#12290;&#12290;&#12290;&#12290;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1432476634153</id>
        <title type="html">1432476634153</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1432476634153"/>
        <published>2015-05-24T22:16:30+08:00</published>
        <updated>2015-05-24T22:20:10+08:00</updated> 
        <category term="/Menus/hots" label="hots" />
        <summary type="html">&#21697;&#29260;&#65306;&#39321;&#28207;&#12304;Oral-2060&#12305;&lt;br /&gt;&#22411;&#21495;&#65306;UL0111 - &#31505;&#33080;&#21047;&#29273;&#35745;&#26102;&#27801;&#28431;;</summary>
        <content type="html">&lt;p&gt;&lt;b&gt;
&#21697;&#29260;&#65306;&lt;/b&gt;&#39321;&#28207;&#12304;Oral-2060&#12305;&lt;br /&gt;&lt;b&gt;&#22411;&#21495;&#65306;&lt;/b&gt;UL0111 - &#31505;&#33080;&#21047;&#29273;&#35745;&#26102;&#27801;&#28431;&lt;br /&gt;&lt;b&gt;&#21253;&#35013;&#65306;&lt;/b&gt;&#21333;&#25903;&#25955;;&lt;br /&gt;&lt;b&gt;&#20135;&#21697;&#29305;&#28857;&#65306;&lt;/b&gt;&#31505;&#33080;&#21047;&#29273;&#35745;&#26102;&#27801;&#28431;&#20004;&#21040;&#19977;&#20998;&#38047;-&#31185;&#23398;&#21047;&#29273;&lt;br /&gt;&lt;b&gt;&#20135;&#21697;&#21151;&#33021;&#65306;&lt;/b&gt;&#21487;&#29233;&#31505;&#33080;&#21047;&#29273;&#35745;&#26102;&#27801;&#28431;&#65292;&#20351;&#29992;&#31616;&#21333;&#26041;&#20415;&#65292;&#26356;&#21463;&#23567;&#26379;&#21451;&#38738;&#30544;&#21727;&#12290;&lt;br /&gt;&lt;b&gt;&#21047;&#29273;&#26102;&#38388;&#65306;&lt;/b&gt;&lt;/p&gt;
  &lt;p&gt;&#27599;&#22825;&#24212;&#20570;&#21040;&#26089;&#36215;&#21644;&#26202;&#19978;&#20020;&#30561;&#21069;&#21508;&#21047;&#29273;&#19968;&#27425;&#65292;&#24182;&#22362;&#25345;&#39277;&#21518;&#28465;&#21475;&#12290;&#27599;&#27425;&#21047;&#29273;&#26368;&#23569;2-3&#20998;&#38047;&#25165;&#33021;&#23558;&#29273;&#40831;&#30340;&#21508;&#20010;&#37096;&#20301;&#21047;&#21040;&#12290;&#26202;&#19978;&#30561;&#21069;&#21047;&#29273;&#26356;&#20026;&#37325;&#35201;&#65292;&#22240;&#23427;&#33021;&#28165;&#38500;&#24403;&#26085;&#19977;&#39184;&#31215;&#23384;&#20110;&#29273;&#40831;&#19978;&#30340;&#39135;&#29289;&#27531;&#28195;&#27745;&#22434;&#12290;&#21542;&#21017;&#65292;&#22312;&#22812;&#38388;&#30561;&#30496;&#29366;&#24577;&#19979;&#65292;&#21475;&#33108;&#20869;&#28363;&#29983;&#32454;&#33740;&#65292;&#27745;&#29289;&#19982;&#21822;&#28082;&#30340;&#38041;&#30416;&#27785;&#31215;&#24418;&#25104;&#33740;&#26001;&#21450;&#29273;&#30707;&#65292;&#26085;&#20037;&#20415;&#20250;&#20351;&#29273;&#40831;&#21457;&#29983;&#40843;&#40831;&#21450;&#29273;&#21608;&#30149;&#12290;
&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1432473064412</id>
        <title type="html">1432473064412</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1432473064412"/>
        <published>2015-05-24T21:13:59+08:00</published>
        <updated>2015-05-24T21:13:59+08:00</updated> 
        <category term="/Menus/hots" label="hots" />
        <category term="&#33192;&#32960;&#29273;&#32447;50m" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">&#21697;&#29260;&#65306;&#39321;&#28207;&#12304;Oral-2060&#12305;&lt;br /&gt;&#22411;&#21495;&#65306;UL0036 - &#33192;&#32960;&#29273;&#32447;50M;</summary>
        <content type="html">&#21697;&#29260;&#65306;&#39321;&#28207;&#12304;Oral-2060&#12305;&lt;br /&gt;&#22411;&#21495;&#65306;UL0036 - &#33192;&#32960;&#29273;&#32447;50M;&lt;br /&gt;&#21253;&#35013;&#65306;&#24425;&#34955;;&lt;br /&gt;&#20135;&#21697;&#29305;&#28857;&#65306;&#33192;&#32960;&#29273;&#32447;&#25289;&#32039;&#26102;&#32447;&#21576;&#19968;&#32454;&#32447;&#29366;&#24577;&#65292;&#24403;&#26494;&#24320;&#26102;&#65292;&#32447;&#21576;&#33192;&#32960;&#29366;&#24577;&#26356;&#22909;&#30340;&#28165;&#27905;&#40831;&#38388;&#39135;&#29289;&#39063;&#31890;&#21450;&#36719;&#29273;&#22434;&#31561;;&lt;br /&gt;&#20135;&#21697;&#21151;&#33021;&#65306;&#29273;&#32447;&#26159;&#19968;&#31181;&#26032;&#22411;&#27905;&#40831;&#24037;&#20855;&#65292;&#26159;&#36890;&#36807;&#29273;&#32447;&#26469;&#28165;&#38500;&#29273;&#32541;&#38553;&#20869;&#30340;&#27531;&#30041;&#28195;&#28371;&#20197;&#21450;&#29273;&#40831;&#37051;&#38754;&#30340;&#29273;&#33740;&#26001;&#65292;&#20197;&#20445;&#25345;&#21475;&#33108;&#21355;&#29983;&#12290;&#29273;&#32447;&#30446;&#21069;&#22312;&#21457;&#36798;&#22269;&#23478;&#30340;&#20351;&#29992;&#24050;&#32463;&#26497;&#20026;&#26222;&#36941;&#65292;&#26159;&#20154;&#20204;&#23621;&#23478;&#26053;&#28216;&#19981;&#21487;&#32570;&#23569;&#30340;&#29983;&#27963;&#24517;&#38656;&#21697;&#12290;&lt;br /&gt;&#29992;&#29273;&#32447;&#30340;&#22909;&#22788;&#65306;&lt;br /&gt;1&#65294;&#26580;&#36719;&#32454;&#19997;&#33021;&#36731;&#26131;&#36827;&#20837;&#29273;&#32541;&#65292;&#19981;&#20250;&#36896;&#25104;&#25380;&#21387;&#21147;&#65292;&#19981;&#25439;&#20260;&#29273;&#40831;&#34920;&#38754;&#37321;&#36136;&#12290;&lt;br /&gt;2&#65294;&#23436;&#20840;&#28165;&#38500;&#29273;&#32541;&#38388;&#30340;&#27531;&#30041;&#29289;&#21644;&#33740;&#26001;&#65292;&#26377;&#25928;&#38450;&#27490;&#29273;&#21608;&#30149;&#12290;&lt;br /&gt;3&#65294;&#36890;&#36807;&#20351;&#29992;&#29273;&#32447;&#21487;&#20197;&#25353;&#25705;&#21050;&#28608;&#29273;&#40831;&#21608;&#22260;&#30340;&#29273;&#40840;&#65292;&#22686;&#21152;&#29273;&#40840;&#30340;&#34880;&#28082;&#24490;&#29615;&#65292;&#20174;&#32780;&#36798;&#21040;&#29273;&#40831;&#20445;&#20581;&#30340;&#20316;&#29992;&#12290;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1432301815856</id>
        <title type="html">1432301815856</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1432301815856"/>
        <published>2015-05-22T21:38:52+08:00</published>
        <updated>2015-05-22T21:46:32+08:00</updated> 
        <category term="/Menus/hots" label="hots" />
        <summary type="html">&#21697;&#29260;&#65306;&#39321;&#28207;&#12304;Oral-2060&#12305;&amp;lt;br /&amp;gt;&#22411;&#21495;&#65306;UL0054 - &#21487;&#29233;&#29273;&#21047;&#25265;&#31995;&#21015;;</summary>
        <content type="html">&#21697;&#29260;&#65306;&#39321;&#28207;&#12304;Oral-2060&#12305;&lt;br /&gt;&#22411;&#21495;&#65306;UL0054 - &#21487;&#29233;&#29273;&#21047;&#25265;&#31995;&#21015;;&lt;br /&gt;&#21253;&#35013;&#65306;&#33014;&#34955;;&lt;br /&gt;&#20135;&#21697;&#29305;&#28857;&#65306;&#21487;&#29233;&#29273;&#21047;&#25265;&#21487;&#20197;&#25265;&#29273;&#21047;&#20063;&#21487;&#20197;&#25265;&#31508;&#21727;;&lt;br /&gt;&#20135;&#21697;&#21151;&#33021;&#65306;&#21487;&#29233;&#30340;&#29273;&#21047;&#25265;&#29980;&#29980;&#30340;&#25265;&#30528;&#24744;&#30340;&#29273;&#21047;&#36319;&#24744;&#35828;&#26089;&#23433;&#21602;&#65292;&#29273;&#21047;&#25265;&#30340;&#32972;&#38754;&#21560;&#30424;&#30452;&#24452;3.5CM&#65292;&#21487;&#29282;&#29282;&#30340;&#31896;&#22312;&#29627;&#29827;&#34920;&#38754;&#21727;&#12290;&lt;br /&gt;&#20135;&#21697;&#26448;&#36136;&#65306;PVC&lt;br /&gt;&lt;br /&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1432213360311</id>
        <title type="html">1432213360311</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1432213360311"/>
        <published>2015-05-21T21:05:42+08:00</published>
        <updated>2015-05-21T21:14:35+08:00</updated> 
        <category term="/Menus/hots" label="hots" />
        <summary type="html">&#21697;&#29260;&#65306;&#39321;&#28207;&#12304;Oral-2060&#12305;&lt;br /&gt;&#22411;&#21495;&#65306;UL0138 - &#36229;&#32454;&#28369;&#25153;&#32447;&#29273;&#32447;50M;&lt;br /&gt;&#21253;&#35013;&#65306;&#24425;&#34955;;&lt;br /&gt; &#20135;&#21697;&#29305;&#28857;&#65306;&#32447;&#23485;&#12289;&#25153;&#12289;&#32454;&#28369;&#19981;&#26131;&#36215;&#27611;&#65292;&#26497;&#26131;&#28369;&#20837;&#32039;&#23494;&#30340;&#29273;&#32541;&#20013;;</summary>
        <content type="html">&#21697;&#29260;&#65306;&#39321;&#28207;&#12304;Oral-2060&#12305;&lt;br /&gt;&#22411;&#21495;&#65306;UL0138 - &#36229;&#32454;&#28369;&#25153;&#32447;&#29273;&#32447;50M;&lt;br /&gt;&#21253;&#35013;&#65306;&#24425;&#34955;;&lt;br /&gt;&#20135;&#21697;&#29305;&#28857;&#65306;&#32447;&#23485;&#12289;&#25153;&#12289;&#32454;&#28369;&#19981;&#26131;&#36215;&#27611;&#65292;&#26497;&#26131;&#28369;&#20837;&#32039;&#23494;&#30340;&#29273;&#32541;&#20013;;&lt;br /&gt;&#20135;&#21697;&#21151;&#33021;&#65306;&#29273;&#32447;&#26159;&#19968;&#31181;&#26032;&#22411;&#27905;&#40831;&#24037;&#20855;&#65292;&#26159;&#36890;&#36807;&#29273;&#32447;&#26469;&#28165;&#38500;&#29273;&#32541;&#38553;&#20869;&#30340;&#27531;&#30041;&#28195;&#28371;&#20197;&#21450;&#29273;&#40831;&#37051;&#38754;&#30340;&#29273;&#33740;&#26001;&#65292;&#20197;&#20445;&#25345;&#21475;&#33108;&#21355;&#29983;&#12290;&#29273;&#32447;&#30446;&#21069;&#22312;&#21457;&#36798;&#22269;&#23478;&#30340;&#20351;&#29992;&#24050;&#32463;&#26497;&#20026;&#26222;&#36941;&#65292;&#26159;&#20154;&#20204;&#23621;&#23478;&#26053;&#28216;&#19981;&#21487;&#32570;&#23569;&#30340;&#29983;&#27963;&#24517;&#38656;&#21697;&#12290;&lt;br /&gt;&#29992;&#29273;&#32447;&#30340;&#22909;&#22788;&#65306;&lt;br /&gt;1&#65294;&#26580;&#36719;&#32454;&#19997;&#33021;&#36731;&#26131;&#36827;&#20837;&#29273;&#32541;&#65292;&#19981;&#20250;&#36896;&#25104;&#25380;&#21387;&#21147;&#65292;&#19981;&#25439;&#20260;&#29273;&#40831;&#34920;&#38754;&#37321;&#36136;&#12290;&lt;br /&gt;2&#65294;&#23436;&#20840;&#28165;&#38500;&#29273;&#32541;&#38388;&#30340;&#27531;&#30041;&#29289;&#21644;&#33740;&#26001;&#65292;&#26377;&#25928;&#38450;&#27490;&#29273;&#21608;&#30149;&#12290;&lt;br /&gt;3&#65294;&#36890;&#36807;&#20351;&#29992;&#29273;&#32447;&#21487;&#20197;&#25353;&#25705;&#21050;&#28608;&#29273;&#40831;&#21608;&#22260;&#30340;&#29273;&#40840;&#65292;&#22686;&#21152;&#29273;&#40840;&#30340;&#34880;&#28082;&#24490;&#29615;&#65292;&#20174;&#32780;&#36798;&#21040;&#29273;&#40831;&#20445;&#20581;&#30340;&#20316;&#29992;&#12290;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1431703594080</id>
        <title type="html">1431703594080</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1431703594080"/>
        <published>2015-05-15T23:33:24+08:00</published>
        <updated>2015-05-17T22:21:10+08:00</updated> 
        <category term="/Menus/hots" label="hots" />
        <category term="&#29273;&#32447;&#26834;" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">&#21697;&#29260;&#65306;&#39321;&#28207;&#12304;2060&#12305;&lt;/br&gt;
&#22411;&#21495;&#65306;UL0020Y - Y&#22411;&#29273;&#32447;&#26834;&#12289;&#29273;&#31614;&#20110;&#19968;&#20307;&lt;/br&gt;
&#21253;&#35013;&#65306;30&#25903;&#19968;&#21253;&lt;/br&gt;
&#20135;&#21697;&#29305;&#28857;&#65306;&#29273;&#32447;&#26834;&#12289;&#29273;&#31614;&#20110;&#19968;&#20307; &lt;/br&gt;</summary>
        <content type="html">&#21697;&#29260;&#65306;&#39321;&#28207;&#12304;2060&#12305;&lt;br /&gt;

&#22411;&#21495;&#65306;UL0020Y - Y&#22411;&#29273;&#32447;&#26834;&#12289;&#29273;&#31614;&#20110;&#19968;&#20307;&lt;br /&gt;

&#21253;&#35013;&#65306;30&#25903;&#19968;&#21253;&lt;br /&gt;

&#20135;&#21697;&#29305;&#28857;&#65306;&#29273;&#32447;&#26834;&#12289;&#29273;&#31614;&#20110;&#19968;&#20307; &lt;br /&gt;

&#20135;&#21697;&#21151;&#33021;&#65306;&#29273;&#32447;&#26834;&#26159;&#19968;&#31181;&#26032;&#22411;&#27905;&#40831;&#24037;&#20855;&#65292;&#26159;&#36890;&#36807;&#29273;&#32447;&#26469;&#28165;&#38500;&#29273;&#32541;&#38553;&#20869;&#30340;&#27531;&#30041;&#28195;&#28371;&#20197;&#21450;&#29273;&#40831;&#37051;&#38754;&#30340;&#29273;&#33740;&#26001;&#65292;&#20197;&#20445;&#25345;&#21475;&#33108;&#21355;&#29983;&#12290;&#29273;&#32447;&#30446;&#21069;&#22312;&#21457;&#36798;&#22269;&#23478;&#30340;&#20351;&#29992;&#24050;&#32463;&#26497;&#20026;&#26222;&#36941;&#65292;&#26159;&#20154;&#20204;&#23621;&#23478;&#26053;&#28216;&#19981;&#21487;&#32570;&#23569;&#30340;&#29983;&#27963;&#24517;&#38656;&#21697;&#12290;&lt;br /&gt; 



&#29992;&#29273;&#32447;&#26834;&#30340;&#22909;&#22788;&#65306;&lt;br /&gt;

    1&#65294;&#26580;&#36719;&#32454;&#19997;&#33021;&#36731;&#26131;&#36827;&#20837;&#29273;&#32541;&#65292;&#19981;&#20250;&#36896;&#25104;&#25380;&#21387;&#21147;&#65292;&#19981;&#25439;&#20260;&#29273;&#40831;&#34920;&#38754;&#37321;&#36136;&#12290;&lt;br /&gt;

    2&#65294;&#23436;&#20840;&#28165;&#38500;&#29273;&#32541;&#38388;&#30340;&#27531;&#30041;&#29289;&#21644;&#33740;&#26001;&#65292;&#26377;&#25928;&#38450;&#27490;&#29273;&#21608;&#30149;&#12290;&lt;br /&gt;

    3&#65294;&#36890;&#36807;&#20351;&#29992;&#29273;&#32447;&#21487;&#20197;&#25353;&#25705;&#21050;&#28608;&#29273;&#40831;&#21608;&#22260;&#30340;&#29273;&#40840;&#65292;&#22686;&#21152;&#29273;&#40840;&#30340;&#34880;&#28082;&#24490;&#29615;&#65292;&#20174;&#32780;&#36798;&#21040;&#29273;&#40831;&#20445;&#20581;&#30340;&#20316;&#29992;&#12290;&lt;br /&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1431703331114</id>
        <title type="html">1431703331114</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1431703331114"/>
        <published>2015-05-15T23:23:17+08:00</published>
        <updated>2015-05-15T23:23:17+08:00</updated> 
        <category term="/Menus/aboutus" label="aboutus" />
        <content type="html">&lt;p&gt;&#21271;&#20140;&#19997;&#26704;&#21475;&#33108;&#25252;&#29702;&#29992;&#21697;&#36830;&#38145;&#24215;&#26159;&#22269;&#20869;&#31532;&#19968;&#23478;&#19987;&#19994;&#21475;&#33108;&#25252;&#29702;&#20135;&#21697;&#36830;&#38145;&#24215;&#65292;&#19987;&#19994;&#30340;&#38144;&#21806;&#20154;&#21592;&#65292;&#19987;&#19994;&#30340;&#20135;&#21697;&#65292;&#19987;&#19994;&#30340;&#36816;&#33829;&#22242;&#38431;&#65292;&#19987;&#19994;&#30340;&#25216;&#26415;&#32972;&#26223;&#65292;&#26159;&#23478;&#24237;&#21475;&#33108;&#20581;&#24247;&#30340;&#20513;&#23548;&#32773;&#12290;&lt;/p&gt;
  &lt;p&gt;&lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/6c4786fe-a0bf-499d-a9b0-455923ab593b&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/6c4786fe-a0bf-499d-a9b0-455923ab593b?t=true&quot; alt=&quot;page 1.jpg&quot; /&gt;&lt;/a&gt; &lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1431703062349</id>
        <title type="html">1431703062349</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1431703062349"/>
        <published>2015-05-15T23:21:04+08:00</published>
        <updated>2015-05-15T23:21:04+08:00</updated> 
        <category term="/Menus/contactus" label="contactus" />
        <content type="html">&lt;div&gt;&lt;font size=&quot;3&quot;&gt;&lt;b&gt;&#21271;&#20140;&#19997;&#26704;&#38632;&#38706;&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;
  &lt;div&gt;&#21271;&#20140;&#24066;&#28023;&#28096;&#21306;&#22823;&#38047;&#23546;&#20013;&#22372;&#24191;&#22330;c&#24231;&lt;/div&gt;
  &lt;div&gt;&#30005;&#35805;/&#24494;&#20449;&#65306;18515439223&lt;/div&gt;
  &lt;div&gt;&#33829;&#19994;&#26102;&#38388;&#65306; 10&#65306;00 AM ~5:00 PM&lt;/div&gt;
  &lt;div&gt;&#30005;&#23376;&#37038;&#31665;&#65306;805863956@qq.com&lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/homeslides</id>
        <title type="html">homeslides</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/homeslides"/>
        <published>2015-05-15T23:12:10+08:00</published>
        <updated>2015-05-17T20:40:31+08:00</updated> 
        <category term="/&#20854;&#20182;" label="&#20854;&#20182;" />
        <content type="html">&lt;li style=&quot;width: 1011px; float: left; display: block;&quot; data-thumb=&quot;http://oral2060.oss-cn-qingdao.aliyuncs.com/app/03838987-acdd-4709-8ff0-6a866de97d14&quot;&gt;&lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/6c4786fe-a0bf-499d-a9b0-455923ab593b&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/6c4786fe-a0bf-499d-a9b0-455923ab593b?t=true&quot; alt=&quot;page 1.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
  &lt;li style=&quot;width: 1011px; float: left; display: block;&quot; data-thumb=&quot;http://oral2060.oss-cn-qingdao.aliyuncs.com/app/03838987-acdd-4709-8ff0-6a866de97d14&quot;&gt; &lt;img draggable=&quot;false&quot; src=&quot;http://oral2060.oss-cn-qingdao.aliyuncs.com/app/03838987-acdd-4709-8ff0-6a866de97d14&quot; /&gt; &lt;/li&gt; 
  &lt;li style=&quot;width: 1011px; float: left; display: block;&quot; data-thumb=&quot;http://oral2060.oss-cn-qingdao.aliyuncs.com/app/4cf5ad58-be9d-499d-aad5-1dc10420e2d8&quot;&gt; &lt;img draggable=&quot;false&quot; src=&quot;http://oral2060.oss-cn-qingdao.aliyuncs.com/app/4cf5ad58-be9d-499d-aad5-1dc10420e2d8&quot; /&gt; &lt;/li&gt; 
  &lt;li class=&quot;am-active-slide&quot; style=&quot;width: 1011px; float: left; display: block;&quot; data-thumb=&quot;http://oral2060.oss-cn-qingdao.aliyuncs.com/app/1191e178-9ee5-4922-a3a2-01538d7509f0&quot;&gt; &lt;img draggable=&quot;false&quot; src=&quot;http://oral2060.oss-cn-qingdao.aliyuncs.com/app/1191e178-9ee5-4922-a3a2-01538d7509f0&quot; /&gt; &lt;/li&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1431435113068</id>
        <title type="html">1431435113068</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1431435113068"/>
        <published>2015-05-12T20:53:10+08:00</published>
        <updated>2015-05-13T12:14:52+08:00</updated> 
        <category term="/Menus/hots" label="hots" />
        <summary type="html">UL00010-- 40M &#25252;&#29702;&#29273;&#32447;&#24102;&#38236;
&#21253;&#35013; : &#27599;&#19968;&#20010;&#20135;&#21697;&#19968;&#20010;OPP&#34955;
&#23610;&#23544;&#21253;&#35013; :8.6cm Lx5.4cm W x0.5cm H 
&#20135;&#21697;&#26448;&#36136;: ABS </summary>
        <content type="html">UL00010-- 40M &#25252;&#29702;&#29273;&#32447;&#24102;&#38236;
&#21253;&#35013; : &#27599;&#19968;&#20010;&#20135;&#21697;&#19968;&#20010;OPP&#34955;
&#23610;&#23544;&#21253;&#35013; :8.6cm Lx5.4cm W x0.5cm H 
&#20135;&#21697;&#26448;&#36136;: ABS 

&#20851;&#20110;&#29273;&#32447;&#30340;&#20351;&#29992;&#65306; 

      &#29273;&#33740;&#26001;&#22823;&#22810;&#22534;&#31215;&#22312;&#29273;&#40831;&#30340;&#37051;&#25509;&#38754;&#21450;&#29273;&#40840;&#36793;&#32536;&#65292;&#32780;&#36825;&#20123;&#21306;&#22495;&#23601;&#25104;&#20026;&#40843;&#30149;&#21644;&#29273;&#21608;&#30149;&#30340;&#22909;&#21457;&#37096;&#20301;&#12290; 
&#21047;&#29273;&#19968;&#33324;&#21482;&#33021;&#28165;&#27905;&#29273;&#40831;&#30340;&#39050;&#38754;&#21450;&#39050;&#33292;&#38754;&#65292;&#38590;&#20197;&#28165;&#38500;&#37051;&#25509;&#38754;&#30340;&#29273;&#33740;&#26001;&#65292;&#22240;&#27492;&#38656;&#35201;&#37319;&#29992;&#19968;&#20123;&#29305;&#27530;&#30340;&#29273;&#38388;&#28165;&#27905;&#22120;&#22914;&#29273;&#32447;&#12289;&#29273;&#31614;&#31561;&#20197;&#24357;&#34917;&#21047;&#29273;&#30340;&#19981;&#36275;. 

&#22823;&#22810;&#25968;&#22269;&#22806;&#19987;&#23478;&#24314;&#35758;&#22312;&#22823;&#22810;&#25968;&#24658;&#29273;&#33804;&#20986;&#21518;&#32422;12&#23681;&#24038;&#21491;&#65292;&#23601;&#24212;&#20351;&#29992;&#29273;&#32447;&#12290;&#20351;&#29992;&#29273;&#32447;&#26159;&#21435;&#38500;&#29273;&#38388;&#38553;&#33740;&#26001;&#26368;&#22909;&#30340;&#26041;&#27861;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1431434987347</id>
        <title type="html">1431434987347</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1431434987347"/>
        <published>2015-05-12T20:50:50+08:00</published>
        <updated>2015-05-15T23:16:14+08:00</updated> 
        <category term="/Menus/news" label="news" />
        <summary type="html">&#22914;&#20309;&#25165;&#33021;&#20570;&#21040;&#30495;&#27491;&#29233;&#25252;&#29273;&#40831;&#65311;</summary>
        <content type="html">&#20919;&#30340;&#37240;&#30340;&#65292;&#19968;&#21507;&#29273;&#40831;&#23601;&#30140;&#65311;&#37027;&#35828;&#26126;&#20320;&#24212;&#35813;&#27880;&#24847;&#20445;&#25252;&#29273;&#40831;&#20102;,&#20813;&#24471;&#32769;&#25481;&#29273;&lt;br /&gt; &lt;br /&gt;
1 / 6 ,&#24403;&#35753;&#26159;&#21047;&#29273;&#65292;&#24314;&#35758;&#26089;&#26202;&#19968;&#27425;&#65292;&#26202;&#19978;&#37325;&#35201;&#65292;&#28165;&#29702;&#30333;&#22825;&#30340;&#39135;&#29289;&#27531;&#28195;&#65292;&#26202;&#19978;&#21047;&#29273;&#20320;&#20250;&#21457;&#29616;&#31532;&#20108;&#22825;&#21018;&#36215;&#26469;&#26377;&#28857;&#21475;&#33261;.
&lt;br /&gt; &lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/03843efb-0786-45d9-84f7-abebc8e98a9e&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/03843efb-0786-45d9-84f7-abebc8e98a9e?t=true&quot; alt=&quot;11.png&quot; /&gt;&lt;/a&gt;
2/ 6, &#36873;&#25321;&#36719;&#27611;&#30340;&#29273;&#21047;&#12290;&#38271;&#26399;&#20351;&#29992;&#30828;&#27611;&#29273;&#21047;&#20250;&#25439;&#27585;&#25105;&#20204;&#29273;&#40831;&#34920;&#38754;&#65292;&#29273;&#21047;&#26368;&#22909;&#19977;&#20010;&#26376;&#25442;&#19968;&#27425;.
&lt;br /&gt; &lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/893bccc0-1573-47a6-a503-02bfa2733b0c&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/893bccc0-1573-47a6-a503-02bfa2733b0c?t=true&quot; alt=&quot;55.png&quot; /&gt;&lt;/a&gt;
3 /6, &#23569;&#29992;&#29273;&#31614;&#65292;&#29273;&#31614;&#20250;&#20351;&#20320;&#30340;&#29273;&#32541;&#36234;&#26469;&#36234;&#22810;&#12290;&#36319;&#23481;&#26131;&#22622;&#29273;,&#20320;&#20250;&#36234;&#26469;&#36234;&#31163;&#19981;&#24320;&#29273;&#31614;&#65292;&#23548;&#33268;&#29273;&#32541;&#36234;&#26469;&#36234;&#22823;.
&lt;br /&gt; &lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/dc64423f-e3d7-47dc-b5f0-5a8d9c1c1c2c&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/dc64423f-e3d7-47dc-b5f0-5a8d9c1c1c2c?t=true&quot; alt=&quot;2.png&quot; /&gt;&lt;/a&gt;
4 /6,  &#23569;&#21917;&#30899;&#37240;&#39278;&#26009;&#12290;&#22914;&#26524;&#20320;&#21644;&#21916;&#27426;&#21917;&#39278;&#26009;&#12290;&#37027;&#35201;&#27880;&#24847;&#20102;&#65292;&#37027;&#37240;&#24615;&#20250;&#33104;&#34432;&#29273;&#40831;&#34920;&#38754;&#12290;&#21547;&#22823;&#37327;&#30967;&#12290;&#35753;&#38041;&#24555;&#36895;&#27969;&#22833;&#20250;&#24739;&#39592;&#36136;&#30095;&#26494;, &#25152;&#20197;&#20026;&#20102;&#20581;&#24247;&#36824;&#26159;&#23569;&#21917;&#21543;
&lt;br /&gt; &lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/2758ef27-b85d-4c4a-9850-920a978dc53f&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/2758ef27-b85d-4c4a-9850-920a978dc53f?t=true&quot; alt=&quot;22.png&quot; /&gt;&lt;/a&gt;
5 / 6, &#23569;&#21507;&#29980;&#39135;&#65292;&#20250;&#27531;&#30041;&#29273;&#32541;&#65292;&#34496;&#29273;&#65292;&#21518;&#24724;&#37117;&#26469;&#19981;&#21450;&#12290;&#21507;&#23436;&#21047;&#29273;&#65292;&#20943;&#23569;&#27531;&#30041;&#29273;&#32541;&#30340;&#27531;&#30041;&#65292;&#38450;&#34496;&#29273;&#24456;&#37325;&#35201;.
&lt;br /&gt; &lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/887e32a5-eb1d-446a-84be-a1a27596cb67&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/887e32a5-eb1d-446a-84be-a1a27596cb67?t=true&quot; alt=&quot;33.png&quot; /&gt;&lt;/a&gt;
6 / 6, &#22810;&#21917;&#27700;&#65292;&#21487;&#20197;&#28165;&#29702;&#21475;&#33108;&#65292;&#29273;&#40831;&#24178;&#20928;&#65292;&#20445;&#25345;&#29273;&#40831;&#24178;&#20928;&#24456;&#37325;&#35201;&#65292;&#39277;&#21518;&#21917;&#27700;&#19981;&#35201;&#21917;&#22810;&#20250;&#23548;&#33268;&#28040;&#21270;&#19981;&#33391;.

&lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/6c4786fe-a0bf-499d-a9b0-455923ab593b&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sitongyulu/6c4786fe-a0bf-499d-a9b0-455923ab593b?t=true&quot; alt=&quot;page 1.jpg&quot; /&gt;&lt;/a&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sitongyulu/entry/1431434826294</id>
        <title type="html">1431434826294</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sitongyulu/entry/1431434826294"/>
        <published>2015-05-12T20:49:14+08:00</published>
        <updated>2015-05-15T23:01:55+08:00</updated> 
        <category term="/Menus/kouqiangkuiyang" label="kouqiangkuiyang" />
        <summary type="html">&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;</summary>
        <content type="html">&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;&#21495;&#22806;&#65292;&#25105;&#20204;&#24314;&#35774;&#20102;&#19968;&#20010;&#26032;&#30340;&#32593;&#31449;&#65292;&#27426;&#36814;&#22823;&#23478;&#20809;&#20020;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter01</id>
        <title type="html">chapter01</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter01"/>
        <published>2015-02-26T23:33:45+08:00</published>
        <updated>2015-02-26T23:33:45+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;django&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#19968;&#31456;&#65306;&#20171;&#32461;Django&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#26412;&#20070;&#25152;&#35762;&#30340;&#26159;Django&#65306;&#19968;&#20010;&#21487;&#20197;&#20351;Web&#24320;&#21457;&#24037;&#20316;&#24841;&#24555;&#24182;&#19988;&#39640;&#25928;&#30340;Web&#24320;&#21457;&#26694;&#26550;&#12290; &#20351;&#29992;Django&#65292;&#20351;&#20320;&#33021;&#22815;&#20197;&#26368;&#23567;&#30340;&#20195;&#20215;&#26500;&#24314;&#21644;&#32500;&#25252;&#39640;&#36136;&#37327;&#30340;Web&#24212;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#20174;&#22909;&#30340;&#26041;&#38754;&#26469;&#30475;&#65292;Web &#24320;&#21457;&#28608;&#21160;&#20154;&#24515;&#19988;&#23500;&#20110;&#21019;&#36896;&#24615;&#65307;&#20174;&#21478;&#19968;&#38754;&#26469;&#30475;&#65292;&#23427;&#21364;&#26159;&#20221;&#32321;&#29712;&#32780;&#20196;&#20154;&#29983;&#21388;&#30340;&#24037;&#20316;&#12290; &#36890;&#36807;&#20943;&#23569;&#37325;&#22797;&#30340;&#20195;&#30721;&#65292;Django &#20351;&#20320;&#33021;&#22815;&#19987;&#27880;&#20110; Web &#24212;&#29992;&#19978;&#26377; &#36259;&#30340;&#20851;&#38190;&#24615;&#30340;&#19996;&#35199;&#12290;
&#20026;&#20102;&#36798;&#21040;&#36825;&#20010;&#30446;&#26631;&#65292;Django &#25552;&#20379;&#20102;&#36890;&#29992;Web&#24320;&#21457;&#27169;&#24335;&#30340;&#39640;&#24230;&#25277;&#35937;&#65292;&#25552;&#20379;&#20102;&#39057;&#32321;&#36827;&#34892;&#30340;&#32534;&#31243;&#20316;&#19994;&#30340;&#24555;&#36895;&#35299;&#20915;&#26041;&#27861;&#65292;&#20197;&#21450;&#20026;&#8220;&#22914;&#20309;&#35299;&#20915;&#38382;&#39064;&#8221;&#25552;&#20379;&#20102;&#28165;&#26224;&#26126;&#20102;&#30340;&#32422;&#23450;&#12290; &#21516;&#26102;&#65292;Django &#23581;&#35797;&#30041;&#19979;&#19968;&#20123;&#26041;&#27861;&#65292;&#26469;&#35753;&#20320;&#26681;&#25454;&#38656;&#35201;&#22312;framework&#20043;&#22806;&#26469;&#24320;&#21457;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#26412;&#20070;&#30340;&#30446;&#30340;&#26159;&#23558;&#20320;&#22521;&#20859;&#25104;Django&#19987;&#23478;&#12290; &#20027;&#35201;&#20391;&#37325;&#20110;&#20004;&#26041;&#38754;&#65306;
&#31532;&#19968;&#65292;&#25105;&#20204;&#28145;&#24230;&#35299;&#37322; Django &#21040;&#24213;&#20570;&#20102;&#21738;&#20123;&#24037;&#20316;&#20197;&#21450;&#22914;&#20309;&#29992;&#22905;&#26500;&#24314;Web&#24212;&#29992;&#65307;&#31532;&#20108;&#65292;&#25105;&#20204;&#23558;&#20250;&#22312;&#36866;&#24403;&#30340;&#22320;&#26041;&#35752;&#35770;&#26356;&#39640;&#32423;&#30340;&#27010;&#24565;&#65292;&#24182;&#35299;&#37322;&#22914;&#20309; &#22312;&#33258;&#24049;&#30340;&#39033;&#30446;&#20013;&#39640;&#25928;&#30340;&#20351;&#29992;&#36825;&#20123;&#24037;&#20855;&#12290; &#36890;&#36807;&#38405;&#35835;&#27492;&#20070;&#65292;&#20320;&#23558;&#23398;&#20250;&#24555;&#36895;&#24320;&#21457;&#21151;&#33021;&#24378;&#22823;&#32593;&#31449;&#30340;&#25216;&#24039;&#65292;&#24182;&#19988;&#20320;&#30340;&#20195;&#30721;&#23558;&#20250;&#21313;&#20998; &#28165;&#26224;&#65292;&#26131;&#20110;&#32500;&#25252;&#12290; &#26412;&#20070;&#30340;&#20195;&#30721;&#28165;&#26224;&#65292;&#26131;&#32500;&#25252;&#65292;&#36890;&#36807;&#23398;&#20064;&#65292;&#21487;&#20197;&#24555;&#36895;&#24320;&#21457;&#21151;&#33021;&#24378;&#22823;&#30340;&#32593;&#31449;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id1&quot;&gt;
&lt;span id=&quot;cn4&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#26694;&#26550;&#26159;&#20160;&#40636;?&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;Django &#22312;&#26032;&#19968;&#20195;&#30340; &lt;em&gt;Web&#26694;&#26550;&lt;/em&gt; &#20013;&#38750;&#24120;&#20986;&#33394;&#65292;&#20026;&#20160;&#20040;&#36825;&#20040;&#35828;&#21602;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&#20026;&#22238;&#31572;&#35813;&#38382;&#39064;&#65292;&#35753;&#25105;&#20204;&#32771;&#34385;&#19968;&#19979;&lt;em&gt;&#19981;&#20351;&#29992;&lt;/em&gt;&#26694;&#26550;&#35774;&#35745; Python &#32593;&#39029;&#24212;&#29992;&#31243;&#24207;&#30340;&#24773;&#24418;&#12290; &#36143;&#31359;&#25972;&#26412;&#20070;&#65292;&#25105;&#20204;&#22810;&#27425;&#23637;&#31034;&#19981;&#20351;&#29992;&#26694;&#26550;&#23454;&#29616;&#32593;&#31449;&#22522;&#26412;&#21151;&#33021;&#30340;&#26041;&#27861;&#65292;&#35753;&#35835;&#32773;&#35748;&#35782;&#21040;&#26694;&#26550;&#24320;&#21457;&#30340;&#26041;&#20415;&#12290; &#65288;&#19981;&#20351;&#29992;&#26694;&#26550;&#65292;&#26356;&#22810;&#24773;&#20917;&#26159;&#27809;&#26377;&#21512;&#36866;&#30340;&#26694;&#26550;&#21487;&#29992;&#12290; &#26368;&#37325;&#35201;&#30340;&#26159;&#65292;&#29702;&#35299;&#23454;&#29616;&#30340;&#26469;&#40857;&#21435;&#33033;&#20250;&#20351;&#20320;&#25104;&#20026;&#19968;&#20010;&#20248;&#31168;&#30340;web&#24320;&#21457;&#32773;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#20351;&#29992;Python&#24320;&#21457;Web&#65292;&#26368;&#31616;&#21333;&#65292;&#21407;&#22987;&#21644;&#30452;&#25509;&#30340;&#21150;&#27861;&#26159;&#20351;&#29992;CGI&#26631;&#20934;&#65292;&#22312;1998&#24180;&#36825;&#31181;&#26041;&#24335;&#24456;&#27969;&#34892;&#12290; &#29616;&#22312;&#20174;&#24212;&#29992;&#35282;&#24230;&#35299;&#37322;&#23427;&#26159;&#22914;&#20309;&#24037;&#20316;&#65306; &#39318;&#20808;&#20570;&#19968;&#20010;Python&#33050;&#26412;&#65292;&#36755;&#20986;HTML&#20195;&#30721;&#65292;&#28982;&#21518;&#20445;&#23384;&#25104;.cgi&#25193;&#23637;&#21517;&#30340;&#25991;&#20214;&#65292;&#36890;&#36807;&#27983;&#35272;&#22120;&#35775;&#38382;&#27492;&#25991;&#20214;&#12290; &#23601;&#26159;&#36825;&#26679;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#22914;&#19979;&#31034;&#20363;&#65292;&#29992;Python CGI&#33050;&#26412;&#26174;&#31034;&#25968;&#25454;&#24211;&#20013;&#26368;&#26032;&#20986;&#29256;&#30340;10&#26412;&#20070;&#65306; &#19981;&#29992;&#20851;&#24515;&#35821;&#27861;&#32454;&#33410;&#65307;&#20165;&#20165;&#24863;&#35273;&#19968;&#19979;&#22522;&#26412;&#23454;&#29616;&#30340;&#26041;&#27861;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn10&quot;&gt;#!/usr/bin/env python

import MySQLdb

print &quot;Content-Type: text/html\n&quot;
print &quot;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Books&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&quot;
print &quot;&amp;lt;body&amp;gt;&quot;
print &quot;&amp;lt;h1&amp;gt;Books&amp;lt;/h1&amp;gt;&quot;
print &quot;&amp;lt;ul&amp;gt;&quot;

connection = MySQLdb.connect(user=&apos;me&apos;, passwd=&apos;letmein&apos;, db=&apos;my_db&apos;)
cursor = connection.cursor()
cursor.execute(&quot;SELECT name FROM books ORDER BY pub_date DESC LIMIT 10&quot;)

for row in cursor.fetchall():
    print &quot;&amp;lt;li&amp;gt;%s&amp;lt;/li&amp;gt;&quot; % row[0]

print &quot;&amp;lt;/ul&amp;gt;&quot;
print &quot;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot;

connection.close()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#39318;&#20808;&#65292;&#29992;&#25143;&#35831;&#27714;CGI&#65292;&#33050;&#26412;&#20195;&#30721;&#25171;&#21360;Content-Type&#34892;&#65292;&#21518;&#38754;&#36319;&#30528;&#25442;&#34892;&#12290; &#20877;&#25509;&#19979; &#26469;&#26159;&#19968;&#20123;HTML&#30340;&#36215;&#22987;&#26631;&#31614;&#65292;&#28982;&#21518;&#36830;&#25509;&#25968;&#25454;&#24211;&#24182;&#25191;&#34892;&#19968;&#20123;&#26597;&#35810;&#25805;&#20316;&#65292;&#33719;&#21462;&#26368;&#26032;&#30340;&#21313;&#26412;&#20070;&#12290;
&#22312;&#36941;&#21382;&#36825;&#20123;&#20070;&#30340;&#21516;&#26102;&#65292;&#29983;&#25104;&#19968;&#20010;&#20070;&#21517;&#30340;HTML&#21015;&#34920;&#39033;&#12290; &#26368;&#21518;&#65292;&#36755;&#20986;HTML&#30340;&#32467;&#26463;&#26631;&#31614;&#24182;&#19988;&#20851;&#38381;&#25968;&#25454;&#24211;&#36830;&#25509;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&#20687;&#36825;&#26679;&#30340;&#19968;&#27425;&#24615;&#30340;&#21160;&#24577;&#39029;&#38754;&#65292;&#20174;&#22836;&#20889;&#36215;&#30340;&#26041;&#27861;&#24182;&#38750;&#19968;&#23450;&#19981;&#22909;&#12290; &#20854;&#20013;&#19968;&#28857;&#65306; &#36825;&#20123;&#20195;&#30721;&#31616;&#21333;&#26131;&#25026;&#65292;&#23601;&#31639;&#26159;&#19968;&#20010;&#21021;&#36215;&#27493;&#30340; &#24320;&#21457;&#32773;&#37117;&#33021;&#35835;&#26126;&#30333;&#36825;16&#34892;&#30340;Python&#30340;&#20195;&#30721;&#65292;&#32780;&#19988;&#36825;&#20123;&#20195;&#30721;&#20174;&#22836;&#21040;&#23614;&#20570;&#20102;&#20160;&#20040;&#37117;&#33021;&#20102;&#35299;&#24471;&#19968;&#28165;&#20108;&#26970;&#12290;
&#19981;&#38656;&#35201;&#23398;&#20064;&#39069;&#22806; &#30340;&#32972;&#26223;&#30693;&#35782;&#65292;&#27809;&#26377;&#39069;&#22806;&#30340;&#20195;&#30721;&#38656;&#35201;&#21435;&#20102;&#35299;&#12290; &#21516;&#26679;&#65292;&#20063;&#26131;&#20110;&#37096;&#32626;&#36825;16&#34892;&#20195;&#30721;&#65292;&#21482;&#38656;&#35201;&#23558;&#23427;&#20445;&#23384;&#20026;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;latestbooks.cgi&lt;/span&gt;&lt;/tt&gt; &#30340; &#25991;&#20214;&#65292;&#19978;&#20256;&#21040;&#32593;&#32476;&#26381;&#21153;&#22120;&#19978;&#65292;&#36890;&#36807;&#27983;&#35272;&#22120;&#35775;&#38382;&#21363;&#21487;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&#23613;&#31649;&#23454;&#29616;&#24456;&#31616;&#21333;&#65292;&#36824;&#26159;&#26292;&#38706;&#20102;&#19968;&#20123;&#38382;&#39064;&#21644;&#19981;&#20415;&#30340;&#22320;&#26041;&#12290; &#38382;&#20320;&#33258;&#24049;&#36825;&#20960;&#20010;&#38382;&#39064;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn14&quot;&gt;&#24212;&#29992;&#20013;&#26377;&#22810;&#22788;&#38656;&#35201;&#36830;&#25509;&#25968;&#25454;&#24211;&#20250;&#24590;&#26679;&#21602;&#65311; &#27599;&#20010;&#29420;&#31435;&#30340;CGI&#33050;&#26412;&#65292;&#19981;&#24212;&#35813;&#37325;&#22797;&#20889;&#25968;&#25454;&#24211;&#36830;&#25509;&#30340;&#20195;&#30721;&#12290; &#27604;&#36739;&#23454;&#29992;&#30340;&#21150;&#27861;&#26159;&#20889;&#19968;&#20010;&#20849;&#20139;&#20989;&#25968;&#65292;&#21487;&#34987;&#22810;&#20010;&#20195;&#30721;&#35843;&#29992;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn15&quot;&gt;&#19968;&#20010;&#24320;&#21457;&#20154;&#21592; &lt;em&gt;&#30830;&#23454;&lt;/em&gt; &#38656;&#35201;&#21435;&#20851;&#27880;&#22914;&#20309;&#36755;&#20986;Content-Type&#20197;&#21450;&#23436;&#25104;&#25152;&#26377;&#25805;&#20316;&#21518;&#21435;&#20851;&#38381;&#25968;&#25454; &#24211;&#20040;&#65311; &#27492;&#31867;&#38382;&#39064;&#21482;&#20250;&#38477;&#20302;&#24320;&#21457;&#20154;&#21592;&#30340;&#24037;&#20316;&#25928;&#29575;&#65292;&#22686;&#21152;&#29359;&#38169;&#35823;&#30340;&#20960;&#29575;&#12290; &#37027;&#20123;&#21021;&#22987;&#21270;&#21644;&#37322;&#25918; &#30456;&#20851;&#30340;&#24037;&#20316;&#24212;&#35813;&#20132;&#32473;&#19968;&#20123;&#36890;&#29992;&#30340;&#26694;&#26550;&#26469;&#23436;&#25104;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn16&quot;&gt;&#22914;&#26524;&#36825;&#26679;&#30340;&#20195;&#30721;&#34987;&#37325;&#29992;&#21040;&#19968;&#20010;&#22797;&#21512;&#30340;&#29615;&#22659;&#20013;&#20250;&#21457;&#29983;&#20160;&#20040;&#65311; &#27599;&#20010;&#39029;&#38754;&#37117;&#20998;&#21035;&#23545;&#24212;&#29420;&#31435;&#30340;&#25968;&#25454;&#24211;&#21644;&#23494;&#30721;&#21527;&#65311;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn17&quot;&gt;&#22914;&#26524;&#19968;&#20010;Web&#35774;&#35745;&#24072;&#65292;&#23436;&#20840;&#27809;&#26377;Python&#24320;&#21457;&#32463;&#39564;&#65292;&#20294;&#26159;&#21448;&#38656;&#35201;&#37325;&#26032;&#35774;&#35745;&#39029;&#38754;&#30340;&#35805;&#65292;&#21448;&#23558; &#21457;&#29983;&#20160;&#20040;&#21602;&#65311; &#19968;&#20010;&#23383;&#31526;&#20889;&#38169;&#20102;&#65292;&#21487;&#33021;&#23548;&#33268;&#25972;&#20010;&#24212;&#29992;&#23849;&#28291;&#12290; &#29702;&#24819;&#30340;&#24773;&#20917;&#26159;&#65292;&#39029;&#38754;&#26174;&#31034;&#30340;&#36923;&#36753;&#19982;&#20174;&#25968;&#25454;&#24211;&#20013;&#35835;&#21462;&#20070;&#26412;&#35760;&#24405;&#20998;&#38548;&#24320;&#65292;&#36825;&#26679; Web&#35774;&#35745;&#24072;&#30340;&#37325;&#26032;&#35774;&#35745;&#19981;&#20250;&#24433;&#21709;&#21040;&#20043;&#21069;&#30340;&#19994;&#21153;&#36923;&#36753;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#20197;&#19978;&#27491;&#26159;Web&#26694;&#26550;&#33268;&#21147;&#20110;&#35299;&#20915;&#30340;&#38382;&#39064;&#12290; Web&#26694;&#26550;&#20026;&#24212;&#29992;&#31243;&#24207;&#25552;&#20379;&#20102;&#19968;&#22871;&#31243;&#24207;&#26694;&#26550;&#65292; &#36825;&#26679;&#20320;&#21487;&#20197;&#19987;&#27880;&#20110;&#32534;&#20889;&#28165;&#26224;&#12289;&#26131;&#32500;&#25252;&#30340;&#20195;&#30721;&#65292;&#32780;&#26080;&#38656;&#20174;&#22836;&#20570;&#36215;&#12290; &#31616;&#21333;&#26469;&#35828;&#65292;&#36825;&#23601;&#26159;Django&#25152;&#33021;&#20570;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;mvc&quot;&gt;
&lt;span id=&quot;cn19&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn19&quot;&gt;MVC &#35774;&#35745;&#27169;&#24335;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#35753;&#25105;&#20204;&#26469;&#30740;&#31350;&#19968;&#20010;&#31616;&#21333;&#30340;&#20363;&#23376;&#65292;&#36890;&#36807;&#35813;&#23454;&#20363;&#65292;&#20320;&#21487;&#20197;&#20998;&#36776;&#20986;&#65292;&#36890;&#36807;Web&#26694;&#26550;&#26469;&#23454;&#29616;&#30340;&#21151;&#33021;&#19982;&#20043;&#21069;&#30340;&#26041;&#24335;&#26377;&#20309;&#19981;&#21516;&#12290; &#19979;&#38754;&#23601;&#26159;&#36890;&#36807;&#20351;&#29992;Django&#26469;&#23436;&#25104;&#20197;&#19978;&#21151;&#33021;&#30340;&#20363;&#23376;&#65306; &#39318;&#20808;&#65292;&#25105;&#20204;&#20998;&#25104;4&#20010;Python&#30340;&#25991;&#20214;&#65292;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;models.py&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;views.py&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urls.py&lt;/span&gt;&lt;/tt&gt; ) &#21644;html&#27169;&#26495;&#25991;&#20214; (&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;latest_books.html&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn22&quot;&gt;# models.py (the database tables)

from django.db import models

class Book(models.Model):
    name = models.CharField(max_length=50)
    pub_date = models.DateField()


# views.py (the business logic)

from django.shortcuts import render_to_response
from models import Book

def latest_books(request):
    book_list = Book.objects.order_by(&apos;-pub_date&apos;)[:10]
    return render_to_response(&apos;latest_books.html&apos;, {&apos;book_list&apos;: book_list})


# urls.py (the URL configuration)

from django.conf.urls.defaults import *
import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^latest/$&apos;, views.latest_books),
)


# latest_books.html (the template)

&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Books&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;h1&amp;gt;Books&amp;lt;/h1&amp;gt;
&amp;lt;ul&amp;gt;
{% for book in book_list %}
&amp;lt;li&amp;gt;{{ book.name }}&amp;lt;/li&amp;gt;
{% endfor %}
&amp;lt;/ul&amp;gt;
&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#28982;&#21518;&#65292;&#19981;&#29992;&#20851;&#24515;&#35821;&#27861;&#32454;&#33410;&#65307;&#21482;&#35201;&#29992;&#24515;&#24863;&#35273;&#25972;&#20307;&#30340;&#35774;&#35745;&#12290; &#36825;&#37324;&#21482;&#20851;&#27880;&#20998;&#21106;&#21518;&#30340;&#20960;&#20010;&#25991;&#20214;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn24&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;models.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#20027;&#35201;&#29992;&#19968;&#20010; Python &#31867;&#26469;&#25551;&#36848;&#25968;&#25454;&#34920;&#12290; &#31216;&#20026; &lt;em&gt;&#27169;&#22411;(model)&lt;/em&gt; &#12290; &#36816;&#29992;&#36825;&#20010;&#31867;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;&#31616;&#21333;&#30340; Python &#30340;&#20195;&#30721;&#26469;&#21019;&#24314;&#12289;&#26816;&#32034;&#12289;&#26356;&#26032;&#12289;&#21024;&#38500; &#25968;&#25454;&#24211;&#20013;&#30340;&#35760;&#24405;&#32780;&#26080;&#38656;&#20889;&#19968;&#26465;&#21448;&#19968;&#26465;&#30340;SQL&#35821;&#21477;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn25&quot;&gt;views.py&#25991;&#20214;&#21253;&#21547;&#20102;&#39029;&#38754;&#30340;&#19994;&#21153;&#36923;&#36753;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;latest_books()&lt;/span&gt;&lt;/tt&gt;&#20989;&#25968;&#21483;&#20570;&lt;em&gt;&#35270;&#22270;&lt;/em&gt;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn26&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urls.py&lt;/span&gt;&lt;/tt&gt; &#25351;&#20986;&#20102;&#20160;&#20040;&#26679;&#30340; URL &#35843;&#29992;&#20160;&#20040;&#30340;&#35270;&#22270;&#12290; &#22312;&#36825;&#20010;&#20363;&#23376;&#20013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/latest/&lt;/span&gt;&lt;/tt&gt; URL &#23558;&#20250;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;latest_books()&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#20989;&#25968;&#12290; &#25442;&#21477;&#35805;&#35828;&#65292;&#22914;&#26524;&#20320;&#30340;&#22495;&#21517;&#26159;example.com&#65292;&#20219;&#20309;&#20154;&#27983;&#35272;&#32593;&#22336;&lt;a class=&quot;reference external&quot; href=&quot;http://example.com/latest/&quot;&gt;http://example.com/latest/&lt;/a&gt;&#23558;&#20250;&#35843;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;latest_books()&lt;/span&gt;&lt;/tt&gt;&#36825;&#20010;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn27&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;latest_books.html&lt;/span&gt;&lt;/tt&gt; &#26159; html &#27169;&#26495;&#65292;&#23427;&#25551;&#36848;&#20102;&#36825;&#20010;&#39029;&#38754;&#30340;&#35774;&#35745;&#26159;&#22914;&#20309;&#30340;&#12290; &#20351;&#29992;&#24102;&#22522;&#26412;&#36923;&#36753;&#22768;&#26126;&#30340;&#27169;&#26495;&#35821;&#35328;&#65292;&#22914;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;book&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;book_list&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&#32467;&#21512;&#36215;&#26469;&#65292;&#36825;&#20123;&#37096;&#20998;&#26494;&#25955;&#36981;&#24490;&#30340;&#27169;&#24335;&#31216;&#20026;&#27169;&#22411;-&#35270;&#22270;-&#25511;&#21046;&#22120;(MVC)&#12290; &#31616;&#21333;&#30340;&#35828;&#65292; MVC &#26159;&#19968;&#31181;&#36719;&#20214;&#24320;&#21457;&#30340;&#26041;&#27861;&#65292;&#23427;&#25226;&#20195;&#30721;&#30340;&#23450;&#20041;&#21644;&#25968;&#25454;&#35775;&#38382;&#30340;&#26041;&#27861;&#65288;&#27169;&#22411;&#65289;&#19982;&#35831;&#27714;&#36923;&#36753; &#65288;&#25511;&#21046;&#22120;&#65289;&#36824;&#26377;&#29992;&#25143;&#25509;&#21475;&#65288;&#35270;&#22270;&#65289;&#20998;&#24320;&#26469;&#12290; &#25105;&#20204;&#23558;&#22312;&#31532;5&#31456;&#26356;&#28145;&#20837;&#22320;&#35752;&#35770;MVC&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#36825;&#31181;&#35774;&#35745;&#27169;&#24335;&#20851;&#38190;&#30340;&#20248;&#21183;&#22312;&#20110;&#21508;&#31181;&#32452;&#20214;&#37117;&#26159; &lt;em&gt;&#26494;&#25955;&#32467;&#21512;&lt;/em&gt; &#30340;&#12290;&#36825;&#26679;&#65292;&#27599;&#20010;&#30001; Django&#39537;&#21160; &#30340;Web&#24212;&#29992;&#37117;&#26377;&#30528;&#26126;&#30830;&#30340;&#30446;&#30340;&#65292;&#24182;&#19988;&#21487;&#29420;&#31435;&#26356;&#25913;&#32780;&#19981;&#24433;&#21709;&#21040;&#20854;&#23427;&#30340;&#37096;&#20998;&#12290;
&#27604;&#22914;&#65292;&#24320;&#21457;&#32773; &#26356;&#25913;&#19968;&#20010;&#24212;&#29992;&#31243;&#24207;&#20013;&#30340; URL &#32780;&#19981;&#29992;&#24433;&#21709;&#21040;&#36825;&#20010;&#31243;&#24207;&#24213;&#23618;&#30340;&#23454;&#29616;&#12290; &#35774;&#35745;&#24072;&#21487;&#20197;&#25913;&#21464; HTML &#39029;&#38754; &#30340;&#26679;&#24335;&#32780;&#19981;&#29992;&#25509;&#35302; Python &#20195;&#30721;&#12290; &#25968;&#25454;&#24211;&#31649;&#29702;&#21592;&#21487;&#20197;&#37325;&#26032;&#21629;&#21517;&#25968;&#25454;&#34920;&#24182;&#19988;&#21482;&#38656;&#26356;&#25913;&#19968;&#20010;&#22320;&#26041;&#65292;&#26080;&#38656;&#20174;&#19968;&#22823;&#22534;&#25991;&#20214;&#20013;&#36827;&#34892;&#26597;&#25214;&#21644;&#26367;&#25442;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#26412;&#20070;&#20013;&#65292;&#27599;&#20010;&#32452;&#20214;&#37117;&#26377;&#23427;&#33258;&#24049;&#30340;&#19968;&#20010;&#31456;&#33410;&#12290; &#27604;&#22914;&#65292;&#31532;&#19977;&#31456;&#28085;&#30422;&#20102;&#35270;&#22270;&#65292;&#31532;&#22235;&#31456;&#26159;&#27169;&#26495;&#65292; &#32780;&#31532;&#20116;&#31456;&#26159;&#27169;&#22411;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn31&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn31&quot;&gt;Django &#21382;&#21490;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#22312;&#25105;&#20204;&#35752;&#35770;&#20195;&#30721;&#20043;&#21069;&#25105;&#20204;&#38656;&#35201;&#20808;&#20102;&#35299;&#19968;&#19979; Django &#30340;&#21382;&#21490;&#12290; &#20174;&#19978;&#38754;&#25105;&#20204;&#27880;&#24847;&#21040;&#65306;&#25105;&#20204;&#23558;&#21521;&#20320;&#23637;&#31034;&#22914;&#20309;&#19981;&#20351;&#29992;&#25463;&#24452;&#26469;&#23436;&#25104;&#24037;&#20316;&#65292;&#20197;&#20415;&#33021;&#26356;&#22909;&#30340;&#29702;&#35299;&#25463;&#24452;&#30340;&#21407;&#29702; &#21516;&#26679;&#65292;&#29702;&#35299;Django&#20135;&#29983;&#30340;&#32972;&#26223;&#65292;&#21382;&#21490;&#26377;&#21161;&#20110;&#29702;&#35299;Django&#30340;&#23454;&#29616;&#26041;&#24335;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#22914;&#26524;&#20320;&#26366;&#32534;&#20889;&#36807;&#32593;&#32476;&#24212;&#29992;&#31243;&#24207;&#12290; &#37027;&#20040;&#20320;&#24456;&#26377;&#21487;&#33021;&#29087;&#24713;&#20043;&#21069;&#25105;&#20204;&#30340; CGI &#20363;&#23376;&#12290;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn34&quot;&gt;&#20174;&#22836;&#24320;&#22987;&#32534;&#20889;&#32593;&#32476;&#24212;&#29992;&#31243;&#24207;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn35&quot;&gt;&#20174;&#22836;&#32534;&#20889;&#21478;&#19968;&#20010;&#32593;&#32476;&#24212;&#29992;&#31243;&#24207;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn36&quot;&gt;&#20174;&#31532;&#19968;&#27493;&#20013;&#24635;&#32467;&#65288;&#25214;&#20986;&#20854;&#20013;&#36890;&#29992;&#30340;&#20195;&#30721;&#65289;&#65292;&#24182;&#36816;&#29992;&#22312;&#31532;&#20108;&#27493;&#20013;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;4&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn37&quot;&gt;&#37325;&#26500;&#20195;&#30721;&#20351;&#24471;&#33021;&#22312;&#31532; 2 &#20010;&#31243;&#24207;&#20013;&#20351;&#29992;&#31532; 1 &#20010;&#31243;&#24207;&#20013;&#30340;&#36890;&#29992;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;5&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn38&quot;&gt;&#37325;&#22797; 2-4 &#27493;&#39588;&#33509;&#24178;&#27425;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;6&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn39&quot;&gt;&#24847;&#35782;&#21040;&#20320;&#21457;&#26126;&#20102;&#19968;&#20010;&#26694;&#26550;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn40&quot;&gt;&#36825;&#27491;&#26159;&#20026;&#20160;&#20040; Django &#24314;&#31435;&#30340;&#21407;&#22240;&#65281;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;Django &#26159;&#20174;&#30495;&#23454;&#19990;&#30028;&#30340;&#24212;&#29992;&#20013;&#25104;&#38271;&#36215;&#26469;&#30340;&#65292;&#23427;&#26159;&#30001; &#22570;&#33832;&#26031;&#65288;Kansas&#65289;&#24030; Lawrence &#22478;&#20013;&#30340;&#19968;&#20010; &#32593;&#32476;&#24320;&#21457;&#23567;&#32452;&#32534;&#20889;&#30340;&#12290; &#23427;&#35806;&#29983;&#20110; 2003 &#24180;&#31179;&#22825;&#65292;&#37027;&#26102; &lt;em&gt;Lawrence Journal-World&lt;/em&gt; &#25253;&#32440;&#30340; &#31243;&#24207;&#21592; Adrian Holovaty &#21644; Simon Willison &#24320;&#22987;&#29992; Python &#26469;&#32534;&#20889;&#31243;&#24207;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#24403;&#26102;&#20182;&#20204;&#30340; World Online &#23567;&#32452;&#21046;&#20316;&#24182;&#32500;&#25252;&#24403;&#22320;&#30340;&#20960;&#20010;&#26032;&#38395;&#31449;&#28857;, &#24182;&#22312;&#20197;&#26032;&#38395;&#30028;&#29305;&#26377;&#30340;&#24555;&#33410;&#22863;&#24320;&#21457;&#29615;&#22659;&#20013;&#36880;&#28176;&#21457;&#23637;&#12290; &#36825;&#20123;&#31449;&#28857;&#21253;&#25324;&#26377; LJWorld.com&#12289;Lawrence.com &#21644; KUsports.com&#65292; &#35760;&#32773;&#65288;&#25110;&#31649;&#29702;&#23618;&#65289; &#35201;&#27714;&#22686;&#21152;&#30340;&#29305;&#24449;&#25110;&#25972;&#20010;&#31243;&#24207;&#37117;&#33021;&#22312;&#35745;&#21010;&#26102;&#38388;&#20869;&#24555;&#36895;&#30340;&#34987;&#24314;&#31435;&#65292;&#36825;&#20123;&#26102;&#38388;&#36890;&#24120;&#21482;&#26377;&#20960;&#22825; &#25110;&#20960;&#20010;&#23567;&#26102;&#12290; &#22240;&#27492;&#65292;Adrian &#21644; Simon &#24320;&#21457;&#20102;&#19968;&#31181;&#33410;&#30465;&#26102;&#38388;&#30340;&#32593;&#32476;&#31243;&#24207;&#24320;&#21457;&#26694;&#26550;&#65292; &#36825;&#26159;&#22312;&#25130;&#27490;&#26102;&#38388;&#21069;&#33021;&#23436;&#25104;&#31243;&#24207;&#30340;&#21807;&#19968;&#36884;&#24452;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn43&quot;&gt;2005 &#24180;&#30340;&#22799;&#22825;&#65292;&#24403;&#36825;&#20010;&#26694;&#26550;&#24320;&#21457;&#23436;&#25104;&#26102;&#65292;&#23427;&#24050;&#32463;&#29992;&#26469;&#21046;&#20316;&#20102;&#24456;&#22810;&#20010; World Online &#30340;&#31449;&#28857;&#12290;
&#24403;&#26102; World Online &#23567;&#32452;&#20013;&#30340; Jacob Kaplan-Moss &#20915;&#23450;&#25226;&#36825;&#20010;&#26694;&#26550;&#21457;&#24067;&#20026;&#19968;&#20010;&#24320;&#28304;&#36719;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#20174;&#20170;&#24448;&#21518;&#25968;&#24180;&#65292;Django&#26159;&#19968;&#20010;&#26377;&#30528;&#25968;&#20197;&#19975;&#35745;&#30340;&#29992;&#25143;&#21644;&#36129;&#29486;&#32773;&#65292;&#22312;&#19990;&#30028;&#24191;&#27867;&#20256;&#25773;&#30340;&#23436;&#21892;&#24320;&#28304;&#39033;&#30446;&#12290; &#21407;&#26469;&#30340;World Online&#30340;&#20004;&#20010;&#24320;&#21457;&#32773;&#65288;Adrian and Jacob&#65289;&#20173;&#28982;&#25484;&#25569;&#30528;Django&#65292;&#20294;&#26159;&#20854;&#21457;&#23637;&#26041;&#21521;&#21463;&#31038;&#21306;&#22242;&#38431;&#30340;&#24433;&#21709;&#26356;&#22823;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#36825;&#20123;&#21382;&#21490;&#37117;&#26159;&#30456;&#20851;&#32852;&#30340;&#65292;&#22240;&#20026;&#22905;&#20204;&#24110;&#21161;&#35299;&#37322;&#20102;&#24456;&#37325;&#35201;&#30340;&#20004;&#28857;&#12290; &#31532;&#19968;&#65292;Django&#26368;&#21487;&#29233;&#30340;&#22320;&#26041;&#12290; Django&#35806;&#29983;&#20110;&#26032;&#38395;&#32593;&#31449;&#30340;&#29615;&#22659;&#20013;&#65292;&#22240;&#27492;&#23427;&#25552;&#20379;&#24456;&#22810;&#20102;&#29305;&#24615;&#65288;&#22914;&#31532;6&#31456;&#20250;&#35828;&#21040;&#30340;&#31649;&#29702;&#21518;&#21488;&#65289;&#65292;&#38750;&#24120;&#36866;&#21512;&#20869;&#23481;&#31867;&#30340;&#32593;&#31449;&#65292;&#22914;Amazon.com,
craigslist.org&#21644;washingtonpost.com&#65292;&#36825;&#20123;&#32593;&#31449;&#25552;&#20379;&#21160;&#24577;&#30340;&#65292;&#25968;&#25454;&#24211;&#39537;&#21160;&#30340;&#20449;&#24687;&#12290; &#65288;&#19981;&#35201;&#30475;&#21040;&#36825;&#23601;&#24863;&#21040;&#27822;&#20007;&#65292;&#23613;&#31649;Django&#25797;&#38271;&#20110;&#21160;&#24577;&#20869;&#23481;&#31649;&#29702;&#31995;&#32479;&#65292; &#20294;&#24182;&#19981;&#34920;&#31034;Django&#20027;&#35201;&#30340;&#30446;&#30340;&#23601;&#26159;&#29992;&#26469;&#21019;&#24314;&#21160;&#24577;&#20869;&#23481;&#30340;&#32593;&#31449;&#12290;
&#26576;&#20123;&#26041;&#38754; * &#29305;&#21035;&#39640;&#25928;* &#19982;&#20854;&#20182;&#26041;&#38754; * &#19981;&#39640;&#25928;*  &#26159;&#26377;&#21306;&#21035;&#30340;, Django&#22312;&#20854;&#20182;&#26041;&#38754;&#20063;&#21516;&#26679;&#39640;&#25928;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#31532;&#20108;&#65292;Django&#30340;&#36215;&#28304;&#36896;&#23601;&#20102;&#23427;&#30340;&#24320;&#28304;&#31038;&#21306;&#30340;&#25991;&#21270;&#12290; &#22240;&#20026;Django&#26469;&#33258;&#20110;&#30495;&#23454;&#19990;&#30028;&#20013;&#30340;&#20195;&#30721;&#65292;&#32780;&#19981;&#26159; &#26469;&#33258;&#20110;&#19968;&#20010;&#31185;&#30740;&#39033;&#30446;&#25110;&#32773;&#21830;&#19994;&#20135;&#21697;&#65292;&#22905;&#20027;&#35201;&#38598;&#20013;&#21147;&#37327;&#26469;&#35299;&#20915;Web&#24320;&#21457;&#20013;&#36935;&#21040;&#30340;&#38382;&#39064;&#65292;&#21516;&#26679; &#20063;&#26159;Django&#30340;&#24320;&#21457;&#32773;&#32463;&#24120;&#36935;&#21040;&#30340;&#38382;&#39064;&#12290; &#36825;&#26679;&#65292;Django&#27599;&#22825;&#22312;&#29616;&#26377;&#30340;&#22522;&#30784;&#19978;&#36827;&#27493;&#12290; &#26694;&#26550;&#30340;&#24320;&#21457;&#32773;&#23545;&#20110;&#35753;&#24320;&#21457;&#20154;&#21592;&#33410;&#30465;&#26102;&#38388;&#65292;&#32534;&#20889;&#26356;&#21152;&#23481;&#26131;&#32500;&#25252;&#30340;&#31243;&#24207;&#65292;&#21516;&#26102;&#20445;&#35777;&#31243;&#24207;&#36816;&#34892;&#30340;&#25928;&#29575;&#20855;&#26377;&#26497;&#22823;&#30340;&#20852;&#36259;&#12290; &#26080;&#20182;&#65292;&#24320;&#21457;&#32773;&#21160;&#21147;&#26469;&#28304;&#20110;&#33258;&#24049;&#30340;&#30446;&#26631;&#65306;&#33410;&#30465;&#26102;&#38388;&#65292;&#24555;&#20048;&#24037;&#20316;&#12290; &#65288;&#22374;&#29575;&#22320;&#35762;&#65292;&#20182;&#20204;&#20351;&#29992;&#20102;&#33258;&#24049;&#20844;&#21496;&#30340;&#20135;&#21697;&#12290;&#65289;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn47&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#22914;&#20309;&#38405;&#35835;&#26412;&#20070;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#22312;&#32534;&#20889;&#26412;&#20070;&#26102;&#65292;&#25105;&#20204;&#21162;&#21147;&#23581;&#35797;&#22312;&#21487;&#35835;&#24615;&#21644;&#21442;&#32771;&#24615;&#38388;&#20570;&#19968;&#20010;&#24179;&#34913;&#65292;&#24403;&#28982;&#26412;&#20070;&#20250;&#20559;&#21521;&#20110;&#21487; &#35835;&#24615;&#12290; &#26412;&#20070;&#30340;&#30446;&#26631;&#65292;&#20043;&#21069;&#20063;&#25552;&#36807;&#65292;&#26159;&#35201;&#23558;&#20320;&#22521;&#20859;&#25104;&#19968;&#21517;Django&#19987;&#23478;&#65292;&#25105;&#20204;&#30456;&#20449;&#65292;&#26368;&#22909; &#30340;&#26041;&#24335;&#23601;&#26159;&#25552;&#20379;&#25991;&#31456;&#21644;&#20805;&#36275;&#30340;&#23454;&#20363;&#65292;&#32780;&#19981;&#26159;&#19968;&#22534;&#35814;&#23613;&#21364;&#20047;&#21619;&#30340;&#20851;&#20110;Django&#29305;&#33394;&#30340;&#25163;&#20876;&#12290; &#65288;&#26366;&#32463;&#26377;&#20154;&#35828;&#36807;&#65292;&#22914;&#26524;&#20165;&#20165;&#25945;&#23383;&#27597;&#34920;&#26159;&#26080;&#27861;&#25945;&#20250;&#21035;&#20154;&#35828;&#35805;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#25353;&#29031;&#36825;&#31181;&#24605;&#36335;&#65292;&#25105;&#20204;&#25512;&#33616;&#25353;&#39034;&#24207;&#38405;&#35835;&#31532; 1-12 &#31456;&#12290;
&#36825;&#20123;&#31456;&#33410;&#26500;&#25104;&#20102;&#22914;&#20309;&#20351;&#29992; Django &#30340;&#22522;&#30784;&#65307;&#35835;&#36807;&#20043;&#21518;&#65292;&#20320;&#23601;&#21487;&#20197;&#25645;&#24314;&#30001; Django &#25903;&#25745;&#30340;&#32593;&#31449;&#20102;&#12290; 1-7&#31456;&#26159;&#26680;&#24515;&#35838;&#31243;&#65292;8-11&#31456;&#35762;&#36848;Django&#30340;&#39640;&#32423;&#24212;&#29992;&#65292;12&#31456;&#35762;&#36848;&#37096;&#32626;&#30456;&#20851;&#30340;&#30693;&#35782;&#12290; &#21097;&#19979;&#30340;13-20&#31456;&#65292;&#35762;&#36848;Django&#29305;&#26377;&#30340;&#29305;&#28857;&#65292;&#21487;&#20197;&#20219;&#24847;&#39034;&#24207;&#38405;&#35835;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#38468;&#24405;&#37096;&#20998;&#29992;&#20316;&#21442;&#32771;&#36164;&#26009;&#12290; &#35201;&#22238;&#24518;&#35821;&#27861;&#25110;&#26597;&#38405; Django &#26576;&#37096;&#20998;&#30340;&#21151;&#33021;&#27010;&#35201;&#26102;&#65292;&#20320;&#20598;&#23572;&#21487;&#33021;&#20250;&#22238;&#26469;&#32763;&#32763;&#36825;&#20123;&#36164;&#26009;&#20197;&#21450; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/&quot;&gt;http://www.djangoproject.com/&lt;/a&gt; &#19978;&#30340;&#20813;&#36153;&#25991;&#26723;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn51&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&#25152;&#38656;&#32534;&#31243;&#30693;&#35782;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#26412;&#20070;&#35835;&#32773;&#38656;&#35201;&#29702;&#35299;&#22522;&#26412;&#30340;&#38754;&#21521;&#36807;&#31243;&#21644;&#38754;&#21521;&#23545;&#35937;&#32534;&#31243;&#65306; &#27969;&#31243;&#25511;&#21046;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;while&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt;&lt;/tt&gt; &#65289;&#65292;&#25968;&#25454;&#32467;&#26500;&#65288;&#21015;&#34920;&#65292;&#21704;&#24076;&#34920;/&#23383;&#20856;&#65289;&#65292;&#21464;&#37327;&#65292;&#31867;&#21644;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;Web&#24320;&#21457;&#32463;&#39564;&#65292;&#27491;&#22914;&#20320;&#25152;&#24819;&#30340;&#65292;&#20063;&#26159;&#38750;&#24120;&#26377;&#24110;&#21161;&#30340;&#65292;&#20294;&#26159;&#23545;&#20110;&#38405;&#35835;&#26412;&#20070;&#65292;&#24182;&#19981;&#26159;&#24517;&#39035;&#30340;&#12290; &#36890;&#36807;&#26412;&#20070;&#65292;&#25105;&#20204;&#23613;&#37327;&#32473;&#32570;&#20047;&#32463;&#39564;&#30340;&#24320;&#21457;&#20154;&#21592;&#25552;&#20379;&#22312;Web&#24320;&#21457;&#20013;&#26368;&#22909;&#30340;&#23454;&#36341;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;python&quot;&gt;
&lt;span id=&quot;cn54&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn54&quot;&gt;Python&#25152;&#38656;&#30693;&#35782;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#26412;&#36136;&#19978;&#26469;&#35828;&#65292; Django &#21482;&#19981;&#36807;&#26159;&#29992; Python &#32534;&#20889;&#30340;&#19968;&#32452;&#31867;&#24211;&#12290; &#29992; Django &#24320;&#21457;&#31449;&#28857;&#23601;&#26159;&#20351;&#29992;&#36825;&#20123;&#31867;&#24211;&#32534;&#20889; Python &#20195;&#30721;&#12290; &#22240;&#27492;&#65292;&#23398;&#20064; Django &#30340;&#20851;&#38190;&#23601;&#26159;&#23398;&#20064;&#22914;&#20309;&#36827;&#34892; Python &#32534;&#31243;&#24182;&#29702;&#35299; Django &#31867;&#24211;&#30340;&#36816;&#20316;&#26041;&#24335;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#22914;&#26524;&#20320;&#26377;Python&#24320;&#21457;&#32463;&#39564;&#65292;&#22312;&#23398;&#20064;&#36807;&#31243;&#20013;&#24212;&#35813;&#19981;&#20250;&#26377;&#20219;&#20309;&#38382;&#39064;&#12290; &#22522;&#26412;&#19978;,Django&#30340;&#20195;&#30721;&#24182; &#27809;&#26377;&#20351;&#29992;&#19968;&#20123;&#40657;&#33394;&#39764;&#27861;&#65288;&#20363;&#22914;&#20195;&#30721;&#20013;&#30340;&#33457;&#21736;&#25216;&#24039;&#65292;&#26576;&#20010;&#23454;&#29616;&#35299;&#37322;&#25110;&#32773;&#29702;&#35299;&#36215;&#26469;&#21313;&#20998;&#22256;&#38590;&#65289;&#12290; &#23545;&#20320;&#26469;&#35828;&#65292;&#23398;&#20064;Django&#23601;&#26159;&#23398;&#20064;&#22905;&#30340;&#21629;&#21517;&#35268;&#21017;&#21644;API&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#22914;&#26524;&#20320;&#27809;&#26377;&#20351;&#29992; Python &#32534;&#31243;&#30340;&#32463;&#39564;&#65292;&#20320;&#19968;&#23450;&#20250;&#23398;&#21040;&#24456;&#22810;&#19996;&#35199;&#12290; &#23427;&#26159;&#38750;&#24120;&#26131;&#23398;&#26131;&#29992;&#30340;&#12290; &#34429;&#28982;&#36825;&#26412;&#20070;&#27809;&#26377;&#21253;&#25324;&#19968;&#20010;&#23436;&#25972;&#30340; Python &#25945;&#31243;&#65292; &#20294;&#20063;&#31639;&#26159;&#19968;&#20010;&#24688;&#24403;&#30340;&#20171;&#32461;&#20102; Python&#29305;&#24449;&#21644; &#21151;&#33021;&#30340;&#38598;&#38182;&#12290; &#24403;&#28982;&#65292;&#25105;&#20204;&#25512;&#33616;&#20320;&#35835;&#19968;&#19979;&#23448;&#26041;&#30340; Python &#25945;&#31243;&#65292;&#23427;&#21487; &#20197;&#20174; &lt;a class=&quot;reference external&quot; href=&quot;http://docs.python.org/tut/&quot;&gt;http://docs.python.org/tut/&lt;/a&gt; &#22312;&#32447;&#33719;&#24471;&#12290; &#21478;&#22806;&#25105;&#20204;&#20063;&#25512;&#33616; Mark Pilgrims&#30340; &#20070; &lt;em&gt;Dive Into Python&lt;/em&gt; &#65288; &lt;a class=&quot;reference external&quot; href=&quot;http://www.diveintopython.org/&quot;&gt;http://www.diveintopython.org/&lt;/a&gt; &#65289;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn58&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn58&quot;&gt;Django&#29256;&#26412;&#25903;&#25345;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#27492;&#20070;&#20869;&#23481;&#23545;Django 1.1&#20860;&#23481;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;Django&#30340;&#24320;&#21457;&#32773;&#20445;&#35777;&#20027;&#35201;&#29256;&#26412;&#21495;&#21521;&#21518;&#20860;&#23481;&#12290; &#36825;&#24847;&#21619;&#30528;&#65292;&#20320;&#29992;Django 1.1&#20889;&#30340;&#24212;&#29992;&#65292;&#21487;&#20197;&#29992;&#20110;1.2&#65292;1.3&#65292;1.9&#31561;&#25152;&#26377;&#20197;1&#24320;&#22836;&#30340;&#29256;&#26412;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&#22914;&#26524;Django&#21040;&#20102;2.0&#65292;&#20320;&#30340;&#24212;&#29992;&#21487;&#33021;&#19981;&#20877;&#20860;&#23481;&#65292;&#38656;&#35201;&#37325;&#20889;&#65292;&#20294;&#26159;&#65292;2.0&#26159;&#24456;&#36965;&#36828;&#30340;&#20107;&#24773;&#12290; &#23545;&#27492;&#65292;&#21487;&#20197;&#21442;&#32771;&#19968;&#19979;1.0&#30340;&#24320;&#21457;&#21608;&#26399;&#65292;&#25972;&#25972;3&#24180;&#30340;&#26102;&#38388;&#12290; &#65288;&#36825;&#19982;Python&#35821;&#35328;&#30340;&#20860;&#23481;&#31574;&#30053;&#38750;&#24120;&#20687;&#65306; &#22312;python 2.0&#19979;&#20889;&#30340;&#20195;&#30721;&#21487;&#20197;&#22312;python 2.6&#19979;&#36816;&#34892;&#65292;&#20294;&#19981;&#19968;&#23450;&#33021;&#22312;python3.0&#19979;&#36816;&#34892;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#25152;&#20197;&#65292;&#27492;&#20070;&#35206;&#30422;1.1&#29256;&#26412;&#65292;&#21487;&#20197;&#20351;&#29992;&#24456;&#38271;&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn63&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#33719;&#21462;&#24110;&#21161;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;Django&#30340;&#26368;&#22823;&#30340;&#30410;&#22788;&#26159;,&#26377;&#19968;&#32676;&#20048;&#20110;&#21161;&#20154;&#30340;&#20154;&#22312;Django&#31038;&#21306;&#19978;&#12290;
&#20320;&#21487;&#20197;&#27627;&#26080;&#32422;&#26463;&#30340;&#25552;&#21508;&#31181; &#38382;&#39064;&#22312;&#19978;&#38754;,&#22914;:django&#30340;&#23433;&#35013;,app &#35774;&#35745;,db &#35774;&#35745;,&#21457;&#24067;&#12290;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn65&quot;&gt;Django&#37038;&#20214;&#21015;&#34920;&#26159;&#24456;&#22810;Django&#29992;&#25143;&#25552;&#20986;&#38382;&#39064;&#12289;&#22238;&#31572;&#38382;&#39064;&#30340;&#22320;&#26041;&#12290; &#21487;&#20197;&#36890;&#36807;&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/django-users&quot;&gt;http://www.djangoproject.com/r/django-users&lt;/a&gt; &#26469;&#20813;&#36153;&#27880;&#20876;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn66&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn66&quot;&gt;&#22914;&#26524;Django&#29992;&#25143;&#36935;&#21040;&#26840;&#25163;&#30340;&#38382;&#39064;,&#24076;&#26395;&#24471;&#21040;&#21450;&#26102;&#22320;&#22238;&#22797;&#65292;&#21487;&#20197;&#20351;&#29992;Django IRC channel&#12290; &#22312;Freenode IRC network&#21152;&#20837;#django&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn67&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&#19979;&#19968;&#31456;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#22312; &lt;a class=&quot;reference external&quot; href=&quot;../chapter02/&quot;&gt;&#19979;&#19968;&#31456;&lt;/a&gt;&#65292;&#25105;&#20204;&#23558;&#24320;&#22987;&#20351;&#29992;Django&#65292;&#20869;&#23481;&#23558;&#21253;&#25324;&#23433;&#35013;&#21644;&#21021;&#22987;&#21270;&#37197;&#32622;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter02</id>
        <title type="html">chapter02</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter02"/>
        <published>2015-02-26T23:32:46+08:00</published>
        <updated>2015-02-26T23:32:46+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#20108;&#31456;:&#20837;&#38376;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#30001;&#20110;&#29616;&#20195;Web&#24320;&#21457;&#29615;&#22659;&#30001;&#22810;&#20010;&#37096;&#20214;&#32452;&#25104;&#65292;&#23433;&#35013;Django&#38656;&#35201;&#20960;&#20010;&#27493;&#39588;&#12290; &#36825;&#19968;&#31456;&#65292;&#25105;&#20204;&#23558;&#28436;&#31034;&#22914;&#20309;&#23433;&#35013;&#26694;&#26550;&#20197;&#21450;&#19968;&#20123;&#20381;&#36182;&#20851;&#31995;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#22240;&#20026;Django&#23601;&#26159;&#32431;Python&#20195;&#30721;&#65292;&#23427;&#21487;&#20197;&#36816;&#34892;&#22312;&#20219;&#20309;Python&#21487;&#20197;&#36816;&#34892;&#30340;&#29615;&#22659;&#65292;&#29978;&#33267;&#26159;&#25163;&#26426;&#19978;&#65281; &#20294;&#26159;&#36825;&#31456;&#21482;&#25552;&#21450;Django&#23433;&#35013;&#30340;&#36890;&#29992;&#33050;&#26412;&#12290; &#25105;&#20204;&#20551;&#35774;&#20320;&#25226;&#23427;&#23433;&#35013;&#22312;&#26700;&#38754;/&#31508;&#35760;&#26412;&#30005;&#33041;&#25110;&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#24448;&#21518;&#65292;&#22312;&#31532;12&#31456;&#65292;&#25105;&#20204;&#23558;&#35752;&#35770;&#22914;&#20309;&#37096;&#32626;Django&#21040;&#19968;&#20010;&#29983;&#20135;&#31449;&#28857;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;python&quot;&gt;
&lt;span id=&quot;cn4&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn4&quot;&gt;Python &#23433;&#35013;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;Django&#26412;&#36523;&#26159;&#32431;Python&#32534;&#20889;&#30340;&#65292;&#25152;&#20197;&#23433;&#35013;&#26694;&#26550;&#30340;&#31532;&#19968;&#27493;&#26159;&#30830;&#20445;&#20320;&#24050;&#32463;&#23433;&#35013;&#20102;Python&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn6&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn6&quot;&gt;Python&#29256;&#26412;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#26680;&#24515;Django&#26694;&#26550;&#21487;&#20197;&#24037;&#20316;&#22312;2.3&#33267;2.6&#65288;&#21253;&#25324;2.3&#21644;2.6&#65289;&#20043;&#38388;&#30340;&#20219;&#20309;Python&#29256;&#26412;&#12290; Django&#30340;&#21487;&#36873;GIS&#65288;&#22320;&#29702;&#20449;&#24687;&#31995;&#32479;&#65289;&#25903;&#25345;&#38656;&#35201;Python 2.4&#21040;2.6&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#22914;&#26524;&#20320;&#19981;&#30830;&#23450;&#35201;&#23433;&#35013;Python&#30340;&#20160;&#20040;&#29256;&#26412;&#65292;&#24182;&#19988;&#20320;&#23436;&#20840;&#25343;&#19981;&#23450;&#20027;&#24847;&#30340;&#35805;,&#37027;&#23601;&#36873;2.x&#31995;&#21015;&#30340;&#26368;&#26032;&#29256;&#26412;&#21543;&#12290; &#29256;&#26412;2.6&#12290;
&#34429;&#28982;Django&#22312;2.3&#33267;2.6&#29256;&#20043;&#38388;&#30340;&#20219;&#24847;Python&#29256;&#26412;&#19979;&#37117;&#19968;&#26679;&#36816;&#34892;&#24471;&#24456;&#22909;&#65292;&#20294;&#26159;&#26032;&#29256;&#26412;&#30340;Python&#25552;&#20379;&#20102;&#19968;&#20123;&#20320;&#21487;&#33021;&#27604;&#36739;&#24819;&#24212;&#29992;&#22312;&#20320;&#30340;&#31243;&#24207;&#37324;&#30340;&#65292;&#26356;&#21152;&#20016;&#23500;&#21644;&#39069;&#22806;&#30340;&#35821;&#35328;&#29305;&#24615;&#12290; &#21478;&#22806;&#65292;&#26576;&#20123;&#20320;&#21487;&#33021;&#35201;&#29992;&#21040;&#30340;Django&#31532;&#19977;&#26041;&#25554;&#20214;&#20250;&#35201;&#27714;&#27604;Python 2.3&#26356;&#26032;&#30340;&#29256;&#26412;&#65292;&#25152;&#20197;&#20351;&#29992;&#27604;&#36739;&#26032;&#30340;Python&#29256;&#26412;&#20250;&#35753;&#20320;&#26377;&#26356;&#22810;&#36873;&#25321;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn9&quot;&gt;Django&#21644; Python 3.0&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#22312;&#20889;&#20316;&#26412;&#20070;&#30340;&#26102;&#20505;&#65292;Python3.0&#24050;&#32463;&#21457;&#24067;&#65292;&#20294;Django&#26242;&#26102;&#36824;&#19981;&#25903;&#25345;&#12290; Python3.0&#36825;&#20010;&#35821;&#35328;&#26412;&#36523;&#24341;&#20837;&#20102;&#22823;&#37327;&#19981;&#21521;&#21518;&#20860;&#23481;&#30340;&#25913;&#21464;&#65292;&#22240;&#27492;&#65292;&#25105;&#20204;&#39044;&#26399;&#22823;&#22810;&#25968;&#20027;&#35201;&#30340;Python&#24211;&#21644;&#26694;&#26550;&#23558;&#33457;&#20960;&#24180;&#25165;&#33021;&#34900;&#25509;&#65292;&#21253;&#25324;Django&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#22914;&#26524;&#20320;&#26159;&#20010;Python&#26032;&#25163;&#24182;&#19988;&#27491;&#36855;&#33579;&#20110;&#21040;&#24213;&#26159;&#23398;&#20064;Python 2.x&#36824;&#26159;Python 3.x&#30340;&#35805;&#65292;&#25105;&#20204;&#24314;&#35758;&#20320;&#36873;&#25321;Python 2.x&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn12&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&#23433;&#35013;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&#22914;&#26524;&#20351;&#29992;&#30340;&#26159; Linux &#25110; Mac OS X &#65292;&#31995;&#32479;&#21487;&#33021;&#24050;&#32463;&#39044;&#35013;&#20102; Python &#12290;&#22312;&#21629;&#20196;&#25552;&#31034;&#31526;&#19979; (&#25110; OS X &#30340;&#32456;&#31471;&#20013;) &#36755;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt;&lt;/tt&gt; &#65292;&#22914;&#26524;&#30475;&#21040;&#22914;&#19979;&#20449;&#24687;&#65292;&#35828;&#26126; Python &#24050;&#32463;&#35013;&#22909;&#20102;&#65306;
&#22312;&#21629;&#20196;&#34892;&#31383;&#21475;&#20013;&#36755;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt;&lt;/tt&gt; &#65288;&#25110;&#26159;&#22312;OS X&#30340;&#31243;&#24207;/&#24037;&#20855;/&#32456;&#31471;&#20013;&#65289;&#12290; &#22914;&#26524;&#20320;&#30475;&#21040;&#36825;&#26679;&#30340;&#20449;&#24687;,&#35828;&#26126; python &#24050;&#32463;&#23433;&#35013;&#22909;&#20102;.&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn15&quot;&gt;Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&amp;gt;&amp;gt;&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#21542;&#21017;, &#20320;&#38656;&#35201;&#19979;&#36733;&#24182;&#23433;&#35013;Python. &#23427;&#26082;&#24555;&#36895;&#21448;&#26041;&#20415;&#65292;&#32780;&#35814;&#32454;&#35828;&#26126;&#21487;&#21442;&#32771;&lt;a class=&quot;reference external&quot; href=&quot;http://www.python.org/download/&quot;&gt;http://www.python.org/download/&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django&quot;&gt;
&lt;span id=&quot;cn17&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#23433;&#35013; Django&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#20219;&#20309;&#26102;&#20505;&#65292;&#37117;&#26377;&#20004;&#20010;&#19981;&#21516;&#29256;&#26412;&#30340;Django&#20379;&#24744;&#36873;&#25321;&#12290; &#26368;&#26032;&#30340;&#23448;&#26041;&#21457;&#34892;&#29256;&#21644;&#26377;&#39118;&#38505;&#30340;&#20027;&#24178;&#29256;&#26412;&#12290; &#23433;&#35013;&#30340;&#29256;&#26412;&#21462;&#20915;&#20110;&#24744;&#30340;&#20248;&#20808;&#36873;&#25321;&#12290; &#20320;&#38656;&#35201;&#19968;&#20010;&#31283;&#23450;&#30340;&#36890;&#36807;&#27979;&#35797;&#30340;Django&#65292;&#25110;&#26159;&#20320;&#24819;&#35201;&#21253;&#25324;&#26368;&#26032;&#21151;&#33021;&#30340;&#29256;&#26412;&#65292;&#20063;&#35768;&#20320;&#21487;&#23545;Django&#26412;&#36523;&#20316;&#36129;&#29486;&#65292;&#32780;&#25226;&#31283;&#23450;&#20316;&#20026;&#20195;&#20215;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#25105;&#20204;&#25512;&#33616;&#36873;&#23450;&#19968;&#20010;&#27491;&#24335;&#21457;&#24067;&#29256;&#26412;&#65292;&#20294;&#37325;&#35201;&#30340;&#26159;&#20102;&#35299;&#21040;&#20027;&#24178;&#24320;&#21457;&#29256;&#26412;&#30340;&#23384;&#22312;&#65292;&#22240;&#20026;&#22312;&#25991;&#26723;&#21644;&#31038;&#21306;&#25104;&#21592;&#20013;&#20320;&#20250;&#21457;&#29616;&#23427;&#34987;&#25552;&#21040;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn20&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#23433;&#35013;&#23448;&#26041;&#21457;&#24067;&#29256;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#23448;&#26041;&#21457;&#24067;&#30340;&#29256;&#26412;&#24102;&#26377;&#19968;&#20010;&#29256;&#26412;&#21495;&#65292;&#20363;&#22914;1.0.3&#25110;1.1&#65292;&#32780;&#26368;&#26032;&#29256;&#26412;&#24635;&#26159;&#21487;&#20197;&#22312;&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/download/&quot;&gt;http://www.djangoproject.com/download/&lt;/a&gt;&#25214;&#21040;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&#22914;&#26524;&#24744;&#22312;&#29992;Linux&#31995;&#32479;&#65292;&#20854;&#20013;&#21253;&#25324;Django&#30340;&#21253;&#65292;&#20351;&#29992;&#40664;&#35748;&#30340;&#29256;&#26412;&#26159;&#20010;&#22909;&#20027;&#24847;&#12290; &#36825;&#26679;&#65292;&#20320;&#23558;&#20250;&#36890;&#36807;&#31995;&#32479;&#30340;&#21253;&#31649;&#29702;&#24471;&#21040;&#23433;&#20840;&#30340;&#21319;&#32423;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#22914;&#26524;&#20320;&#30340;&#31995;&#32479;&#27809;&#26377;&#33258;&#24102;Django&#65292;&#20320;&#21487;&#20197;&#33258;&#24049;&#19979;&#36733;&#28982;&#21518;&#23433;&#35013;&#26694;&#26550;&#12290; &#39318;&#20808;&#65292;&#19979;&#36733;&#21517;&#23383;&#31867;&#20284;&#20110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Django-1.0.2-final.tar.gz&lt;/span&gt;&lt;/tt&gt;&#21387;&#32553;&#25991;&#20214;&#12290;&#65288;&#19979;&#36733;&#21040;&#21738;&#37324;&#26080;&#25152;&#35859;&#65292;&#23433;&#35013;&#31243;&#24207;&#20250;&#25226;Django&#25991;&#20214;&#25918;&#21040;&#27491;&#30830;&#30340;&#22320;&#26041;&#12290;&#65289;&#35299;&#21387;&#32553;&#20043;&#21518;&#36816;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;setup.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;install&lt;/span&gt;&lt;/tt&gt;&#65292;&#20687;&#25805;&#20316;&#22823;&#22810;&#25968;Python&#24211;&#19968;&#26679;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#20197;&#19979;&#26159;&#22914;&#20309;&#22312;Unix&#31995;&#32479;&#19978;&#23433;&#35013;&#30340;&#26041;&#27861;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn25&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;xzvf&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Django-*.tar.gz&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn26&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Django-*&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn27&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;setup.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;install&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn28&quot;&gt;Windows&#31995;&#32479;&#19978;&#65292;&#25512;&#33616;&#20351;&#29992;7-Zip(&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/7zip/&quot;&gt;http://www.djangoproject.com/r/7zip/&lt;/a&gt;)&#26469;&#35299;&#21387;&#32553;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.tar.gz&lt;/span&gt;&lt;/tt&gt;&#25991;&#20214;&#12290; &#35299;&#21387;&#32553;&#23436;&#25104;&#21518;&#65292;&#20197;&#31649;&#29702;&#21592;&#26435;&#38480;&#21551;&#21160;&#19968;&#20010;DOS Shell&#65288;&#21629;&#20196;&#25552;&#31034;&#31526;&#65289;&#65292;&#28982;&#21518;&#22312;&#21517;&#23383;&#20197;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Django-&lt;/span&gt;&lt;/tt&gt;&#24320;&#22987;&#30340;&#30446;&#24405;&#37324;&#25191;&#34892;&#22914;&#19979;&#21629;&#20196;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn30&quot;&gt;python setup.py install
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#22914;&#26524;&#20320;&#24456;&#22909;&#22855;&#65306; Django&#23558;&#34987;&#23433;&#35013;&#21040;&#20320;&#30340;Python&#23433;&#35013;&#30446;&#24405;`` &#30340;site-package`` &#30446;&#24405;&#65288;Python&#20174;&#35813;&#30446;&#24405;&#23547;&#25214;&#31532;&#19977;&#26041;&#24211;&#65289;&#12290; &#36890;&#24120;&#24773;&#20917;&#19979;&#65292;&#36825;&#20010;&#30446;&#24405;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/usr/lib/python2.4/site-packages&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;trunk&quot;&gt;
&lt;span id=&quot;cn32&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#23433;&#35013;Trunk&#29256;&#26412;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#26368;&#26032;&#26368;&#22909;&#30340;django&#30340;&#24320;&#21457;&#29256;&#26412;&#31216;&#20026;trunk,&#21487;&#20197;&#20174;django&#30340;subversion&#22788;&#33719;&#24471;&#12290; &#22914;&#26524;&#20320;&#24819;&#23581;&#40092;&#65292;&#25110;&#32773;&#24819;&#20026;django&#36129;&#29486;&#20195;&#30721;&#65292;&#37027;&#20040;&#20320;&#24212;&#24403;&#23433;&#35013;&#36825;&#20010;&#29256;&#26412;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;Subversion &#26159;&#19968;&#31181;&#19982; CVS &#31867;&#20284;&#30340;&#20813;&#36153;&#24320;&#28304;&#29256;&#26412;&#25511;&#21046;&#31995;&#32479;&#65292;Django &#24320;&#21457;&#22242;&#38431;&#20351;&#29992;&#23427;&#31649;&#29702; Django &#20195;&#30721;&#24211;&#30340;&#26356;&#26032;&#12290; &#20320;&#21487;&#20197;&#20351;&#29992; Subversion &#23458;&#25143;&#31471;&#33719;&#21462;&#26368;&#26032;&#30340; Django &#28304;&#20195;&#30721;&#65292;&#24182;&#21487;&#20219;&#20309;&#26102;&#20505;&#20351;&#29992; &lt;em&gt;local checkout&lt;/em&gt; &#26356;&#26032;&#26412;&#22320; Django &#20195;&#30721;&#30340;&#29256;&#26412;&#65292;&#20197;&#33719;&#21462; Django &#24320;&#21457;&#32773;&#25152;&#20570;&#30340;&#26368;&#36817;&#26356;&#26032;&#21644;&#25913;&#36827;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#35831;&#35760;&#20303;&#65292;&#21363;&#20351;&#26159;&#20351;&#29992;trunk&#29256;&#26412;&#65292;&#20063;&#26159;&#26377;&#20445;&#38556;&#30340;&#12290; &#22240;&#20026;&#24456;&#22810;django&#30340;&#24320;&#21457;&#32773;&#22312;&#27491;&#24335;&#32593;&#31449;&#19978;&#23601;&#26159;&#29992;&#30340;trunk&#29256;&#26412;&#65292;&#20182;&#20204;&#20250;&#20445;&#35777;trunk&#29256;&#26412;&#30340;&#31283;&#23450;&#24615;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&#36981;&#24490;&#20197;&#19979;&#27493;&#39588;&#20197;&#33719;&#21462;&#26368;&#26032;&#30340; Django &#20027;&#27969;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#30830;&#20445;&#23433;&#35013;&#20102; Subversion &#23458;&#25143;&#31471;&#12290; &#21487;&#20197;&#20174; &lt;a class=&quot;reference external&quot; href=&quot;http://subversion.tigris.org/&quot;&gt;http://subversion.tigris.org/&lt;/a&gt; &#20813;&#36153;&#19979;&#36733;&#35813;&#36719;&#20214;&#65292;&#24182;&#20174; &lt;a class=&quot;reference external&quot; href=&quot;http://svnbook.red-bean.com/&quot;&gt;http://svnbook.red-bean.com/&lt;/a&gt; &#33719;&#21462;&#20986;&#33394;&#30340;&#25991;&#26723;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#65288;&#22914;&#26524;&#20320;&#22312;&#20351;&#29992;Mac OS X 10.5&#25110;&#32773;&#26356;&#26032;&#30340;&#29256;&#26412;&#65292;&#20320;&#24456;&#36208;&#36816;&#65292;Subversion&#24212;&#35813;&#23601;&#21487;&#20197;&#23433;&#35013;Django&#12290; &#20320;&#21487;&#20197;&#22312;&#32456;&#31471;&#19978;&#36755;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;svn&lt;/span&gt;
&lt;span class=&quot;pre&quot;&gt;--version&lt;/span&gt;&lt;/tt&gt;&#26469;&#39564;&#35777;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;svn&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;co&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;http://code.djangoproject.com/svn/django/trunk&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;djtrunk&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#26597;&#30475;&#20027;&#20307;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn40&quot;&gt;&#25214;&#21040;&#20320;&#30340;python&#30340;site-packages&#30446;&#24405;&#12290; &#19968;&#33324;&#20026;/usr/lib/python2.4/site-packages&#65292;&#22914;&#26524;&#20320;&#19981;&#30830;&#23450;&#65292;&#21487;&#20197;&#36755;&#20837;&#22914;&#19979;&#21629;&#20196;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn42&quot;&gt;python -c &apos;import sys, pprint; pprint.pprint(sys.path)&apos;
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&#19978;&#38754;&#30340;&#32467;&#26524;&#20250;&#21253;&#21547;site-packages&#30340;&#30446;&#24405;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#22312;site-packages&#30446;&#24405;&#19979;&#65292;&#21019;&#24314;&#19968;&#20010;&#25991;&#20214;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;django.pth&#65292;&#32534;&#36753;&#36825;&#20010;&#25991;&#20214;&#65292;&#21253;&#21547;djtrunk&#30446;&#24405;&#30340;&#20840;&#36335;&#24452; &#21033;&#28070;&#65292;&#27492;&#25991;&#20214;&#21253;&#21547;&#22914;&#19979;&#34892;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn47&quot;&gt;/home/me/code/djtrunk
&lt;/pre&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn48&quot;&gt;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;djtrunk/django/bin&lt;/span&gt;&lt;/tt&gt; &#21152;&#20837;&#31995;&#32479;&#21464;&#37327; PATH &#20013;&#12290;&#35813;&#30446;&#24405;&#20013;&#21253;&#21547;&#19968;&#20123;&#20687; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt;&lt;/tt&gt; &#20043;&#31867;&#30340;&#31649;&#29702;&#24037;&#20855;&#12290; &#27492;&#30446;&#24405;&#21253;&#21547;&#31649;&#29702;&#24037;&#20855;&#65292;&#20363;&#22914;&#65306;django-admin.py&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#25552;&#31034;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#22914;&#26524;&#20043;&#21069;&#27809;&#26377;&#25509;&#35302;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.pth&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#65292;&#20320;&#21487;&#20197;&#20174; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python/site-module/&quot;&gt;http://www.djangoproject.com/r/python/site-module/&lt;/a&gt; &#20013;&#33719;&#21462;&#26356;&#22810;&#30456;&#20851;&#30693;&#35782;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&#20174; Subversion &#23436;&#25104;&#19979;&#36733;&#24182;&#25191;&#34892;&#20102;&#21069;&#36848;&#27493;&#39588;&#21518;&#65292;&#23601;&#27809;&#26377;&#24517;&#35201;&#20877;&#25191;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;setup.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;install&lt;/span&gt;&lt;/tt&gt; &#20102;&#65292;&#20320;&#21018;&#25165;&#24050;&#32463;&#25163;&#21160;&#23436;&#25104;&#20102;&#23433;&#35013;&#65281;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#30001;&#20110; Django &#20027;&#24178;&#20195;&#30721;&#30340;&#26356;&#26032;&#32463;&#24120;&#21253;&#25324; bug &#20462;&#27491;&#21644;&#29305;&#24615;&#28155;&#21152;&#65292;&#22914;&#26524;&#30495;&#30340;&#30528;&#36855;&#30340;&#35805;&#65292;&#20320;&#21487;&#33021;&#27599;&#38548;&#19968;&#23567;&#27573;&#26102;&#38388;&#23601;&#24819;&#26356;&#26032;&#19968;&#27425;&#12290; &#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;djtrunk&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#19979;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;svn&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;update&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#21363;&#21487;&#36827;&#34892;&#26356;&#26032;&#12290; &#24403;&#20320;&#20351;&#29992;&#36825;&#20010;&#21629;&#20196;&#26102;&#65292;Subversion &#20250;&#32852;&#32476; &lt;a class=&quot;reference external&quot; href=&quot;http://code.djangoproject.com&quot;&gt;http://code.djangoproject.com&lt;/a&gt; &#65292;&#21028;&#26029;&#20195;&#30721;&#26159;&#21542;&#26377;&#26356;&#26032;&#65292;&#28982;&#21518;&#25226;&#19978;&#27425;&#26356;&#26032;&#20197;&#26469;&#30340;&#25152;&#26377;&#21464;&#21160;&#24212;&#29992;&#21040;&#26412;&#22320;&#20195;&#30721;&#12290; &#23601;&#36825;&#20040;&#31616;&#21333;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#26368;&#21518;&#65292;&#22914;&#26524;&#20320;&#20351;&#29992;trunk&#65292;&#20320;&#35201;&#30693;&#36947;&#20351;&#29992;&#30340;&#26159;&#21738;&#20010;trunk&#29256;&#26412;&#12290; &#22914;&#26524;&#20320;&#21435;&#31038;&#21306;&#23547;&#27714;&#24110;&#21161;&#65292;&#25110;&#26159;&#20026;Django&#26694;&#26550;&#25552;&#20379;&#25913;&#36827;&#65292;&#30693;&#36947;&#20320;&#20351;&#29992;&#30340;&#29256;&#26412;&#21495;&#26159;&#38750;&#24120;&#37325;&#35201;&#30340;&#12290; &#22240;&#27492;&#65292;&#24403;&#20320;&#21040;&#31038;&#21306;&#21435;&#27714;&#21161;&#65292;&#25110;&#32773;&#20026; django &#25552;&#20379;&#25913;&#36827;&#24847;&#35265;&#30340;&#26102;&#20505;&#65292;&#35831;&#26102;&#21051;&#35760;&#20303;&#35828;&#26126;&#20320;&#27491;&#22312;&#20351;&#29992;&#30340; django &#30340;&#29256;&#26412;&#21495;&#12290; &#22914;&#20309;&#30693;&#36947;&#20320;&#27491;&#22312;&#20351;&#29992;&#30340; django &#30340;&#29256;&#26412;&#21495;&#21602;&#65311;&#36827;&#20837;`` djtrunk`` &#30446;&#24405;&#65292;&#28982;&#21518;&#38190;&#20837; svn info &#65292;&#22312;&#36755;&#20986;&#20449;&#24687;&#20013;&#26597;&#30475; Revision: (&#29256;&#26412;:) &#21518;&#36319;&#30340;&#25968;&#23383;&#12290; Django&#22312;&#27599;&#27425;&#26356;&#26032;&#21518;&#65292;&#29256;&#26412;&#21495;&#37117;&#26159;&#36882;&#22686;&#30340;&#65292;&#26080;&#35770;&#26159;&#20462;&#22797;Bug&#12289;&#22686;&#21152;&#29305;&#24615;&#12289;&#25913;&#36827;&#25991;&#26723;&#25110;&#32773;&#26159;&#20854;&#20182;&#12290; &#22312;&#19968;&#20123;Django&#31038;&#21306;&#20013;&#65292;&#29256;&#26412;&#21495;&#29978;&#33267;&#25104;&#20026;&#20102;&#19968;&#31181;&#33635;&#35465;&#30340;&#35937;&#24449;&#65292;&#25105;&#20174;[&#20889;&#19978;&#38750;&#24120;&#20302;&#30340;&#29256;&#26412;&#21495;]&#24320;&#22987;&#23601;&#24050;&#32463;&#20351;&#29992;Djano&#20102;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn54&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&#27979;&#35797;Django&#23433;&#35013;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#35753;&#25105;&#20204;&#33457;&#28857;&#26102;&#38388;&#21435;&#27979;&#35797; Django &#26159;&#21542;&#23433;&#35013;&#25104;&#21151;&#65292;&#24182;&#24037;&#20316;&#33391;&#22909;&#12290;&#21516;&#26102;&#20063;&#21487;&#20197;&#20102;&#35299;&#21040;&#19968;&#20123;&#26126;&#30830;&#30340;&#23433;&#35013;&#21518;&#30340;&#21453;&#39304;&#20449;&#24687;&#12290; &#22312;Shell&#20013;&#65292;&#26356;&#25442;&#21040;&#21478;&#22806;&#19968;&#20010;&#30446;&#24405;&#65288;&#19981;&#26159;&#21253;&#21547;Django&#30340;&#30446;&#24405;&#65289;&#65292;&#28982;&#21518;&#36755;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt;&lt;/tt&gt;&#26469;&#25171;&#24320;Python&#30340;&#20132;&#20114;&#35299;&#37322;&#22120;&#12290;&#22914;&#26524;&#23433;&#35013;&#25104;&#21151;&#65292;&#20320;&#24212;&#35813;&#21487;&#20197;&#23548;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django&lt;/span&gt;&lt;/tt&gt;&#27169;&#22359;&#20102;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn57&quot;&gt;&amp;gt;&amp;gt;&amp;gt; import django
&amp;gt;&amp;gt;&amp;gt; django.VERSION
(1, 1, 0, final&apos;, 1)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&#20132;&#20114;&#35299;&#37322;&#22120;&#31034;&#20363;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;Python &#20132;&#20114;&#35299;&#37322;&#22120;&#26159;&#21629;&#20196;&#34892;&#31383;&#21475;&#30340;&#31243;&#24207;&#65292;&#36890;&#36807;&#23427;&#21487;&#20197;&#20132;&#20114;&#24335;&#22320;&#32534;&#20889; Python &#31243;&#24207;&#12290; &#35201;&#21551;&#21160;&#23427;&#21482;&#38656;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#25105;&#20204;&#22312;&#20132;&#20114;&#35299;&#37322;&#22120;&#20013;&#28436;&#31034;Python&#31034;&#20363;&#23558;&#36143;&#31359;&#25972;&#26412;&#20070;&#12290; &#20320;&#21487;&#20197;&#29992;&#19977;&#20010;&#22823;&#20110;&#21495;
(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;/tt&gt; )&#26469;&#20998;&#36776;&#20986;&#31034;&#20363;&#65292;&#19977;&#20010;&#22823;&#20110;&#21495;&#23601;&#34920;&#31034;&#20132;&#20114;&#25552;&#31034;&#31526;&#12290; &#22914;&#26524;&#20320;&#35201;&#20174;&#26412;&#20070;&#20013;&#25335;&#36125;&#31034;&#20363;&#65292;&#35831;&#19981;&#35201;&#25335;&#36125;&#25552;&#31034;&#31526;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&#22312;&#20132;&#20114;&#24335;&#35299;&#37322;&#22120;&#20013;&#65292;&#22810;&#34892;&#22768;&#26126;&#29992;&#19977;&#20010;&#28857;
(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;...&lt;/span&gt;&lt;/tt&gt;&#65289;&#26469;&#22635;&#34917;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn63&quot;&gt;&amp;gt;&amp;gt;&amp;gt; print &quot;&quot;&quot;This is a
... string that spans
... three lines.&quot;&quot;&quot;
This is a
string that spans
three lines.
&amp;gt;&amp;gt;&amp;gt; def my_function(value):
...     print value
&amp;gt;&amp;gt;&amp;gt; my_function(&apos;hello&apos;)
hello
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#36825;&#19977;&#20010;&#22312;&#26032;&#34892;&#24320;&#22987;&#25554;&#20837;&#30340;&#28857;&#65292;&#26159;Python Shell&#33258;&#34892;&#21152;&#20837;&#30340;&#65292;&#19981;&#23646;&#20110;&#25105;&#20204;&#30340;&#36755;&#20837;&#12290; &#20294;&#26159;&#21253;&#21547;&#23427;&#20204;&#26159;&#20026;&#20102;&#36861;&#27714;&#35299;&#37322;&#22120;&#30340;&#27491;&#30830;&#36755;&#20986;&#12290; &#22914;&#26524;&#20320;&#25335;&#36125;&#25105;&#20204;&#30340;&#31034;&#20363;&#21435;&#36816;&#34892;&#65292;&#21315;&#19975;&#21035;&#25335;&#36125;&#36825;&#20123;&#28857;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn65&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#23433;&#35013;&#25968;&#25454;&#24211;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn66&quot;&gt;&#36825;&#20250;&#20799;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;django&#20889;web&#24212;&#29992;&#20102;&#65292;&#22240;&#20026;django&#21482;&#35201;&#27714;python&#27491;&#30830;&#23433;&#35013;&#21518;&#23601;&#21487;&#20197;&#36305;&#36215;&#26469;&#20102;&#12290; &#19981;&#36807;&#65292;&#24403;&#20320;&#24819;&#24320;&#21457;&#19968;&#20010;&lt;em&gt;&#25968;&#25454;&#24211;&#39537;&#21160;&lt;/em&gt;&#30340;web&#31449;&#28857;&#26102;&#65292;&#20320;&#24212;&#24403;&#38656;&#35201;&#37197;&#32622;&#19968;&#20010;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&#22914;&#26524;&#20320;&#21482;&#24819;&#29609;&#19968;&#19979;&#65292;&#21487;&#20197;&#19981;&#37197;&#32622;&#25968;&#25454;&#24211;&#65292;&#30452;&#25509;&#36339;&#21040; &#24320;&#22987;&#19968;&#20010;project &#37096;&#20998;&#21435;&#65292;&#19981;&#36807;&#20320;&#35201;&#27880;&#24847;&#26412;&#20070;&#30340;&#20363;&#23376;&#37117;&#26159;&#20551;&#35774;&#20320;&#37197;&#32622;&#22909;&#20102;&#19968;&#20010;&#27491;&#24120;&#24037;&#20316;&#30340;&#25968;&#25454;&#24211;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;Django&#25903;&#25345;&#22235;&#31181;&#25968;&#25454;&#24211;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn69&quot;&gt;PostgreSQL (&lt;a class=&quot;reference external&quot; href=&quot;http://www.postgresql.org/&quot;&gt;http://www.postgresql.org/&lt;/a&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn70&quot;&gt;SQLite 3 (&lt;a class=&quot;reference external&quot; href=&quot;http://www.sqlite.org/&quot;&gt;http://www.sqlite.org/&lt;/a&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn71&quot;&gt;MySQL (&lt;a class=&quot;reference external&quot; href=&quot;http://www.mysql.com/&quot;&gt;http://www.mysql.com/&lt;/a&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn72&quot;&gt;Oracle (&lt;a class=&quot;reference external&quot; href=&quot;http://www.oracle.com/&quot;&gt;http://www.oracle.com/&lt;/a&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&#22823;&#37096;&#20998;&#24773;&#20917;&#19979;&#65292;&#36825;&#22235;&#31181;&#25968;&#25454;&#24211;&#37117;&#20250;&#21644;Django&#26694;&#26550;&#24456;&#22909;&#30340;&#24037;&#20316;&#12290; &#65288;&#19968;&#20010;&#20540;&#24471;&#27880;&#24847;&#30340;&#20363;&#22806;&#26159;Django&#30340;&#21487;&#36873;GIS&#25903;&#25345;&#65292;&#23427;&#20026;PostgreSQL&#25552;&#20379;&#20102;&#24378;&#22823;&#30340;&#21151;&#33021;&#12290;&#65289;&#22914;&#26524;&#20320;&#19981;&#20934;&#22791;&#20351;&#29992;&#19968;&#20123;&#32769;&#26087;&#31995;&#32479;&#65292;&#32780;&#19988;&#21487;&#20197;&#33258;&#30001;&#30340;&#36873;&#25321;&#25968;&#25454;&#24211;&#21518;&#31471;&#65292;&#25105;&#20204;&#25512;&#33616;&#20320;&#20351;&#29992;PostgreSQL&#65292;&#23427;&#22312;&#25104;&#26412;&#12289;&#29305;&#24615;&#12289;&#36895;&#24230;&#21644;&#31283;&#23450;&#24615;&#26041;&#38754;&#37117;&#20570;&#30340;&#27604;&#36739;&#24179;&#34913;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#35774;&#32622;&#25968;&#25454;&#24211;&#21482;&#38656;&#35201;&#20004;&#27493;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn75&quot;&gt;&#39318;&#20808;&#65292;&#20320;&#38656;&#35201;&#23433;&#35013;&#21644;&#37197;&#32622;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#26412;&#36523;&#12290;
&#36825;&#20010;&#36807;&#31243;&#36229;&#20986;&#20102;&#26412;&#20070;&#30340;&#20869;&#23481;&#65292;&#19981;&#36807;&#36825;&#22235;&#31181;&#25968;&#25454;&#24211;&#21518;&#31471;&#22312;&#23427;&#30340;&#32593;&#31449;&#19978;&#37117;&#26377;&#20016;&#23500;&#30340;&#25991;&#26723;&#35828;&#26126;&#12290; &#22914;&#26524;&#20320;&#20351;&#29992;&#30340;&#26159;&#20849;&#20139;&#20027;&#26426;&#65292;&#21487;&#33021;&#23427;&#20204;&#24050;&#32463;&#20026;&#20320;&#35774;&#32622;&#22909;&#20102;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn76&quot;&gt;&#20854;&#27425;&#65292;&#20320;&#38656;&#35201;&#20026;&#20320;&#30340;&#26381;&#21153;&#22120;&#21518;&#31471;&#23433;&#35013;&#24517;&#35201;&#30340;Python&#24211;&#12290; &#36825;&#26159;&#19968;&#20123;&#20801;&#35768;Python&#36830;&#25509;&#25968;&#25454;&#24211;&#30340;&#31532;&#19977;&#26041;&#20195;&#30721;&#12290; &#25105;&#20204;&#20250;&#22312;&#20043;&#21518;&#30340;&#31456;&#33410;&#31616;&#35201;&#20171;&#32461;&#65292;&#23545;&#20110;&#26576;&#19968;&#31181;&#25968;&#25454;&#24211;&#26469;&#35828;&#65292;&#23427;&#21333;&#29420;&#38656;&#35201;&#23433;&#35013;&#30340;&#19996;&#35199;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#22914;&#26524;&#20320;&#21482;&#26159;&#29609;&#19968;&#19979;&#65292;&#19981;&#24819;&#23433;&#35013;&#25968;&#25454;&#24211;&#26381;&#21153;&#65292;&#37027;&#20040;&#21487;&#20197;&#32771;&#34385;&#20351;&#29992;SQLite&#12290; &#22914;&#26524;&#20320;&#29992;python2.5&#25110;&#26356;&#39640;&#29256;&#26412;&#30340;&#35805;&#65292;SQLite&#26159;&#21807;&#19968;&#19968;&#20010;&#34987;&#25903;&#25345;&#30340;&#19988;&#19981;&#38656;&#35201;&#20197;&#19978;&#23433;&#35013;&#27493;&#39588;&#30340;&#25968;&#25454;&#24211;&#12290; &#23427;&#20165;&#23545;&#20320;&#30340;&#25991;&#20214;&#31995;&#32479;&#20013;&#30340;&#21333;&#19968;&#25991;&#20214;&#35835;&#20889;&#25968;&#25454;&#65292;&#24182;&#19988;Python2.5&#21644;&#20197;&#21518;&#29256;&#26412;&#20869;&#24314;&#20102;&#23545;&#23427;&#30340;&#25903;&#25345;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#22312;Windows&#19978;&#65292;&#21462;&#24471;&#25968;&#25454;&#24211;&#39537;&#21160;&#31243;&#24207;&#21487;&#33021;&#20250;&#20196;&#20154;&#27822;&#20007;&#12290; &#22914;&#26524;&#20320;&#24613;&#30528;&#29992;&#23427;&#65292;&#25105;&#20204;&#24314;&#35758;&#20320;&#20351;&#29992;python2.5&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;django-postgresql&quot;&gt;
&lt;span id=&quot;cn79&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&#22312; Django &#20013;&#20351;&#29992; PostgreSQL&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#20351;&#29992; PostgreSQL &#30340;&#35805;&#65292;&#20320;&#38656;&#35201;&#20174; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-pgsql/&quot;&gt;http://www.djangoproject.com/r/python-pgsql/&lt;/a&gt; &#19979;&#36733; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;psycopg&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#24320;&#21457;&#21253;&#12290; &#25105;&#20204;&#24314;&#35758;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;psycopg2&lt;/span&gt;&lt;/tt&gt;&#65292;&#22240;&#20026;&#23427;&#26159;&#26032;&#30340;&#65292;&#24320;&#21457;&#27604;&#36739;&#31215;&#26497;&#65292;&#19988;&#26356;&#23481;&#26131;&#23433;&#35013;&#12290; &#30041;&#24847;&#20320;&#25152;&#29992;&#30340;&#26159; &#29256;&#26412; 1 &#36824;&#26159; 2&#65292;&#31245;&#21518;&#20320;&#20250;&#38656;&#35201;&#36825;&#39033;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#22914;&#26524;&#22312; Windows &#24179;&#21488;&#19978;&#20351;&#29992; PostgreSQL&#65292;&#21487;&#20197;&#20174; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-pgsql/windows/&quot;&gt;http://www.djangoproject.com/r/python-pgsql/windows/&lt;/a&gt; &#33719;&#21462;&#39044;&#32534;&#35793;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;psycopg&lt;/span&gt;&lt;/tt&gt; &#24320;&#21457;&#21253;&#30340;&#20108;&#36827;&#21046;&#25991;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&#22914;&#26524;&#20320;&#22312;&#29992;Linux&#65292;&#26816;&#26597;&#20320;&#30340;&#21457;&#34892;&#29256;&#30340;&#36719;&#20214;&#21253;&#31649;&#29702;&#31995;&#32479;&#26159;&#21542;&#25552;&#20379;&#20102;&#19968;&#22871;&#21483;&#20570;python-psycopg2&#65292;psycopg2-python&#65292;python-postgresql&#36825;&#31867;&#21517;&#23383;&#30340;&#21253;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django-sqlite-3&quot;&gt;
&lt;span id=&quot;cn83&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#22312; Django &#20013;&#20351;&#29992; SQLite 3&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#22914;&#26524;&#20320;&#27491;&#22312;&#20351;&#29992;Python 2.5&#29256;&#26412;&#25110;&#32773;&#26356;&#39640;&#65292;&#37027;&#20040;&#20320;&#24456;&#24184;&#36816;&#65306; &#19981;&#35201;&#27714;&#23433;&#35013;&#29305;&#23450;&#30340;&#25968;&#25454;&#24211;&#65292;&#22240;&#20026;Python&#25903;&#25345;&#21644;SQLite&#36827;&#34892;&#36890;&#20449;&#12290; &#21521;&#21069;&#36339;&#21040;&#19979;&#19968;&#33410;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&#22914;&#26524;&#20320;&#29992;&#30340;&#26159;Python2.4&#25110;&#26356;&#26089;&#30340;&#29256;&#26412;&#65292;&#20320;&#38656;&#35201; SQLite 3&lt;em&gt;&#32780;&#19981;&#26159;&lt;/em&gt;&#29256;&#26412;2&#65292;&#36825;&#20010;&#21487;&#20174;&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/sqlite/&quot;&gt;http://www.djangoproject.com/r/sqlite/&lt;/a&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pysqlite&lt;/span&gt;&lt;/tt&gt;&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-sqlite/&quot;&gt;http://www.djangoproject.com/r/python-sqlite/&lt;/a&gt; &#30830;&#35748;&#19968;&#19979;&#20320;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pysqlite&lt;/span&gt;&lt;/tt&gt;&#29256;&#26412;&#26159;2.0.3&#25110;&#32773;&#26356;&#39640;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#22312; Windows &#24179;&#21488;&#19978;&#65292;&#21487;&#20197;&#36339;&#36807;&#21333;&#29420;&#30340; SQLite &#20108;&#36827;&#21046;&#21253;&#23433;&#35013;&#24037;&#20316;&#65292;&#22240;&#20026;&#23427;&#20204;&#24050;&#34987;&#38745;&#24577;&#38142;&#25509;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pysqlite&lt;/span&gt;&lt;/tt&gt; &#20108;&#36827;&#21046;&#24320;&#21457;&#21253;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#22914;&#26524;&#20320;&#22312;&#29992;Linux&#65292;&#26816;&#26597;&#20320;&#30340;&#21457;&#34892;&#29256;&#30340;&#36719;&#20214;&#21253;&#31649;&#29702;&#31995;&#32479;&#26159;&#21542;&#25552;&#20379;&#20102;&#19968;&#22871;&#21483;&#20570;python-sqlite3&#65292;sqlite-python&#65292;pysqlite&#36825;&#31867;&#21517;&#23383;&#30340;&#21253;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django-mysql&quot;&gt;
&lt;span id=&quot;cn88&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#22312; Django &#20013;&#20351;&#29992; MySQL&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;django&#35201;&#27714;MySQL4.0&#25110;&#26356;&#39640;&#30340;&#29256;&#26412;&#12290; 3.X &#29256;&#26412;&#19981;&#25903;&#25345;&#23884;&#22871;&#23376;&#26597;&#35810;&#21644;&#19968;&#20123;&#20854;&#23427;&#30456;&#24403;&#26631;&#20934;&#30340;SQL&#35821;&#21477;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn90&quot;&gt;&#20320;&#36824;&#38656;&#35201;&#20174; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-mysql/&quot;&gt;http://www.djangoproject.com/r/python-mysql/&lt;/a&gt; &#19979;&#36733;&#23433;&#35013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MySQLdb&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#22914;&#26524;&#20320;&#27491;&#22312;&#20351;&#29992;Linux&#65292;&#26816;&#26597;&#19979;&#20320;&#31995;&#32479;&#30340;&#21253;&#31649;&#29702;&#22120;&#26159;&#21542;&#25552;&#20379;&#20102;&#21483;&#20570;python-mysql,python-mysqldb,myspl-python&#25110;&#32773;&#30456;&#20284;&#30340;&#21253;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django-oracle&quot;&gt;
&lt;span id=&quot;cn92&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#22312;Django&#20013;&#20351;&#29992;Oracle&#25968;&#25454;&#24211;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;django&#38656;&#35201;Oracle9i&#25110;&#26356;&#39640;&#29256;&#26412;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&#22914;&#26524;&#20320;&#29992;Oracle&#65292;&#20320;&#38656;&#35201;&#23433;&#35013;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cx_Oracle&lt;/span&gt;&lt;/tt&gt;&#24211;,&#21487;&#20197;&#20174;&lt;a class=&quot;reference external&quot; href=&quot;http://cx-oracle.sourceforge.net/&quot;&gt;http://cx-oracle.sourceforge.net/&lt;/a&gt;&#33719;&#24471;&#12290; &#35201;&#29992;4.3.1&#25110;&#26356;&#39640;&#29256;&#26412;&#65292;&#20294;&#35201;&#36991;&#24320;5.0&#65292;&#36825;&#26159;&#22240;&#20026;&#36825;&#20010;&#29256;&#26412;&#30340;&#39537;&#21160;&#26377;bug&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn95&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#20351;&#29992;&#26080;&#25968;&#25454;&#24211;&#25903;&#25345;&#30340; Django&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#27491;&#22914;&#20043;&#21069;&#25552;&#21450;&#36807;&#30340;&#65292;Django &#24182;&#19981;&#26159;&#38750;&#24471;&#35201;&#25968;&#25454;&#24211;&#25165;&#21487;&#20197;&#36816;&#34892;&#12290; &#22914;&#26524;&#21482;&#29992;&#23427;&#25552;&#20379;&#19968;&#20123;&#19981;&#28041;&#21450;&#25968;&#25454;&#24211;&#30340;&#21160;&#24577;&#39029;&#38754;&#26381;&#21153;&#65292;&#20063;&#21516;&#26679;&#21487;&#20197;&#23436;&#32654;&#36816;&#34892;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#23613;&#31649;&#22914;&#27492;&#65292;&#36824;&#26159;&#35201;&#35760;&#20303;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;Django &#25152;&#25414;&#32465;&#30340;&#19968;&#20123;&#38468;&#21152;&#24037;&#20855; &#19968;&#23450; &#38656;&#35201;&#25968;&#25454;&#24211;&#65292;&#22240;&#27492;&#22914;&#26524;&#36873;&#25321;&#19981;&#20351;&#29992;&#25968;&#25454;&#24211;&#65292;&#20320;&#23558;&#19981;&#33021;&#20351;&#29992;&#37027;&#20123;&#21151;&#33021;&#12290; (&#25105;&#20204;&#23558;&#22312;&#26412;&#20070;&#20013;&#33258;&#22987;&#33267;&#32456;&#24378;&#35843;&#36825;&#20123;&#21151;&#33021;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn98&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#24320;&#22987;&#19968;&#20010;&#39033;&#30446;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#19968;&#20294;&#20320;&#23433;&#35013;&#22909;&#20102;python&#65292;django&#21644;&#65288;&#21487;&#36873;&#30340;&#65289;&#25968;&#25454;&#24211;&#21450;&#30456;&#20851;&#24211;&#65292;&#20320;&#23601;&#21487;&#20197;&#36890;&#36807;&#21019;&#24314;&#19968;&#20010;&lt;em&gt;project&lt;/em&gt;&#65292;&#36808;&#20986;&#24320;&#21457;django&#24212;&#29992;&#30340;&#31532;&#19968;&#27493;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#39033;&#30446; &#26159; Django &#23454;&#20363;&#30340;&#19968;&#31995;&#21015;&#35774;&#32622;&#30340;&#38598;&#21512;&#65292;&#23427;&#21253;&#25324;&#25968;&#25454;&#24211;&#37197;&#32622;&#12289;Django &#29305;&#23450;&#36873;&#39033;&#20197;&#21450;&#24212;&#29992;&#31243;&#24207;&#30340;&#29305;&#23450;&#35774;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&#22914;&#26524;&#31532;&#19968;&#27425;&#20351;&#29992; Django&#65292;&#24517;&#39035;&#36827;&#34892;&#19968;&#20123;&#21021;&#22987;&#21270;&#35774;&#32622;&#24037;&#20316;&#12290; &#26032;&#24314;&#19968;&#20010;&#24037;&#20316;&#30446;&#24405;&#65292;&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/home/username/djcode/&lt;/span&gt;&lt;/tt&gt; &#65292;&#28982;&#21518;&#36827;&#20837;&#35813;&#30446;&#24405;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn102&quot;&gt;&#36825;&#20010;&#30446;&#24405;&#24212;&#35813;&#25918;&#21738;&#20799;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#26377;&#36807; PHP &#32534;&#31243;&#32972;&#26223;&#30340;&#35805;&#65292;&#20320;&#21487;&#33021;&#20064;&#24815;&#20110;&#23558;&#20195;&#30721;&#37117;&#25918;&#22312; Web &#26381;&#21153;&#22120;&#30340;&#25991;&#26723;&#26681;&#30446;&#24405; (&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/var/www&lt;/span&gt;&lt;/tt&gt; &#36825;&#26679;&#30340;&#22320;&#26041;)&#12290; &#32780;&#22312; Django &#20013;&#65292;&#25226;&#20219;&#20309;Python&#20195;&#30721;&#21644;web server&#30340;&#25991;&#26723;&#26681;(root)&#25918;&#22312;&#19968;&#36215;&#24182;&#19981;&#26159;&#19968;&#20010;&#22909;&#20027;&#24847;&#12290;&#22240;&#20026;&#36825;&#26679;&#20570;&#26377;&#20351;&#20154;&#33021;&#36890;&#36807;&#32593;&#36335;&#30475;&#21040;&#20320;&#21407;&#20195;&#30721;&#30340;&#39118;&#38505;. &#37027;&#23601;&#22826;&#31967;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&#25226;&#20195;&#30721;&#25918;&#32622;&#22312;&#25991;&#26723;&#26681;&#30446;&#24405; &lt;strong&gt;&#20043;&#22806;&lt;/strong&gt; &#30340;&#26576;&#20123;&#30446;&#24405;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&#36716;&#21040;&#20320;&#21019;&#24314;&#30340;&#30446;&#24405;&#65292;&#36816;&#34892;&#21629;&#20196;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;mysite&lt;/span&gt;&lt;/tt&gt;&#12290;&#36825;&#26679;&#20250;&#22312;&#20320;&#30340;&#24403;&#21069;&#30446;&#24405;&#19979;&#21019;&#24314;&#19968;&#20010;&#30446;&#24405;&#12290;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#22914;&#26524;&#29992;&#30340;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;setup.py&lt;/span&gt;&lt;/tt&gt; &#24037;&#20855;&#23433;&#35013;&#30340; Django &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt;&lt;/tt&gt; &#24212;&#35813;&#24050;&#34987;&#21152;&#20837;&#20102;&#31995;&#32479;&#36335;&#24452;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&#22914;&#26524;&#20320;&#20351;&#29992;&#19968;&#20010;trunk&#29256;&#26412;&#65292;&#20320;&#20250;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;djtrunk/django/bin&lt;/span&gt;&lt;/tt&gt;
&#19979;&#21457;&#29616; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt;&lt;/tt&gt; &#12290;&#20320;&#23558;&#26469;&#20250;&#24120;&#29992;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt;&lt;/tt&gt;&#65292;&#32771;&#34385;&#25226;&#23427;&#21152;&#21040;&#20320;&#30340;&#31995;&#32479;&#36335;&#24452;&#20013;&#21435;&#27604;&#36739;&#22909;&#12290; &#22312;Unix&#20013;, &#20320;&#20063;&#21487;&#20197;&#29992;&#26469;&#33258;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/usr/local/bin&lt;/span&gt;&lt;/tt&gt; &#30340;&#31526;&#21495;&#36830;&#25509;, &#29992;&#19968;&#20010;&#21629;&#20196;, &#35832;&#22914;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;/path/to/django/bin/django-admin.py&lt;/span&gt;
&lt;span class=&quot;pre&quot;&gt;/usr/local/bin/django-admin.py&lt;/span&gt;&lt;/tt&gt; . &#22312;Windows&#20013;, &#20320;&#38656;&#35201;&#20462;&#25913;&#20320;&#30340;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PATH&lt;/span&gt;&lt;/tt&gt; &#29615;&#22659;&#21464;&#37327;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&#22914;&#26524;&#20320;&#30340;django&#26159;&#20174;linux&#21457;&#34892;&#29256;&#20013;&#23433;&#35013;&#30340;&#65292;&#37027;&#20040;&#65292;&#24120;&#20250;&#34987;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt;&lt;/tt&gt;&#26367;&#20195;&#12290;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&#22914;&#26524;&#22312;&#36816;&#34892;&#26102;&#65292;&#20320;&#30475;&#21040;&#26435;&#38480;&#25298;&#32477;&#30340;&#25552;&#31034;&#65292;&#20320;&#24212;&#24403;&#20462;&#25913;&#36825;&#20010;&#25991;&#20214;&#30340;&#26435;&#38480;&#12290;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt;&lt;/tt&gt; &#20026;&#27492;, &#38190;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;/usr/local/bin&lt;/span&gt;&lt;/tt&gt;&#36716;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt;&lt;/tt&gt;&#25152;&#22312;&#30340;&#30446;&#24405;&#65292;&#36816;&#34892;&#21629;&#20196;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;chmod&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;+x&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#21019;&#24314;&#19968;&#20010;&#30446;&#24405;&#65292;&#21253;&#21547;4&#20010;&#25991;&#20214;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn113&quot;&gt;mysite/
    __init__.py
    manage.py
    settings.py
    urls.py
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#25991;&#20214;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn115&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__init__.py&lt;/span&gt;&lt;/tt&gt; &#65306;&#35753; Python &#25226;&#35813;&#30446;&#24405;&#24403;&#25104;&#19968;&#20010;&#24320;&#21457;&#21253; (&#21363;&#19968;&#32452;&#27169;&#22359;)&#25152;&#38656;&#30340;&#25991;&#20214;&#12290; &#36825;&#26159;&#19968;&#20010;&#31354;&#25991;&#20214;&#65292;&#19968;&#33324;&#20320;&#19981;&#38656;&#35201;&#20462;&#25913;&#23427;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn116&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn116&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt;&lt;/tt&gt; &#65306;&#19968;&#31181;&#21629;&#20196;&#34892;&#24037;&#20855;&#65292;&#20801;&#35768;&#20320;&#20197;&#22810;&#31181;&#26041;&#24335;&#19982;&#35813; Django &#39033;&#30446;&#36827;&#34892;&#20132;&#20114;&#12290; &#38190;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;help&lt;/span&gt;&lt;/tt&gt;&#65292;&#30475;&#19968;&#19979;&#23427;&#33021;&#20570;&#20160;&#20040;&#12290; &#20320;&#24212;&#24403;&#19981;&#38656;&#35201;&#32534;&#36753;&#36825;&#20010;&#25991;&#20214;&#65307;&#22312;&#36825;&#20010;&#30446;&#24405;&#19979;&#29983;&#25104;&#23427;&#32431;&#26159;&#20026;&#20102;&#26041;&#20415;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn117&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;settings.py&lt;/span&gt;&lt;/tt&gt; &#65306;&#35813; Django &#39033;&#30446;&#30340;&#35774;&#32622;&#25110;&#37197;&#32622;&#12290; &#26597;&#30475;&#24182;&#29702;&#35299;&#36825;&#20010;&#25991;&#20214;&#20013;&#21487;&#29992;&#30340;&#35774;&#32622;&#31867;&#22411;&#21450;&#20854;&#40664;&#35748;&#20540;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn118&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urls.py&lt;/span&gt;&lt;/tt&gt;&#65306;Django&#39033;&#30446;&#30340;URL&#35774;&#32622;&#12290; &#21487;&#35270;&#20854;&#20026;&#20320;&#30340;django&#32593;&#31449;&#30340;&#30446;&#24405;&#12290; &#30446;&#21069;&#65292;&#23427;&#26159;&#31354;&#30340;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#23613;&#31649;&#36825;&#20123;&#30340;&#25991;&#20214;&#24456;&#23567;&#65292;&#20294;&#36825;&#20123;&#25991;&#20214;&#24050;&#32463;&#26500;&#25104;&#20102;&#19968;&#20010;&#21487;&#36816;&#34892;&#30340;Django&#24212;&#29992;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn120&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn120&quot;&gt;&#36816;&#34892;&#24320;&#21457;&#26381;&#21153;&#22120;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn121&quot;&gt;&#20026;&#20102;&#23433;&#35013;&#21518;&#26356;&#22810;&#30340;&#20307;&#39564;&#65292;&#35753;&#25105;&#20204;&#36816;&#34892;&#19968;&#19979;django&#24320;&#21457;&#26381;&#21153;&#22120;&#30475;&#30475;&#25105;&#20204;&#30340;&#20934;&#31995;&#32479;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn122&quot;&gt;django&#24320;&#21457;&#26381;&#21153;&#26159;&#21487;&#29992;&#22312;&#24320;&#21457;&#26399;&#38388;&#30340;&#65292;&#19968;&#20010;&#20869;&#24314;&#30340;&#65292;&#36731;&#37327;&#30340;web&#26381;&#21153;&#12290; &#25105;&#20204;&#25552;&#20379;&#36825;&#20010;&#26381;&#21153;&#22120;&#26159;&#20026;&#20102;&#35753;&#20320;&#24555;&#36895;&#24320;&#21457;&#31449;&#28857;&#65292;&#20063;&#23601;&#26159;&#35828;&#22312;&#20934;&#22791;&#21457;&#24067;&#20135;&#21697;&#20043;&#21069;&#65292;&#26080;&#38656;&#36827;&#34892;&#20135;&#21697;&#32423; Web &#26381;&#21153;&#22120;&#65288;&#27604;&#22914; Apache&#65289;&#30340;&#37197;&#32622;&#24037;&#20316;&#12290; &#24320;&#21457;&#26381;&#21153;&#22120;&#30417;&#27979;&#20320;&#30340;&#20195;&#30721;&#24182;&#33258;&#21160;&#21152;&#36733;&#23427;&#65292;&#36825;&#26679;&#20320;&#20250;&#24456;&#23481;&#26131;&#20462;&#25913;&#20195;&#30721;&#32780;&#19981;&#29992;&#37325;&#21551;&#21160;&#26381;&#21153;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&#22914;&#26524;&#20320;&#36824;&#27809;&#21551;&#21160;&#26381;&#21153;&#22120;&#30340;&#35805;&#65292;&#35831;&#20999;&#25442;&#21040;&#20320;&#30340;&#39033;&#30446;&#30446;&#24405;&#37324; (&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;mysite&lt;/span&gt;&lt;/tt&gt; )&#65292;&#36816;&#34892;&#19979;&#38754;&#30340;&#21629;&#20196;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn125&quot;&gt;python manage.py runserver
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn126&quot;&gt;&#20320;&#20250;&#30475;&#21040;&#20123;&#20687;&#36825;&#26679;&#30340;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn128&quot;&gt;Validating models...
0 errors found.

Django version 1.0, using settings &apos;mysite.settings&apos;
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#36825;&#23558;&#20250;&#22312;&#31471;&#21475;8000&#21551;&#21160;&#19968;&#20010;&#26412;&#22320;&#26381;&#21153;&#22120;, &#24182;&#19988;&#21482;&#33021;&#20174;&#20320;&#30340;&#36825;&#21488;&#30005;&#33041;&#36830;&#25509;&#21644;&#35775;&#38382;&#12290; &#26082;&#28982;&#26381;&#21153;&#22120;&#24050;&#32463;&#36816;&#34892;&#36215;&#26469;&#20102;&#65292;&#29616;&#22312;&#29992;&#32593;&#39029;&#27983;&#35272;&#22120;&#35775;&#38382; &lt;a class=&quot;reference external&quot; href=&quot;http://127.0.0.1:8000/&quot;&gt;http://127.0.0.1:8000/&lt;/a&gt; &#12290; &#20320;&#24212;&#35813;&#21487;&#20197;&#30475;&#21040;&#19968;&#20010;&#20196;&#20154;&#36175;&#24515;&#24742;&#30446;&#30340;&#28129;&#34013;&#33394;Django&#27426;&#36814;&#39029;&#38754;&#12290; &#23427;&#24320;&#22987;&#24037;&#20316;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#22312;&#36827;&#19968;&#27493;&#23398;&#20064;&#20043;&#21069;&#65292; &#19968;&#20010;&#37325;&#35201;&#30340;&#65292;&#20851;&#20110;&#24320;&#21457;&#32593;&#32476;&#26381;&#21153;&#22120;&#30340;&#25552;&#31034;&#24456;&#20540;&#24471;&#19968;&#35828;&#12290; &#34429;&#28982; django &#33258;&#24102;&#30340;&#36825;&#20010; web &#26381;&#21153;&#22120;&#23545;&#20110;&#24320;&#21457;&#24456;&#26041;&#20415;&#65292;&#20294;&#26159;&#65292;&#21315;&#19975;&#19981;&#35201;&#22312;&#27491;&#24335;&#30340;&#24212;&#29992;&#24067;&#32626;&#29615;&#22659;&#20013;&#20351;&#29992;&#23427;&#12290; &#22312;&#21516;&#19968;&#26102;&#38388;&#65292;&#35813;&#26381;&#21153;&#22120;&#21482;&#33021;&#21487;&#38752;&#22320;&#22788;&#29702;&#19968;&#27425;&#21333;&#20010;&#35831;&#27714;&#65292;&#24182;&#19988;&#27809;&#26377;&#36827;&#34892;&#20219;&#20309;&#31867;&#22411;&#30340;&#23433;&#20840;&#23457;&#35745;&#12290; &#21457;&#24067;&#31449;&#28857;&#21069;&#65292;&#35831;&#21442;&#38405;&#31532; 20 &#31456;&#20102;&#35299;&#22914;&#20309;&#37096;&#32626; Django &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#26356;&#25913;&#36825;&#20010; Development Server &#30340;&#20027;&#26426;&#22320;&#22336;&#25110;&#31471;&#21475;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&#40664;&#35748;&#24773;&#20917;&#19979;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;runserver&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#22312; 8000 &#31471;&#21475;&#21551;&#21160;&#24320;&#21457;&#26381;&#21153;&#22120;&#65292;&#19988;&#20165;&#30417;&#21548;&#26412;&#22320;&#36830;&#25509;&#12290; &#35201;&#24819;&#35201;&#26356;&#25913;&#26381;&#21153;&#22120;&#31471;&#21475;&#30340;&#35805;&#65292;&#21487;&#23558;&#31471;&#21475;&#20316;&#20026;&#21629;&#20196;&#34892;&#21442;&#25968;&#20256;&#20837;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn134&quot;&gt;python manage.py runserver 8080
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#36890;&#36807;&#25351;&#23450;&#19968;&#20010; IP &#22320;&#22336;&#65292;&#20320;&#21487;&#20197;&#21578;&#35785;&#26381;&#21153;&#22120;&#8211;&#20801;&#35768;&#38750;&#26412;&#22320;&#36830;&#25509;&#35775;&#38382;&#12290; &#22914;&#26524;&#20320;&#24819;&#21644;&#20854;&#20182;&#24320;&#21457;&#20154;&#21592;&#20849;&#20139;&#21516;&#19968;&#24320;&#21457;&#31449;&#28857;&#30340;&#35805;&#65292;&#35813;&#21151;&#33021;&#29305;&#21035;&#26377;&#29992;&#12290; `` 0.0.0.0`` &#36825;&#20010; IP &#22320;&#22336;&#65292;&#21578;&#35785;&#26381;&#21153;&#22120;&#21435;&#20390;&#21548;&#20219;&#24847;&#30340;&#32593;&#32476;&#25509;&#21475;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn137&quot;&gt;python manage.py runserver 0.0.0.0:8000
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#23436;&#25104;&#36825;&#20123;&#35774;&#32622;&#21518;&#65292;&#20320;&#26412;&#22320;&#32593;&#32476;&#20013;&#30340;&#20854;&#23427;&#35745;&#31639;&#26426;&#23601;&#21487;&#20197;&#22312;&#27983;&#35272;&#22120;&#20013;&#35775;&#38382;&#20320;&#30340; IP &#22320;&#22336;&#20102;&#12290;&#27604;&#22914;&#65306;
&lt;a class=&quot;reference external&quot; href=&quot;http://192.168.1.103:8000/&quot;&gt;http://192.168.1.103:8000/&lt;/a&gt; . (&#27880;&#24847;&#65292;&#20320;&#23558;&#38656;&#35201;&#26657;&#38405;&#19968;&#19979;&#20320;&#30340;&#32593;&#32476;&#37197;&#32622;&#26469;&#20915;&#23450;&#20320;&#22312;&#26412;&#22320;&#32593;&#32476;&#20013;&#30340;IP &#22320;&#22336;) Unix&#29992;&#25143;&#21487;&#20197;&#22312;&#21629;&#20196;&#25552;&#31034;&#31526;&#20013;&#36755;&#20837;ifconfig&#26469;&#33719;&#21462;&#20197;&#19978;&#20449;&#24687;&#12290; &#20351;&#29992;Windows&#30340;&#29992;&#25143;&#65292;&#35831;&#23581;&#35797;&#20351;&#29992; ipconfig &#21629;&#20196;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn139&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&#25509;&#19979;&#26469;&#20570;&#20160;&#20040;?&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn140&quot;&gt;&#22909;&#20102;&#65292;&#20320;&#24050;&#32463;&#23433;&#35013;&#22909;&#25152;&#38656;&#30340;&#19968;&#20999;&#65292; &#24182;&#19988;&#24320;&#21457;&#26381;&#21153;&#22120;&#20063;&#36816;&#34892;&#36215;&#26469;&#20102;&#65292;&#20320;&#24050;&#32463;&#20934;&#22791;&#22909;&#32487;&#32493; &lt;a class=&quot;reference external&quot; href=&quot;../chapter03/&quot;&gt;&#23398;&#20064;&#22522;&#30784;&#30693;&#35782;&#8211;&#29992;Django&#20282;&#20505;&#32593;&#38913;&lt;/a&gt; &#36825;&#19968;&#31456;&#30340;&#20869;&#23481;&#20102;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter03</id>
        <title type="html">chapter03</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter03"/>
        <published>2015-02-26T23:31:21+08:00</published>
        <updated>2015-02-26T23:31:21+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;url&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#19977;&#31456; &#35270;&#22270;&#21644;URL&#37197;&#32622;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#21069;&#19968;&#31456;&#20013;&#65292;&#25105;&#20204;&#35299;&#37322;&#20102;&#22914;&#20309;&#24314;&#31435;&#19968;&#20010; Django &#39033;&#30446;&#24182;&#21551;&#21160; Django &#24320;&#21457;&#26381;&#21153;&#22120;&#12290; &#22312;&#36825;&#19968;&#31456;&#65292;&#20320;&#23558;&#20250;&#23398;&#21040;&#29992;Django&#21019;&#24314;&#21160;&#24577;&#32593;&#39029;&#30340;&#22522;&#26412;&#30693;&#35782;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;django-hello-world&quot;&gt;
&lt;span id=&quot;cn2&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#20320;&#30340;&#31532;&#19968;&#20010;&#22522;&#20110;Django&#30340;&#39029;&#38754;&#65306; Hello World&lt;/h2&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;&#27491;&#22914;&#25105;&#20204;&#30340;&#31532;&#19968;&#20010;&#30446;&#26631;&#65292;&#21019;&#24314;&#19968;&#20010;&#32593;&#39029;&#65292;&#29992;&#26469;&#36755;&#20986;&#36825;&#20010;&#33879;&#21517;&#30340;&#31034;&#20363;&#20449;&#24687;&#65306;&lt;/dt&gt;
&lt;dd&gt;&lt;p class=&quot;first last cn&quot; id=&quot;cn3&quot;&gt;Hello world.&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#22914;&#26524;&#20320;&#26366;&#32463;&#21457;&#24067;&#36807;Hello world&#39029;&#38754;&#65292;&#20294;&#26159;&#27809;&#26377;&#20351;&#29992;&#32593;&#39029;&#26694;&#26550;&#65292;&#21482;&#26159;&#31616;&#21333;&#30340;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hello.html&lt;/span&gt;&lt;/tt&gt;&#25991;&#26412;&#25991;&#20214;&#20013;&#36755;&#20837;Hello World&#65292;&#28982;&#21518;&#19978;&#20256;&#21040;&#20219;&#24847;&#30340;&#19968;&#20010;&#32593;&#39029;&#26381;&#21153;&#22120;&#19978;&#12290; &#27880;&#24847;&#65292;&#22312;&#36825;&#20010;&#36807;&#31243;&#20013;&#65292;&#20320;&#24050;&#32463;&#35828;&#26126;&#20102;&#20004;&#20010;&#20851;&#20110;&#36825;&#20010;&#32593;&#39029;&#30340;&#20851;&#38190;&#20449;&#24687;&#65306; &#23427;&#21253;&#25324;&#65288;&#23383;&#31526;&#20018;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;Hello&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;world&quot;&lt;/span&gt;&lt;/tt&gt;&#65289;&#21644;&#23427;&#30340;URL( &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://www.example.com/hello.html&lt;/span&gt;&lt;/tt&gt; , &#22914;&#26524;&#20320;&#25226;&#25991;&#20214;&#25918;&#22312;&#23376;&#30446;&#24405;&#65292;&#20063;&#21487;&#33021;&#26159;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://www.example.com/files/hello.html&lt;/span&gt;&lt;/tt&gt;)&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&#20351;&#29992;Django&#65292;&#20320;&#20250;&#29992;&#19981;&#21516;&#30340;&#26041;&#27861;&#26469;&#35828;&#26126;&#36825;&#20004;&#20214;&#20107; &#39029;&#38754;&#30340;&#20869;&#23481;&#26159;&#38752;&lt;em&gt;view function&#65288;&#35270;&#22270;&#20989;&#25968;&#65289;&lt;/em&gt; &#26469;&#20135;&#29983;&#65292;URL&#23450;&#20041;&#22312; &lt;em&gt;URLconf&lt;/em&gt; &#20013;&#12290;&#39318;&#20808;&#65292;&#25105;&#20204;&#20808;&#20889;&#19968;&#20010;Hello World&#35270;&#22270;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id1&quot;&gt;
&lt;span id=&quot;cn6&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&#31532;&#19968;&#20221;&#35270;&#22270;&#65306;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#22312;&#19978;&#19968;&#31456;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt;&lt;/tt&gt;&#21046;&#20316;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite&lt;/span&gt;&lt;/tt&gt;&#25991;&#20214;&#22841;&#20013;&#65292;&#21019;&#24314;&#19968;&#20010;&#21483;&#20570;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;views.py&lt;/span&gt;&lt;/tt&gt;&#30340;&#31354;&#25991;&#20214;&#12290;&#36825;&#20010;Python&#27169;&#22359;&#23558;&#21253;&#21547;&#36825;&#19968;&#31456;&#30340;&#35270;&#22270;&#12290; &#35831;&#30041;&#24847;&#65292;Django&#23545;&#20110;view.py&#30340;&#25991;&#20214;&#21629;&#21517;&#27809;&#26377;&#29305;&#21035;&#30340;&#35201;&#27714;&#65292;&#23427;&#19981;&#22312;&#20046;&#36825;&#20010;&#25991;&#20214;&#21483;&#20160;&#20040;&#12290;&#20294;&#26159;&#26681;&#25454;&#32422;&#23450;&#65292;&#25226;&#23427;&#21629;&#21517;&#25104;view.py&#26159;&#20010;&#22909;&#20027;&#24847;&#65292;&#36825;&#26679;&#26377;&#21033;&#20110;&#20854;&#20182;&#24320;&#21457;&#32773;&#35835;&#25026;&#20320;&#30340;&#20195;&#30721;&#65292;&#27491;&#22914;&#20320;&#24456;&#23481;&#26131;&#30340;&#24448;&#19979;&#35835;&#25026;&#26412;&#25991;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#25105;&#20204;&#30340;Hello world&#35270;&#22270;&#38750;&#24120;&#31616;&#21333;&#12290; &#36825;&#20123;&#26159;&#23436;&#25972;&#30340;&#20989;&#25968;&#21644;&#23548;&#20837;&#22768;&#26126;&#65292;&#20320;&#38656;&#35201;&#36755;&#20837;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;views.py&lt;/span&gt;&lt;/tt&gt;&#25991;&#20214;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn10&quot;&gt;from django.http import HttpResponse

def hello(request):
    return HttpResponse(&quot;Hello world&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#25105;&#20204;&#36880;&#34892;&#36880;&#21477;&#22320;&#20998;&#26512;&#19968;&#36941;&#36825;&#27573;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&#39318;&#20808;&#65292;&#25105;&#20204;&#20174; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.http&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#23548;&#20837;&#65288;import&#65289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#31867;&#12290;&#21442;&#38405;&#38468;&#24405; H &#20102;&#35299;&#26356;&#22810;&#20851;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#30340;&#32454;&#33410;&#12290; &#25105;&#20204;&#38656;&#35201;&#23548;&#20837;&#36825;&#20123;&#31867;&#65292;&#22240;&#20026;&#25105;&#20204;&#20250;&#22312;&#21518;&#38754;&#29992;&#21040;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#25105;&#20204;&#23450;&#20041;&#19968;&#20010;&#21483;&#20570;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hello&lt;/span&gt;&lt;/tt&gt; &#30340;&#35270;&#22270;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&#27599;&#20010;&#35270;&#22270;&#20989;&#25968;&#33267;&#23569;&#35201;&#26377;&#19968;&#20010;&#21442;&#25968;&#65292;&#36890;&#24120;&#34987;&#21483;&#20316;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt;&#12290; &#36825;&#26159;&#19968;&#20010;&#35302;&#21457;&#36825;&#20010;&#35270;&#22270;&#12289;&#21253;&#21547;&#24403;&#21069;Web&#35831;&#27714;&#20449;&#24687;&#30340;&#23545;&#35937;&#65292;&#26159;&#31867;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.http.HttpRequest&lt;/span&gt;&lt;/tt&gt;&#30340;&#19968;&#20010;&#23454;&#20363;&#12290;&#22312;&#36825;&#20010;&#31034;&#20363;&#20013;&#65292;&#25105;&#20204;&#34429;&#28982;&#19981;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt;&#20570;&#20219;&#20309;&#20107;&#24773;&#65292;&#28982;&#32780;&#23427;&#20173;&#24517;&#39035;&#26159;&#36825;&#20010;&#35270;&#22270;&#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#27880;&#24847;&#35270;&#22270;&#20989;&#25968;&#30340;&#21517;&#31216;&#24182;&#19981;&#37325;&#35201;&#65307;&#24182;&#19981;&#19968;&#23450;&#38750;&#24471;&#20197;&#26576;&#31181;&#29305;&#23450;&#30340;&#26041;&#24335;&#21629;&#21517;&#25165;&#33021;&#35753; Django &#35782;&#21035;&#23427;&#12290; &#22312;&#36825;&#37324;&#25105;&#20204;&#25226;&#23427;&#21629;&#21517;&#20026;&#65306;hello&#65292;&#26159;&#22240;&#20026;&#36825;&#20010;&#21517;&#31216;&#28165;&#26224;&#30340;&#26174;&#31034;&#20102;&#35270;&#22270;&#30340;&#29992;&#24847;&#12290;&#21516;&#26679;&#22320;&#65292;&#20320;&#21487;&#20197;&#29992;&#35832;&#22914;&#65306;hello_wonderful_beautiful_world&#65292;&#36825;&#26679;&#38590;&#30475;&#30340;&#30701;&#21477;&#26469;&#32473;&#23427;&#21629;&#21517;&#12290; &#22312;&#19979;&#19968;&#23567;&#33410;&#65288;Your First URLconf&#65289;&#65292;&#23558;&#21578;&#35785;&#20320;Django&#26159;&#22914;&#20309;&#25214;&#21040;&#36825;&#20010;&#20989;&#25968;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#36825;&#20010;&#20989;&#25968;&#21482;&#26377;&#31616;&#21333;&#30340;&#19968;&#34892;&#20195;&#30721;&#65306; &#23427;&#20165;&#20165;&#36820;&#22238;&#19968;&#20010;HttpResponse&#23545;&#35937;&#65292;&#36825;&#20010;&#23545;&#35937;&#21253;&#21547;&#20102;&#25991;&#26412;&#8220;Hello world&#8221;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#36825;&#37324;&#20027;&#35201;&#35762;&#30340;&#26159;&#65306; &#19968;&#20010;&#35270;&#22270;&#23601;&#26159;Python&#30340;&#19968;&#20010;&#20989;&#25968;&#12290;&#36825;&#20010;&#20989;&#25968;&#31532;&#19968;&#20010;&#21442;&#25968;&#30340;&#31867;&#22411;&#26159;HttpRequest&#65307;&#23427;&#36820;&#22238;&#19968;&#20010;HttpResponse&#23454;&#20363;&#12290;&#20026;&#20102;&#20351;&#19968;&#20010;Python&#30340;&#20989;&#25968;&#25104;&#20026;&#19968;&#20010;Django&#21487;&#35782;&#21035;&#30340;&#35270;&#22270;&#65292;&#23427;&#24517;&#39035;&#28385;&#36275;&#36825;&#20004;&#20010;&#26465;&#20214;&#12290;
&#65288;&#20063;&#26377;&#20363;&#22806;&#65292;&#20294;&#26159;&#25105;&#20204;&#31245;&#21518;&#25165;&#20250;&#25509;&#35302;&#21040;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;urlconf&quot;&gt;
&lt;span id=&quot;cn18&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#20320;&#30340;&#31532;&#19968;&#20010;URLconf&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#29616;&#22312;&#65292;&#22914;&#26524;&#20320;&#20877;&#36816;&#34892;&#65306;python manage.py runserver&#65292;&#20320;&#36824;&#23558;&#30475;&#21040;Django&#30340;&#27426;&#36814;&#39029;&#38754;&#65292;&#32780;&#30475;&#19981;&#21040;&#25105;&#20204;&#21018;&#25165;&#20889;&#30340;Hello world&#26174;&#31034;&#39029;&#38754;&#12290;
&#37027;&#26159;&#22240;&#20026;&#25105;&#20204;&#30340;mysite&#39033;&#30446;&#36824;&#23545;hello&#35270;&#22270;&#19968;&#26080;&#25152;&#30693;&#12290;&#25105;&#20204;&#38656;&#35201;&#36890;&#36807;&#19968;&#20010;&#35814;&#32454;&#25551;&#36848;&#30340;URL&#26469;&#26174;&#24335;&#30340;&#21578;&#35785;&#23427;&#24182;&#19988;&#28608;&#27963;&#36825;&#20010;&#35270;&#22270;&#12290;
&#65288;&#32487;&#32493;&#25105;&#20204;&#21018;&#25165;&#31867;&#20284;&#21457;&#24067;&#38745;&#24577;HTML&#25991;&#20214;&#30340;&#20363;&#23376;&#12290;&#29616;&#22312;&#25105;&#20204;&#24050;&#32463;&#21019;&#24314;&#20102;HTML&#25991;&#20214;&#65292;&#20294;&#36824;&#27809;&#26377;&#25226;&#23427;&#19978;&#20256;&#33267;&#26381;&#21153;&#22120;&#30340;&#30446;&#24405;&#12290;&#65289;&#20026;&#20102;&#32465;&#23450;&#35270;&#22270;&#20989;&#25968;&#21644;URL&#65292;&#25105;&#20204;&#20351;&#29992;URLconf&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&lt;em&gt;URLconf&lt;/em&gt; &#23601;&#20687;&#26159; Django &#25152;&#25903;&#25745;&#32593;&#31449;&#30340;&#30446;&#24405;&#12290;
&#23427;&#30340;&#26412;&#36136;&#26159; URL &#27169;&#24335;&#20197;&#21450;&#35201;&#20026;&#35813; URL &#27169;&#24335;&#35843;&#29992;&#30340;&#35270;&#22270;&#20989;&#25968;&#20043;&#38388;&#30340;&#26144;&#23556;&#34920;&#12290; &#20320;&#23601;&#26159;&#20197;&#36825;&#31181;&#26041;&#24335;&#21578;&#35785; Django&#65292;&#23545;&#20110;&#36825;&#20010; URL &#35843;&#29992;&#36825;&#27573;&#20195;&#30721;&#65292;&#23545;&#20110;&#37027;&#20010; URL &#35843;&#29992;&#37027;&#27573;&#20195;&#30721;&#12290; &#20363;&#22914;&#65292;&#24403;&#29992;&#25143;&#35775;&#38382;/foo/&#26102;&#65292;&#35843;&#29992;&#35270;&#22270;&#20989;&#25968;foo_view()&#65292;&#36825;&#20010;&#35270;&#22270;&#20989;&#25968;&#23384;&#22312;&#20110;Python&#27169;&#22359;&#25991;&#20214;view.py&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#21069;&#19968;&#31456;&#20013;&#25191;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt;&lt;/tt&gt; &#26102;&#65292;&#35813;&#33050;&#26412;&#20250;&#33258;&#21160;&#20026;&#20320;&#24314;&#20102;&#19968;&#20221; URLconf&#65288;&#21363; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urls.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#65289;&#12290; &#40664;&#35748;&#30340;urls.py&#20250;&#20687;&#19979;&#38754;&#36825;&#20010;&#26679;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn23&quot;&gt;from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns(&apos;&apos;,
    # Example:
    # (r&apos;^mysite/&apos;, include(&apos;mysite.foo.urls&apos;)),

    # Uncomment the admin/doc line below and add &apos;django.contrib.admindocs&apos;
    # to INSTALLED_APPS to enable admin documentation:
    # (r&apos;^admin/doc/&apos;, include(&apos;django.contrib.admindocs.urls&apos;)),

    # Uncomment the next line to enable the admin:
    # (r&apos;^admin/&apos;, include(admin.site.urls)),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#40664;&#35748;&#30340;URLconf&#21253;&#21547;&#20102;&#19968;&#20123;&#34987;&#27880;&#37322;&#36215;&#26469;&#30340;Django&#20013;&#24120;&#29992;&#30340;&#21151;&#33021;&#65292;&#20165;&#20165;&#21482;&#38656;&#21435;&#25481;&#36825;&#20123;&#27880;&#37322;&#23601;&#21487;&#20197;&#24320;&#21551;&#36825;&#20123;&#21151;&#33021;. &#19979;&#38754;&#26159;URLconf&#20013;&#24573;&#30053;&#34987;&#27880;&#37322;&#30340;&#34892;&#21518;&#30340;&#23454;&#38469;&#20869;&#23481;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn26&quot;&gt;from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&#35753;&#25105;&#20204;&#36880;&#34892;&#35299;&#37322;&#19968;&#19979;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn28&quot;&gt;&#31532;&#19968;&#34892;&#23548;&#20837;django.conf.urls.defaults&#19979;&#30340;&#25152;&#26377;&#27169;&#22359;&#65292;&#23427;&#20204;&#26159;Django URLconf&#30340;&#22522;&#26412;&#26500;&#36896;&#12290; &#36825;&#21253;&#21547;&#20102;&#19968;&#20010;patterns&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn29&quot;&gt;&#31532;&#20108;&#34892;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;patterns()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#24182;&#23558;&#36820;&#22238;&#32467;&#26524;&#20445;&#23384;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urlpatterns&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#12290;patterns&#20989;&#25968;&#24403;&#21069;&#21482;&#26377;&#19968;&#20010;&#21442;&#25968;&#8212;&#19968;&#20010;&#31354;&#30340;&#23383;&#31526;&#20018;&#12290; &#65288;&#36825;&#20010;&#23383;&#31526;&#20018;&#21487;&#20197;&#34987;&#29992;&#26469;&#34920;&#31034;&#19968;&#20010;&#35270;&#22270;&#20989;&#25968;&#30340;&#36890;&#29992;&#21069;&#32512;&#12290;&#20855;&#20307;&#25105;&#20204;&#23558;&#22312;&#31532;&#20843;&#31456;&#37324;&#38754;&#20171;&#32461;&#12290;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#24403;&#21069;&#24212;&#35813;&#27880;&#24847;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urlpatterns&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#65292; Django &#26399;&#26395;&#33021;&#20174; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ROOT_URLCONF&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#20013;&#25214;&#21040;&#23427;&#12290; &#35813;&#21464;&#37327;&#23450;&#20041;&#20102; URL &#20197;&#21450;&#29992;&#20110;&#22788;&#29702;&#36825;&#20123; URL &#30340;&#20195;&#30721;&#20043;&#38388;&#30340;&#26144;&#23556;&#20851;&#31995;&#12290; &#40664;&#35748;&#24773;&#20917;&#19979;&#65292;URLconf &#25152;&#26377;&#20869;&#23481;&#37117;&#34987;&#27880;&#37322;&#36215;&#26469;&#20102;&#8212;&#8212;Django &#24212;&#29992;&#31243;&#24207;&#36824;&#26159;&#30333;&#29256;&#19968;&#22359;&#12290; &#65288;&#27880;&#65306;&#37027;&#26159;&#19978;&#19968;&#33410;&#20013;Django&#24590;&#20040;&#30693;&#36947;&#26174;&#31034;&#27426;&#36814;&#39029;&#38754;&#30340;&#21407;&#22240;&#12290; &#22914;&#26524; URLconf &#20026;&#31354;&#65292;Django &#20250;&#35748;&#23450;&#20320;&#25165;&#21019;&#24314;&#22909;&#26032;&#39033;&#30446;&#65292;&#22240;&#27492;&#20063;&#23601;&#26174;&#31034;&#37027;&#31181;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#22914;&#26524;&#24819;&#22312;URLconf&#20013;&#21152;&#20837;URL&#21644;view&#65292;&#21482;&#38656;&#22686;&#21152;&#26144;&#23556;URL&#27169;&#24335;&#21644;view&#21151;&#33021;&#30340;Python tuple&#21363;&#21487;. &#36825;&#37324;&#28436;&#31034;&#22914;&#20309;&#28155;&#21152;view&#20013;hello&#21151;&#33021;.&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn33&quot;&gt;from django.conf.urls.defaults import *
from mysite.views import hello

urlpatterns = patterns(&apos;&apos;,
    (&apos;^hello/$&apos;, hello),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#35831;&#30041;&#24847;&#65306;&#20026;&#20102;&#31616;&#27905;&#65292;&#25105;&#20204;&#31227;&#38500;&#20102;&#27880;&#37322;&#20195;&#30721;&#12290; &#22914;&#26524;&#20320;&#21916;&#27426;&#30340;&#35805;&#65292;&#20320;&#21487;&#20197;&#20445;&#30041;&#37027;&#20123;&#34892;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#25105;&#20204;&#20570;&#20102;&#20004;&#22788;&#20462;&#25913;&#12290;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn36&quot;&gt;&#39318;&#20808;&#65292;&#25105;&#20204;&#20174;&#27169;&#22359; (&#22312; Python &#30340; import &#35821;&#27861;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite/views.py&lt;/span&gt;&lt;/tt&gt; &#36716;&#35793;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.views&lt;/span&gt;&lt;/tt&gt; ) &#20013;&#24341;&#20837;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hello&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#12290; &#65288;&#36825;&#20551;&#35774;mysite/views.py&#22312;&#20320;&#30340;Python&#25628;&#32034;&#36335;&#24452;&#19978;&#12290;&#20851;&#20110;&#25628;&#32034;&#36335;&#24452;&#30340;&#35299;&#37322;&#65292;&#35831;&#21442;&#29031;&#19979;&#25991;&#12290;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn37&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#25105;&#20204;&#20026;urlpatterns&#21152;&#19978;&#19968;&#34892;&#65306;
(&#8216;^hello/$&#8217;, hello),
&#36825;&#34892;&#34987;&#31216;&#20316;URLpattern&#65292;&#23427;&#26159;&#19968;&#20010;Python&#30340;&#20803;&#32452;&#12290;&#20803;&#32452;&#20013;&#31532;&#19968;&#20010;&#20803;&#32032;&#26159;&#27169;&#24335;&#21305;&#37197;&#23383;&#31526;&#20018;&#65288;&#27491;&#21017;&#34920;&#36798;&#24335;&#65289;&#65307;&#31532;&#20108;&#20010;&#20803;&#32032;&#26159;&#37027;&#20010;&#27169;&#24335;&#23558;&#20351;&#29992;&#30340;&#35270;&#22270;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#31616;&#21333;&#26469;&#35828;&#65292;&#25105;&#20204;&#21482;&#26159;&#21578;&#35785; Django&#65292;&#25152;&#26377;&#25351;&#21521; URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/hello/&lt;/span&gt;&lt;/tt&gt; &#30340;&#35831;&#27714;&#37117;&#24212;&#30001; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hello&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#35270;&#22270;&#20989;&#25968;&#26469;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn39&quot;&gt;Python &#25628;&#32034;&#36335;&#24452;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn40&quot;&gt;&lt;em&gt;Python &#25628;&#32034;&#36335;&#24452;&lt;/em&gt; &#23601;&#26159;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;import&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#26102;&#65292;Python &#25152;&#26597;&#25214;&#30340;&#31995;&#32479;&#30446;&#24405;&#28165;&#21333;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#20030;&#20363;&#26469;&#35828;&#65292;&#20551;&#23450;&#20320;&#23558; Python &#36335;&#24452;&#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;[&apos;&apos;,&apos;/usr/lib/python2.4/site-packages&apos;,&apos;/home/username/djcode/&apos;]&lt;/span&gt;&lt;/tt&gt; &#12290;&#22914;&#26524;&#25191;&#34892;&#20195;&#30721; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;foo&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;bar&lt;/span&gt;&lt;/tt&gt; &#65292;Python &#23558;&#20250;&#39318;&#20808;&#22312;&#24403;&#21069;&#30446;&#24405;&#26597;&#25214; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo.py&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;( Python &#36335;&#24452;&#31532;&#19968;&#39033;&#30340;&#31354;&#23383;&#31526;&#20018;&#34920;&#31034;&#24403;&#21069;&#30446;&#24405;)&#12290; &#22914;&#26524;&#25991;&#20214;&#19981;&#23384;&#22312;&#65292;Python&#23558;&#26597;&#25214; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/usr/lib/python2.4/site-packages/foo.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#22914;&#26524;&#20320;&#24819;&#30475;Python&#25628;&#32034;&#36335;&#24452;&#30340;&#20540;&#65292;&#36816;&#34892;Python&#20132;&#20114;&#35299;&#37322;&#22120;&#65292;&#28982;&#21518;&#36755;&#20837;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn44&quot;&gt;&amp;gt;&amp;gt;&amp;gt; import sys
&amp;gt;&amp;gt;&amp;gt; print sys.path
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#36890;&#24120;&#65292;&#20320;&#19981;&#24517;&#20851;&#24515; Python &#25628;&#32034;&#36335;&#24452;&#30340;&#35774;&#32622;&#12290; Python &#21644; Django &#20250;&#22312;&#21518;&#21488;&#33258;&#21160;&#24110;&#20320;&#22788;&#29702;&#22909;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#35752;&#35770;&#19968;&#19979;URLpattern&#30340;&#35821;&#27861;&#26159;&#20540;&#24471;&#30340;&#65292;&#22240;&#20026;&#23427;&#19981;&#26159;&#26174;&#32780;&#26131;&#35265;&#30340;&#12290; &#34429;&#28982;&#25105;&#20204;&#24819;&#21305;&#37197;&#22320;&#22336;/hello/&#65292;&#20294;&#26159;&#27169;&#24335;&#30475;&#19978;&#21435;&#19982;&#36825;&#26377;&#28857;&#24046;&#21035;&#12290; &#36825;&#23601;&#26159;&#20026;&#20160;&#20040;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn47&quot;&gt;Django&#22312;&#26816;&#26597;URL&#27169;&#24335;&#21069;&#65292;&#31227;&#38500;&#27599;&#19968;&#20010;&#30003;&#35831;&#30340;URL&#24320;&#22836;&#30340;&#26012;&#26464;(/)&#12290; &#36825;&#24847;&#21619;&#30528;&#25105;&#20204;&#20026;/hello/&#20889;URL&#27169;&#24335;&#19981;&#29992;&#21253;&#21547;&#26012;&#26464;(/)&#12290;&#65288;&#21018;&#24320;&#22987;&#65292;&#36825;&#26679;&#21487;&#33021;&#30475;&#36215;&#26469;&#19981;&#30452;&#35266;&#65292;&#20294;&#36825;&#26679;&#30340;&#35201;&#27714;&#31616;&#21270;&#20102;&#35768;&#22810;&#24037;&#20316;&#65292;&#22914;URL&#27169;&#24335;&#20869;&#23884;&#65292;&#25105;&#20204;&#23558;&#22312;&#31532;&#20843;&#31456;&#35848;&#21450;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#27169;&#24335;&#21253;&#21547;&#20102;&#19968;&#20010;&#23574;&#21495;(^)&#21644;&#19968;&#20010;&#32654;&#20803;&#31526;&#21495;($)&#12290;&#36825;&#20123;&#37117;&#26159;&#27491;&#21017;&#34920;&#36798;&#24335;&#31526;&#21495;&#65292;&#24182;&#19988;&#26377;&#29305;&#23450;&#30340;&#21547;&#20041;&#65306; &#19978;&#31661;&#22836;&#35201;&#27714;&#34920;&#36798;&#24335;&#23545;&#23383;&#31526;&#20018;&#30340;&#22836;&#37096;&#36827;&#34892;&#21305;&#37197;&#65292;&#32654;&#20803;&#31526;&#21495;&#21017;&#35201;&#27714;&#34920;&#36798;&#24335;&#23545;&#23383;&#31526;&#20018;&#30340;&#23614;&#37096;&#36827;&#34892;&#21305;&#37197;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#26368;&#22909;&#36824;&#26159;&#29992;&#33539;&#20363;&#26469;&#35828;&#26126;&#19968;&#19979;&#36825;&#20010;&#27010;&#24565;&#12290; &#22914;&#26524;&#25105;&#20204;&#29992;&#23614;&#37096;&#19981;&#26159;$&#30340;&#27169;&#24335;&#8217;^hello/&#8217;&#65292;&#37027;&#20040;&#20219;&#20309;&#20197;/hello/&#24320;&#22836;&#30340;URL&#23558;&#20250;&#21305;&#37197;&#65292;&#20363;&#22914;&#65306;/hello/foo &#21644;/hello/bar&#65292;&#32780;&#19981;&#20165;&#20165;&#26159;/hello/&#12290;&#31867;&#20284;&#22320;&#65292;&#22914;&#26524;&#25105;&#20204;&#24573;&#30053;&#20102;&#23574;&#21495;(^)&#65292;&#21363;&#8217;hello/$&#8217;&#65292;&#37027;&#20040;&#20219;&#20309;&#20197;hello/&#32467;&#23614;&#30340;URL&#23558;&#20250;&#21305;&#37197;&#65292;&#20363;&#22914;&#65306;/foo/bar/hello/&#12290;&#22914;&#26524;&#25105;&#20204;&#31616;&#21333;&#20351;&#29992;hello/&#65292;&#21363;&#27809;&#26377;^&#24320;&#22836;&#21644;$&#32467;&#23614;&#65292;&#37027;&#20040;&#20219;&#20309;&#21253;&#21547;hello/&#30340;URL&#23558;&#20250;&#21305;&#37197;&#65292;&#22914;&#65306;/foo/hello/bar&#12290;&#22240;&#27492;&#65292;&#25105;&#20204;&#20351;&#29992;&#36825;&#20004;&#20010;&#31526;&#21495;&#20197;&#30830;&#20445;&#21482;&#26377;/hello/&#21305;&#37197;&#65292;&#19981;&#22810;&#20063;&#19981;&#23569;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#20320;&#22823;&#22810;&#25968;&#30340;URL&#27169;&#24335;&#20250;&#20197;^&#24320;&#22987;&#12289;&#20197;$&#32467;&#26463;&#65292;&#20294;&#26159;&#25317;&#26377;&#22797;&#26434;&#21305;&#37197;&#30340;&#28789;&#27963;&#24615;&#20250;&#26356;&#22909;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&#20320;&#21487;&#33021;&#20250;&#38382;&#65306;&#22914;&#26524;&#26377;&#20154;&#30003;&#35831;&#35775;&#38382;/hello&#65288;&#23614;&#37096;&#27809;&#26377;&#26012;&#26464;/&#65289;&#20250;&#24590;&#26679;&#12290; &#22240;&#20026;&#25105;&#20204;&#30340;URL&#27169;&#24335;&#35201;&#27714;&#23614;&#37096;&#26377;&#19968;&#20010;&#26012;&#26464;(/)&#65292;&#37027;&#20010;&#30003;&#35831;URL&#23558;&#19981;&#21305;&#37197;&#12290; &#28982;&#32780;&#65292;&#40664;&#35748;&#22320;&#65292;&#20219;&#20309;&#19981;&#21305;&#37197;&#25110;&#23614;&#37096;&#27809;&#26377;&#26012;&#26464;(/)&#30340;&#30003;&#35831;URL&#65292;&#23558;&#34987;&#37325;&#23450;&#21521;&#33267;&#23614;&#37096;&#21253;&#21547;&#26012;&#26464;&#30340;&#30456;&#21516;&#23383;&#30524;&#30340;URL&#12290; &#65288;&#36825;&#26159;&#21463;&#37197;&#32622;&#25991;&#20214;setting&#20013;APPEND_SLASH&#39033;&#25511;&#21046;&#30340;&#65292;&#21442;&#35265;&#38468;&#20214;D&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#22914;&#26524;&#20320;&#26159;&#21916;&#27426;&#25152;&#26377;URL&#37117;&#20197;&#8217;/&#8217;&#32467;&#23614;&#30340;&#20154;&#65288;Django&#24320;&#21457;&#32773;&#30340;&#20559;&#29233;&#65289;&#65292;&#37027;&#20040;&#20320;&#21482;&#38656;&#35201;&#22312;&#27599;&#20010;URL&#21518;&#28155;&#21152;&#26012;&#26464;&#65292;&#24182;&#19988;&#35774;&#32622;&#8221;APPEND_SLASH&#8221;&#20026;&#8221;True&#8221;. &#22914;&#26524;&#19981;&#21916;&#27426;URL&#20197;&#26012;&#26464;&#32467;&#23614;&#25110;&#32773;&#26681;&#25454;&#27599;&#20010;URL&#26469;&#20915;&#23450;&#65292;&#37027;&#20040;&#38656;&#35201;&#35774;&#32622;&#8221;APPEND_SLASH&#8221;&#20026;&#8221;False&#8221;,&#24182;&#19988;&#26681;&#25454;&#20320;&#33258;&#24049;&#30340;&#24847;&#24895;&#26469;&#28155;&#21152;&#32467;&#23614;&#26012;&#26464;/&#22312;URL&#27169;&#24335;&#21518;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#21478;&#22806;&#38656;&#35201;&#27880;&#24847;&#30340;&#26159;&#65292;&#25105;&#20204;&#25226;hello&#35270;&#22270;&#20989;&#25968;&#20316;&#20026;&#19968;&#20010;&#23545;&#35937;&#20256;&#36882;&#65292;&#32780;&#19981;&#26159;&#35843;&#29992;&#23427;&#12290; &#36825;&#26159; Python (&#21450;&#20854;&#23427;&#21160;&#24577;&#35821;&#35328;&#30340;) &#30340;&#19968;&#20010;&#37325;&#35201;&#29305;&#24615;&#65306; &#20989;&#25968;&#26159;&#19968;&#32423;&#23545;&#35937;&#65288;first-class objects&#65289;&#65292; &#20063;&#23601;&#26159;&#35828;&#20320;&#21487;&#20197;&#20687;&#20256;&#36882;&#20854;&#23427;&#21464;&#37327;&#19968;&#26679;&#20256;&#36882;&#23427;&#20204;&#12290; &#24456;&#37239;&#21543;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&#21551;&#21160;Django&#24320;&#21457;&#26381;&#21153;&#22120;&#26469;&#27979;&#35797;&#20462;&#25913;&#22909;&#30340; URLconf, &#36816;&#34892;&#21629;&#20196;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;runserver&lt;/span&gt;&lt;/tt&gt; &#12290; (&#22914;&#26524;&#20320;&#35753;&#23427;&#19968;&#30452;&#36816;&#34892;&#20063;&#21487;&#20197;&#65292;&#24320;&#21457;&#26381;&#21153;&#22120;&#20250;&#33258;&#21160;&#30417;&#27979;&#20195;&#30721;&#25913;&#21160;&#24182;&#33258;&#21160;&#37325;&#26032;&#36733;&#20837;&#65292;&#25152;&#20197;&#19981;&#38656;&#35201;&#25163;&#24037;&#37325;&#21551;&#65289; &#24320;&#21457;&#26381;&#21153;&#22120;&#30340;&#22320;&#22336;&#26159; &lt;a class=&quot;reference external&quot; href=&quot;http://127.0.0.1:8000/&quot;&gt;http://127.0.0.1:8000/&lt;/a&gt; &#65292;&#25171;&#24320;&#20320;&#30340;&#27983;&#35272;&#22120;&#35775;&#38382; &lt;a class=&quot;reference external&quot; href=&quot;http://127.0.0.1:8000/hello/&quot;&gt;http://127.0.0.1:8000/hello/&lt;/a&gt; &#12290; &#20320;&#23601;&#21487;&#20197;&#30475;&#21040;&#36755;&#20986;&#32467;&#26524;&#20102;&#12290; &#24320;&#21457;&#26381;&#21153;&#22120;&#23558;&#33258;&#21160;&#26816;&#27979;Python&#20195;&#30721;&#30340;&#26356;&#25913;&#26469;&#20570;&#24517;&#35201;&#30340;&#37325;&#26032;&#21152;&#36733;&#65292; &#25152;&#20197;&#20320;&#19981;&#38656;&#35201;&#37325;&#21551;Server&#22312;&#20195;&#30721;&#26356;&#25913;&#20043;&#21518;&#12290;&#26381;&#21153;&#22120;&#36816;&#34892;&#22320;&#22336;`` &lt;a class=&quot;reference external&quot; href=&quot;http://127.0.0.1:8000&quot;&gt;http://127.0.0.1:8000&lt;/a&gt;/`` &#65292;&#25152;&#20197;&#25171;&#24320;&#27983;&#35272;&#22120;&#30452;&#25509;&#36755;&#20837;`` &lt;a class=&quot;reference external&quot; href=&quot;http://127.0.0.1:8000/hello&quot;&gt;http://127.0.0.1:8000/hello&lt;/a&gt;/`` &#65292;&#20320;&#23558;&#30475;&#21040;&#30001;&#20320;&#30340;Django&#35270;&#22270;&#36755;&#20986;&#30340;Hello world&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#19975;&#23681;&#65281; &#20320;&#24050;&#32463;&#21019;&#24314;&#20102;&#31532;&#19968;&#20010;Django&#30340;web&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#27491;&#21017;&#34920;&#36798;&#24335;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&lt;em&gt;&#27491;&#21017;&#34920;&#36798;&#24335;&lt;/em&gt; (&#25110; &lt;em&gt;regexes&lt;/em&gt; ) &#26159;&#36890;&#29992;&#30340;&#25991;&#26412;&#27169;&#24335;&#21305;&#37197;&#30340;&#26041;&#27861;&#12290; Django URLconfs &#20801;&#35768;&#20320; &#20351;&#29992;&#20219;&#24847;&#30340;&#27491;&#21017;&#34920;&#36798;&#24335;&#26469;&#20570;&#24378;&#26377;&#21147;&#30340;URL&#26144;&#23556;&#65292;&#19981;&#36807;&#36890;&#24120;&#20320;&#23454;&#38469;&#19978;&#21487;&#33021;&#21482;&#38656;&#35201;&#20351;&#29992;&#24456;&#23569;&#30340;&#19968; &#37096;&#20998;&#21151;&#33021;&#12290; &#36825;&#37324;&#26159;&#19968;&#20123;&#22522;&#26412;&#30340;&#35821;&#27861;&#12290;&lt;/p&gt;
&lt;table class=&quot;cn docutils&quot; id=&quot;cn58&quot;&gt;
&lt;colgroup&gt;
&lt;col width=&quot;15%&quot;&gt;
&lt;col width=&quot;85%&quot;&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&#31526;&#21495;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#21305;&#37197;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.&lt;/span&gt;&lt;/tt&gt; (dot)&lt;/td&gt;
&lt;td&gt;&#20219;&#24847;&#21333;&#19968;&#23383;&#31526;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\d&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#20219;&#24847;&#19968;&#20301;&#25968;&#23383;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;[A-Z]&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;A&lt;/span&gt;&lt;/tt&gt; &#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Z&lt;/span&gt;&lt;/tt&gt;&#20013;&#20219;&#24847;&#19968;&#20010;&#23383;&#31526;&#65288;&#22823;&#20889;&#65289;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;[a-z]&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;a&lt;/span&gt;&lt;/tt&gt; &#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;z&lt;/span&gt;&lt;/tt&gt;&#20013;&#20219;&#24847;&#19968;&#20010;&#23383;&#31526;&#65288;&#23567;&#20889;&#65289;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;[A-Za-z]&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;a&lt;/span&gt;&lt;/tt&gt; &#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;z&lt;/span&gt;&lt;/tt&gt;&#20013;&#20219;&#24847;&#19968;&#20010;&#23383;&#31526;&#65288;&#19981;&#21306;&#20998;&#22823;&#23567;&#20889;&#65289;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;+&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#21305;&#37197;&#19968;&#20010;&#25110;&#26356;&#22810; (&#20363;&#22914;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\d+&lt;/span&gt;&lt;/tt&gt; &#21305;&#37197;&#19968;&#20010;&#25110; &#22810;&#20010;&#25968;&#23383;&#23383;&#31526;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;[^/]+&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#19968;&#20010;&#25110;&#22810;&#20010;&#19981;&#20026;&#8216;/&#8217;&#30340;&#23383;&#31526;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;*&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#38646;&#20010;&#25110;&#19968;&#20010;&#20043;&#21069;&#30340;&#34920;&#36798;&#24335;&#65288;&#20363;&#22914;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\d?&lt;/span&gt;&lt;/tt&gt; &#21305;&#37197;&#38646;&#20010;&#25110;&#19968;&#20010;&#25968;&#23383;&#65289;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;*&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#21305;&#37197;0&#20010;&#25110;&#26356;&#22810; (&#20363;&#22914;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\d*&lt;/span&gt;&lt;/tt&gt; &#21305;&#37197;0&#20010; &#25110;&#26356;&#22810;&#25968;&#23383;&#23383;&#31526;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{1,3}&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#20171;&#20110;&#19968;&#20010;&#21644;&#19977;&#20010;&#65288;&#21253;&#21547;&#65289;&#20043;&#21069;&#30340;&#34920;&#36798;&#24335;&#65288;&#20363;&#22914;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\d{1,3}&lt;/span&gt;&lt;/tt&gt;&#21305;&#37197;&#19968;&#20010;&#25110;&#20004;&#20010;&#25110;&#19977;&#20010;&#25968;&#23383;&#65289;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#26377;&#20851;&#27491;&#21017;&#34920;&#36798;&#24335;&#30340;&#26356;&#22810;&#20869;&#23481;&#65292;&#35831;&#35775;&#38382; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python/re-module/&quot;&gt;http://www.djangoproject.com/r/python/re-module/&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn60&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#20851;&#20110;&#8220;404&#38169;&#35823;&#8221;&#30340;&#24555;&#36895;&#21442;&#32771;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&#30446;&#21069;&#65292;&#25105;&#20204;&#30340;URLconf&#21482;&#23450;&#20041;&#20102;&#19968;&#20010;&#21333;&#29420;&#30340;URL&#27169;&#24335;&#65306; &#22788;&#29702;URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/hello/&lt;/span&gt;&lt;/tt&gt; &#12290; &#24403;&#35831;&#27714;&#20854;&#20182;URL&#20250;&#24590;&#20040;&#26679;&#21602;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#35753;&#25105;&#20204;&#35797;&#35797;&#30475;&#65292;&#36816;&#34892;Django&#24320;&#21457;&#26381;&#21153;&#22120;&#24182;&#35775;&#38382;&#31867;&#20284; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/goodbye/&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/hello/subdirectory/&lt;/span&gt;&lt;/tt&gt; &#65292;&#29978;&#33267; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/&lt;/span&gt;&lt;/tt&gt; (&#32593;&#31449;&#26681;&#30446;&#24405;)&#12290; &#20320;&#23558;&#20250;&#30475;&#21040;&#19968;&#20010; &#8220;Page not found&#8221; &#39029;&#38754;&#65288;&#22270; 3&#65293;2&#65289;&#12290; &#22240;&#20026;&#20320;&#30340;URL&#30003;&#35831;&#22312;URLconf&#20013;&#27809;&#26377;&#23450;&#20041;&#65292;&#25152;&#20197;Django&#26174;&#31034;&#36825;&#26465;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;img alt=&quot;Djangos 404 &#39029;&#38754;&#25130;&#23631;.&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter03/404.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#22270;3-1&#65306; Django&#30340;404 Error&#39029;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#36825;&#20010;&#39029;&#38754;&#27604;&#21407;&#22987;&#30340;404&#38169;&#35823;&#20449;&#24687;&#26356;&#21152;&#23454;&#29992;&#12290; &#23427;&#21516;&#26102;&#31934;&#30830;&#30340;&#21578;&#35785;&#20320;Django&#35843;&#29992;&#21738;&#20010;URLconf&#21450;&#20854;&#21253;&#21547;&#30340;&#27599;&#20010;&#27169;&#24335;&#12290; &#36825;&#26679;&#65292;&#20320;&#24212;&#35813;&#33021;&#20102;&#35299;&#21040;&#20026;&#20160;&#20040;&#36825;&#20010;&#35831;&#27714;&#20250;&#25243;&#20986;404&#38169;&#35823;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn66&quot;&gt;&#24403;&#28982;&#65292;&#36825;&#20123;&#25935;&#24863;&#30340;&#20449;&#24687;&#24212;&#35813;&#21482;&#21576;&#29616;&#32473;&#20320;&#65293;&#24320;&#21457;&#32773;&#12290;
&#22914;&#26524;&#26159;&#37096;&#32626;&#21040;&#20102;&#22240;&#29305;&#32593;&#19978;&#30340;&#31449;&#28857;&#23601;&#19981;&#24212;&#35813;&#26292;&#38706; &#36825;&#20123;&#20449;&#24687;&#12290; &#20986;&#20110;&#36825;&#20010;&#32771;&#34385;&#65292;&#36825;&#20010;&#8220;Page not found&#8221;&#39029;&#38754;&#21482;&#20250;&#22312; &lt;em&gt;&#35843;&#35797;&#27169;&#24335;&#65288;debug mode&#65289;&lt;/em&gt; &#19979; &#26174;&#31034;&#12290; &#25105;&#20204;&#23558;&#22312;&#20197;&#21518;&#35828;&#26126;&#24590;&#20040;&#20851;&#38381;&#35843;&#35797;&#27169;&#24335;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn67&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&#20851;&#20110;&#32593;&#31449;&#26681;&#30446;&#24405;&#30340;&#24555;&#36895;&#21442;&#32771;&#12290;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#22312;&#26368;&#21518;&#19968;&#33410;&#65292;&#22914;&#26524;&#20320;&#24819;&#36890;&#36807;http://127.0.0.1:8000/&#30475;&#32593;&#31449;&#26681;&#30446;&#24405;&#20320;&#23558;&#30475;&#21040;&#19968;&#20010;404&#38169;&#35823;&#28040;&#24687;&#12290;Django&#19981;&#20250;&#22686;&#21152;&#20219;&#20309;&#19996;&#35199;&#22312;&#32593;&#31449;&#26681;&#30446;&#24405;&#65292;&#22312;&#20219;&#20309;&#24773;&#20917;&#19979;&#36825;&#20010;URL&#37117;&#19981;&#26159;&#29305;&#27530;&#30340; &#23601;&#20687;&#22312;URLconf&#20013;&#30340;&#20854;&#20182;&#26465;&#30446;&#19968;&#26679;&#65292;&#23427;&#20063;&#20381;&#36182;&#20110;&#25351;&#23450;&#32473;&#23427;&#30340;URL&#27169;&#24335;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#23613;&#31649;&#21305;&#37197;&#32593;&#31449;&#26681;&#30446;&#24405;&#30340;URL&#27169;&#24335;&#19981;&#33021;&#24819;&#35937;&#65292;&#20294;&#26159;&#36824;&#26159;&#20540;&#24471;&#25552;&#19968;&#19979;&#30340;. &#24403;&#20026;&#32593;&#31449;&#26681;&#30446;&#24405;&#23454;&#29616;&#19968;&#20010;&#35270;&#22270;&#65292;&#20320;&#38656;&#35201;&#20351;&#29992;URL&#27169;&#24335;`` &#8216;^$&#8217;`` , &#23427;&#20195;&#34920;&#19968;&#20010;&#31354;&#23383;&#31526;&#20018;&#12290; &#20363;&#22914;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn71&quot;&gt;from mysite.views import hello, my_homepage_view

urlpatterns = patterns(&apos;&apos;,
    (&apos;^$&apos;, my_homepage_view),
    # ...
)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django&quot;&gt;
&lt;span id=&quot;cn72&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn72&quot;&gt;Django&#26159;&#24590;&#20040;&#22788;&#29702;&#35831;&#27714;&#30340;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&#22312;&#32487;&#32493;&#25105;&#20204;&#30340;&#31532;&#20108;&#20010;&#35270;&#22270;&#21151;&#33021;&#20043;&#21069;&#65292;&#35753;&#25105;&#20204;&#26242;&#20572;&#19968;&#19979;&#21435;&#20102;&#35299;&#26356;&#22810;&#19968;&#20123;&#26377;&#20851;Django&#26159;&#24590;&#20040;&#24037;&#20316;&#30340;&#30693;&#35782;. &#20855;&#20307;&#22320;&#35828;&#65292;&#24403;&#20320;&#36890;&#36807;&#22312;&#27983;&#35272;&#22120;&#37324;&#25970;http://127.0.0.1:8000/hello/&#26469;&#35775;&#38382;Hello world&#28040;&#24687;&#24471;&#26102;&#20505;&#65292;Django&#22312;&#21518;&#21488;&#26377;&#20123;&#20160;&#20040;&#21160;&#20316;&#21602;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#25152;&#26377;&#22343;&#24320;&#22987;&#20110;setting&#25991;&#20214;&#12290;&#24403;&#20320;&#36816;&#34892;python manage.py
runserver&#65292;&#33050;&#26412;&#23558;&#22312;&#20110;manage.py&#21516;&#19968;&#20010;&#30446;&#24405;&#19979;&#26597;&#25214;&#21517;&#20026;setting.py&#30340;&#25991;&#20214;&#12290;&#36825;&#20010;&#25991;&#20214;&#21253;&#21547;&#20102;&#25152;&#26377;&#26377;&#20851;&#36825;&#20010;Django&#39033;&#30446;&#30340;&#37197;&#32622;&#20449;&#24687;&#65292;&#22343;&#22823;&#20889;&#65306; TEMPLATE_DIRS , DATABASE_NAME
, &#31561;. &#26368;&#37325;&#35201;&#30340;&#35774;&#32622;&#26102;ROOT_URLCONF&#65292;&#23427;&#23558;&#20316;&#20026;URLconf&#21578;&#35785;Django&#22312;&#36825;&#20010;&#31449;&#28857;&#20013;&#37027;&#20123;Python&#30340;&#27169;&#22359;&#23558;&#34987;&#29992;&#21040;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#36824;&#35760;&#24471;&#20160;&#20040;&#26102;&#20505;django-admin.py startproject&#21019;&#24314;&#25991;&#20214;settings.py&#21644;urls.py&#21527;&#65311;&#33258;&#21160;&#21019;&#24314;&#30340;settings.py&#21253;&#21547;&#19968;&#20010;ROOT_URLCONF&#37197;&#32622;&#29992;&#26469;&#25351;&#21521;&#33258;&#21160;&#20135;&#29983;&#30340;urls.py. &#25171;&#24320;&#25991;&#20214;settings.py&#20320;&#23558;&#30475;&#21040;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn77&quot;&gt;ROOT_URLCONF = &apos;mysite.urls&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#30456;&#23545;&#24212;&#30340;&#25991;&#20214;&#26159;mysite/urls.py&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&#24403;&#35775;&#38382; URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/hello/&lt;/span&gt;&lt;/tt&gt; &#26102;&#65292;Django &#26681;&#25454; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ROOT_URLCONF&lt;/span&gt;&lt;/tt&gt; &#30340;&#35774;&#32622;&#35013;&#36733; URLconf &#12290; &#28982;&#21518;&#25353;&#39034;&#24207;&#36880;&#20010;&#21305;&#37197;URLconf&#37324;&#30340;URLpatterns&#65292;&#30452;&#21040;&#25214;&#21040;&#19968;&#20010;&#21305;&#37197;&#30340;&#12290; &#24403;&#25214;&#21040;&#36825;&#20010;&#21305;&#37197; &#30340;URLpatterns&#23601;&#35843;&#29992;&#30456;&#20851;&#32852;&#30340;view&#20989;&#25968;&#65292;&#24182;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#20316;&#20026;&#31532;&#19968;&#20010;&#21442;&#25968;&#12290; &#65288;&#31245;&#21518;&#20877;&#32473;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#30340;&#26356;&#22810;&#20449;&#24687;&#65289; &#65288;&#25105;&#20204;&#23558;&#22312;&#21518;&#38754;&#30475;&#21040;HttpRequest&#30340;&#26631;&#20934;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#27491;&#22914;&#25105;&#20204;&#22312;&#31532;&#19968;&#20010;&#35270;&#22270;&#20363;&#23376;&#37324;&#38754;&#30475;&#21040;&#30340;&#65292;&#19968;&#20010;&#35270;&#22270;&#21151;&#33021;&#24517;&#39035;&#36820;&#22238;&#19968;&#20010;HttpResponse&#12290; &#19968;&#26086;&#20570;&#23436;&#65292;Django&#23558;&#23436;&#25104;&#21097;&#20313;&#30340;&#36716;&#25442;Python&#30340;&#23545;&#35937;&#21040;&#19968;&#20010;&#21512;&#36866;&#30340;&#24102;&#26377;HTTP&#22836;&#21644;body&#30340;Web Response&#65292;&#65288;&#20363;&#22914;&#65292;&#32593;&#39029;&#20869;&#23481;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#24635;&#32467;&#19968;&#19979;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn82&quot;&gt;&#36827;&#26469;&#30340;&#35831;&#27714;&#36716;&#20837;/hello/.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn83&quot;&gt;Django&#36890;&#36807;&#22312;ROOT_URLCONF&#37197;&#32622;&#26469;&#20915;&#23450;&#26681;URLconf.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn84&quot;&gt;Django&#22312;URLconf&#20013;&#30340;&#25152;&#26377;URL&#27169;&#24335;&#20013;&#65292;&#26597;&#25214;&#31532;&#19968;&#20010;&#21305;&#37197;/hello/&#30340;&#26465;&#30446;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;4&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn85&quot;&gt;&#22914;&#26524;&#25214;&#21040;&#21305;&#37197;&#65292;&#23558;&#35843;&#29992;&#30456;&#24212;&#30340;&#35270;&#22270;&#20989;&#25968;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;5&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn86&quot;&gt;&#35270;&#22270;&#20989;&#25968;&#36820;&#22238;&#19968;&#20010;HttpResponse&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;6&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn87&quot;&gt;Django&#36716;&#25442;HttpResponse&#20026;&#19968;&#20010;&#36866;&#21512;&#30340;HTTP response&#65292; &#20197;Web page&#26174;&#31034;&#20986;&#26469;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#20320;&#29616;&#22312;&#30693;&#36947;&#20102;&#24590;&#20040;&#20570;&#19968;&#20010; Django-powered &#39029;&#38754;&#20102;&#65292;&#30495;&#30340;&#24456;&#31616;&#21333;&#65292;&#21482;&#38656;&#35201;&#20889;&#35270;&#22270;&#20989;&#25968;&#24182;&#29992; URLconfs&#25226;&#23427;&#20204;&#21644;URLs&#23545;&#24212;&#36215;&#26469;&#12290; &#20320;&#21487;&#33021;&#20250;&#35748;&#20026;&#29992;&#19968;&#31995;&#21015;&#27491;&#21017;&#34920;&#36798;&#24335;&#23558;URLs&#26144;&#23556;&#21040;&#20989;&#25968;&#20063;&#35768;&#20250;&#27604;&#36739;&#24930;&#65292;&#20294;&#20107;&#23454;&#21364;&#20250;&#35753;&#20320;&#24778;&#35766;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn89&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#31532;&#20108;&#20010;&#35270;&#22270;&#65306; &#21160;&#24577;&#20869;&#23481;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn90&quot;&gt;&#25105;&#20204;&#30340;Hello world&#35270;&#22270;&#26159;&#29992;&#26469;&#28436;&#31034;&#22522;&#26412;&#30340;Django&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#65292;&#20294;&#26159;&#23427;&#19981;&#26159;&#19968;&#20010;&#21160;&#24577;&#32593;&#39029;&#30340;&#20363;&#23376;&#65292;&#22240;&#20026;&#32593;&#39029;&#30340;&#20869;&#23481;&#19968;&#30452;&#26159;&#19968;&#26679;&#30340;. &#27599;&#27425;&#21435;&#26597;&#30475;/hello/&#65292;&#20320;&#23558;&#20250;&#30475;&#21040;&#30456;&#21516;&#30340;&#20869;&#23481;&#65292;&#23427;&#31867;&#20284;&#19968;&#20010;&#38745;&#24577;HTML&#25991;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#25105;&#20204;&#30340;&#31532;&#20108;&#20010;&#35270;&#22270;&#65292;&#23558;&#26356;&#22810;&#30340;&#25918;&#20123;&#21160;&#24577;&#30340;&#19996;&#35199;&#20363;&#22914;&#24403;&#21069;&#26085;&#26399;&#21644;&#26102;&#38388;&#26174;&#31034;&#22312;&#32593;&#39029;&#19978; &#36825;&#23558;&#38750;&#24120;&#22909;&#65292;&#31616;&#21333;&#30340;&#19979;&#19968;&#27493;&#65292;&#22240;&#20026;&#23427;&#19981;&#24341;&#20837;&#20102;&#25968;&#25454;&#24211;&#25110;&#32773;&#20219;&#20309;&#29992;&#25143;&#30340;&#36755;&#20837;&#65292;&#20165;&#20165;&#26159;&#36755;&#20986;&#26174;&#31034;&#20320;&#30340;&#26381;&#21153;&#22120;&#30340;&#20869;&#37096;&#26102;&#38047;. &#23427;&#20165;&#20165;&#26377;&#38480;&#24230;&#30340;&#27604;Helloworld&#21050;&#28608;&#19968;&#20123;&#65292;&#20294;&#26159;&#23427;&#23558;&#28436;&#31034;&#19968;&#20123;&#26032;&#30340;&#27010;&#24565;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#36825;&#20010;&#35270;&#22270;&#38656;&#35201;&#20570;&#20004;&#20214;&#20107;&#24773;&#65306; &#35745;&#31639;&#24403;&#21069;&#26085;&#26399;&#21644;&#26102;&#38388;&#65292;&#24182;&#36820;&#22238;&#21253;&#21547;&#36825;&#20123;&#20540;&#30340;HttpResponse &#22914;&#26524;&#20320;&#23545;python&#24456;&#26377;&#32463;&#39564;&#65292;&#37027;&#32943;&#23450;&#30693;&#36947;&#22312;python&#20013;&#38656;&#35201;&#21033;&#29992;datetime&#27169;&#22359;&#21435;&#35745;&#31639;&#26102;&#38388; &#19979;&#38754;&#28436;&#31034;&#22914;&#20309;&#21435;&#20351;&#29992;&#23427;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn94&quot;&gt;&amp;gt;&amp;gt;&amp;gt; import datetime
&amp;gt;&amp;gt;&amp;gt; now = datetime.datetime.now()
&amp;gt;&amp;gt;&amp;gt; now
datetime.datetime(2008, 12, 13, 14, 9, 39, 2731)
&amp;gt;&amp;gt;&amp;gt; print now
2008-12-13 14:09:39.002731
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#20197;&#19978;&#20195;&#30721;&#24456;&#31616;&#21333;&#65292;&#24182;&#27809;&#26377;&#28041;&#21450;Django&#12290; &#23427;&#20165;&#20165;&#26159;Python&#20195;&#30721;&#12290;
&#38656;&#35201;&#24378;&#35843;&#30340;&#26159;&#65292;&#20320;&#24212;&#35813;&#24847;&#35782;&#21040;&#21738;&#20123;&#26159;&#32431;Python&#20195;&#30721;&#65292;&#21738;&#20123;&#26159;Django&#29305;&#24615;&#20195;&#30721;&#12290; &#65288;&#35265;&#19978;&#65289; &#22240;&#20026;&#20320;&#23398;&#20064;&#20102;Django&#65292;&#24076;&#26395;&#20320;&#33021;&#23558;Django&#30340;&#30693;&#35782;&#24212;&#29992;&#22312;&#37027;&#20123;&#19981;&#19968;&#23450;&#38656;&#35201;&#20351;&#29992;Django&#30340;&#39033;&#30446;&#19978;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#20026;&#20102;&#35753;Django&#35270;&#22270;&#26174;&#31034;&#24403;&#21069;&#26085;&#26399;&#21644;&#26102;&#38388;&#65292;&#25105;&#20204;&#20165;&#38656;&#35201;&#25226;&#35821;&#21477;&#65306;datetime.datetime.now()&#25918;&#20837;&#35270;&#22270;&#20989;&#25968;&#65292;&#28982;&#21518;&#36820;&#22238;&#19968;&#20010;HttpResponse&#23545;&#35937;&#21363;&#21487;&#12290;&#20195;&#30721;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn98&quot;&gt;from django.http import HttpResponse
import datetime

def current_datetime(request):
    now = datetime.datetime.now()
    html = &quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;It is now %s.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot; % now
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#27491;&#22914;&#25105;&#20204;&#30340;hello&#20989;&#25968;&#19968;&#26679;&#65292;&#36825;&#20010;&#20989;&#25968;&#20063;&#20445;&#23384;&#22312;view.py&#20013;&#12290;&#20026;&#20102;&#31616;&#27905;&#65292;&#19978;&#38754;&#25105;&#20204;&#38544;&#34255;&#20102;hello&#20989;&#25968;&#12290;&#19979;&#38754;&#26159;&#23436;&#25972;&#30340;view.py&#25991;&#20214;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn101&quot;&gt;from django.http import HttpResponse
import datetime

def hello(request):
    return HttpResponse(&quot;Hello world&quot;)

def current_datetime(request):
    now = datetime.datetime.now()
    html = &quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;It is now %s.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot; % now
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn102&quot;&gt;&#65288;&#20174;&#29616;&#22312;&#24320;&#22987;&#65292;&#22914;&#38750;&#24517;&#35201;&#65292;&#26412;&#25991;&#19981;&#20877;&#37325;&#22797;&#21015;&#20986;&#20808;&#21069;&#30340;&#20195;&#30721;&#12290; &#20320;&#24212;&#35813;&#25026;&#24471;&#35782;&#21035;&#21738;&#20123;&#26159;&#26032;&#20195;&#30721;&#65292;&#21738;&#20123;&#26159;&#20808;&#21069;&#30340;&#12290;&#65289; &#65288;&#35265;&#19978;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#35753;&#25105;&#20204;&#20998;&#26512;&#19968;&#19979;&#25913;&#21160;&#21518;&#30340;views.py&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&#22312;&#25991;&#20214;&#39030;&#31471;&#65292;&#25105;&#20204;&#28155;&#21152;&#20102;&#19968;&#26465;&#35821;&#21477;&#65306;import datetime&#12290;&#36825;&#26679;&#23601;&#21487;&#20197;&#35745;&#31639;&#26085;&#26399;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&#20989;&#25968;&#20013;&#30340;&#31532;&#19968;&#34892;&#20195;&#30721;&#35745;&#31639;&#24403;&#21069;&#26085;&#26399;&#21644;&#26102;&#38388;&#65292;&#24182;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime.datetime&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#30340;&#24418;&#24335;&#20445;&#23384;&#20026;&#23616;&#37096;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;now&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#20989;&#25968;&#30340;&#31532;&#20108;&#34892;&#20195;&#30721;&#29992; Python &#30340;&#26684;&#24335;&#21270;&#23383;&#31526;&#20018;&#65288;format-string&#65289;&#21151;&#33021;&#26500;&#36896;&#20102;&#19968;&#27573; HTML &#21709;&#24212;&#12290; &#23383;&#31526;&#20018;&#20013;&#30340;%s&#26159;&#21344;&#20301;&#31526;&#65292;&#23383;&#31526;&#20018;&#21518;&#38754;&#30340;&#30334;&#20998;&#21495;&#34920;&#31034;&#29992;&#23427;&#21518;&#38754;&#30340;&#21464;&#37327;now&#30340;&#20540;&#26469;&#20195;&#26367;%s&#12290;&#21464;&#37327;%s&#26159;&#19968;&#20010;datetime.datetime&#23545;&#35937;&#12290;&#23427;&#34429;&#28982;&#19981;&#26159;&#19968;&#20010;&#23383;&#31526;&#20018;&#65292;&#20294;&#26159;%s&#65288;&#26684;&#24335;&#21270;&#23383;&#31526;&#20018;&#65289;&#20250;&#25226;&#23427;&#36716;&#25442;&#25104;&#23383;&#31526;&#20018;&#65292;&#22914;&#65306;2008-12-13
14:09:39.002731&#12290;&#36825;&#23558;&#23548;&#33268;HTML&#30340;&#36755;&#20986;&#23383;&#31526;&#20018;&#20026;&#65306;It is now 2008-12-13
14:09:39.002731&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#65288;&#30446;&#21069;HTML&#26159;&#26377;&#38169;&#35823;&#30340;&#65292;&#20294;&#25105;&#20204;&#36825;&#26679;&#20570;&#26159;&#20026;&#20102;&#20445;&#25345;&#20363;&#23376;&#30340;&#31616;&#30701;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&#26368;&#21518;&#65292;&#27491;&#22914;&#25105;&#20204;&#21018;&#25165;&#20889;&#30340;hello&#20989;&#25968;&#19968;&#26679;&#65292;&#35270;&#22270;&#36820;&#22238;&#19968;&#20010;HttpResponse&#23545;&#35937;&#65292;&#23427;&#21253;&#21547;&#29983;&#25104;&#30340;&#21709;&#24212;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20043;&#21518;&#65292;&#36824;&#35201;&#22312;urls.py&#20013;&#28155;&#21152;URL&#27169;&#24335;&#65292;&#20197;&#21578;&#35785;Django&#30001;&#21738;&#19968;&#20010;URL&#26469;&#22788;&#29702;&#36825;&#20010;&#35270;&#22270;&#12290; &#29992;/time/&#20043;&#31867;&#30340;&#23383;&#30524;&#26131;&#20110;&#29702;&#35299;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn111&quot;&gt;from django.conf.urls.defaults import *
from mysite.views import hello, current_datetime

urlpatterns = patterns(&apos;&apos;,
    (&apos;^hello/$&apos;, hello),
    (&apos;^time/$&apos;, current_datetime),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&#36825;&#37324;&#65292;&#25105;&#20204;&#20462;&#25913;&#20102;&#20004;&#20010;&#22320;&#26041;&#12290; &#39318;&#20808;&#65292;&#22312;&#39030;&#37096;&#23548;&#20837;current_datetime&#20989;&#25968;&#65307; &#20854;&#27425;&#65292;&#20063;&#26159;&#27604;&#36739;&#37325;&#35201;&#30340;&#65306;&#28155;&#21152;URL&#27169;&#24335;&#26469;&#26144;&#23556;URL&#20013;&#30340;/time/&#21644;&#26032;&#35270;&#22270;&#12290; &#29702;&#35299;&#20102;&#20040;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#20889;&#22909;&#35270;&#22270;&#24182;&#19988;&#26356;&#26032;URLconf&#20043;&#21518;&#65292;&#36816;&#34892;&#21629;&#20196;python manage.py runserver&#20197;&#21551;&#21160;&#26381;&#21153;&#65292;&#22312;&#27983;&#35272;&#22120;&#20013;&#36755;&#20837;http://127.0.0.1:8000/time/&#12290; &#20320;&#23558;&#30475;&#21040;&#24403;&#21069;&#30340;&#26085;&#26399;&#21644;&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;Django&#26102;&#21306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#35270;&#20046;&#20320;&#30340;&#26426;&#22120;&#65292;&#26174;&#31034;&#30340;&#26085;&#26399;&#19982;&#26102;&#38388;&#21487;&#33021;&#21644;&#23454;&#38469;&#30340;&#30456;&#24046;&#20960;&#20010;&#23567;&#26102;&#12290; &#36825;&#26159;&#22240;&#20026;Django&#26159;&#26377;&#26102;&#21306;&#24847;&#35782;&#30340;&#65292;&#24182;&#19988;&#40664;&#35748;&#26102;&#21306;&#20026;America/Chicago&#12290; &#65288;&#23427;&#24517;&#39035;&#26377;&#20010;&#20540;&#65292;&#23427;&#30340;&#40664;&#35748;&#20540;&#26159;Django&#30340;&#35806;&#29983;&#22320;&#65306;&#32654;&#22269;/&#33437;&#21152;&#21733;&#65289;&#22914;&#26524;&#20320;&#22788;&#22312;&#21035;&#30340;&#26102;&#21306;&#65292;&#20320;&#38656;&#35201;&#22312;settings.py&#25991;&#20214;&#20013;&#26356;&#25913;&#36825;&#20010;&#20540;&#12290;&#35831;&#21442;&#35265;&#23427;&#37324;&#38754;&#30340;&#27880;&#37322;&#65292;&#20197;&#33719;&#24471;&#26368;&#26032;&#19990;&#30028;&#26102;&#21306;&#21015;&#34920;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn116&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn116&quot;&gt;URL&#37197;&#32622;&#21644;&#26494;&#32806;&#21512;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&#29616;&#22312;&#26159;&#22909;&#26102;&#26426;&#26469;&#25351;&#20986;Django&#21644;URL&#37197;&#32622;&#32972;&#21518;&#30340;&#21746;&#23398;&#65306; &lt;em&gt;&#26494;&#32806;&#21512;&lt;/em&gt; &#21407;&#21017;&#12290; &#31616;&#21333;&#30340;&#35828;&#65292;&#26494;&#32806;&#21512;&#26159;&#19968;&#20010; &#37325;&#35201;&#30340;&#20445;&#35777;&#20114;&#25442;&#24615;&#30340;&#36719;&#20214;&#24320;&#21457;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;Django&#30340;URL&#37197;&#32622;&#23601;&#26159;&#19968;&#20010;&#24456;&#22909;&#30340;&#20363;&#23376;&#12290; &#22312;Django&#30340;&#24212;&#29992;&#31243;&#24207;&#20013;&#65292;URL&#30340;&#23450;&#20041;&#21644;&#35270;&#22270;&#20989;&#25968;&#20043;&#38388;&#26159;&#26494; &#32806;&#21512;&#30340;&#65292;&#25442;&#21477;&#35805;&#35828;&#65292;&#20915;&#23450;URL&#36820;&#22238;&#21738;&#20010;&#35270;&#22270;&#20989;&#25968;&#21644;&#23454;&#29616;&#36825;&#20010;&#35270;&#22270;&#20989;&#25968;&#26159;&#22312;&#20004;&#20010;&#19981;&#21516;&#30340;&#22320;&#26041;&#12290; &#36825;&#20351;&#24471; &#24320;&#21457;&#20154;&#21592;&#21487;&#20197;&#20462;&#25913;&#19968;&#22359;&#32780;&#19981;&#20250;&#24433;&#21709;&#21478;&#19968;&#22359;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#20363;&#22914;&#65292;&#32771;&#34385;&#19968;&#19979;current_datetime&#35270;&#22270;&#12290; &#22914;&#26524;&#25105;&#20204;&#24819;&#25226;&#23427;&#30340;URL &#20174;&#21407;&#26469;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/&lt;/span&gt;&lt;/tt&gt; &#25913;&#21464;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/currenttime/&lt;/span&gt;&lt;/tt&gt; &#65292;&#25105;&#20204;&#21482;&#38656;&#35201;&#24555;&#36895;&#30340;&#20462;&#25913;&#19968;&#19979;URL&#37197;&#32622;&#21363;&#21487;&#65292; &#19981;&#29992;&#25285;&#24515;&#36825;&#20010;&#20989;&#25968;&#30340;&#20869;&#37096;&#23454;&#29616;&#12290;
&#21516;&#26679;&#30340;&#65292;&#22914;&#26524;&#25105;&#20204;&#24819;&#35201;&#20462;&#25913;&#36825;&#20010;&#20989;&#25968;&#30340;&#20869;&#37096;&#23454;&#29616;&#20063;&#19981;&#29992;&#25285;&#24515;&#20250;&#24433;&#21709; &#21040;&#23545;&#24212;&#30340;URL&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn120&quot;&gt;&#27492;&#22806;&#65292;&#22914;&#26524;&#25105;&#20204;&#24819;&#35201;&#36755;&#20986;&#36825;&#20010;&#20989;&#25968;&#21040; &lt;em&gt;&#19968;&#20123;&lt;/em&gt; URL&#65292; &#25105;&#20204;&#21482;&#38656;&#35201;&#20462;&#25913;URL&#37197;&#32622;&#32780;&#19981;&#29992; &#21435;&#25913;&#21160;&#35270;&#22270;&#30340;&#20195;&#30721;&#12290; &#22312;&#36825;&#20010;&#20363;&#23376;&#37324;&#65292;current_datetime&#34987;&#20004;&#20010;URL&#20351;&#29992;&#12290; &#36825;&#26159;&#19968;&#20010;&#25925;&#24324;&#29572;&#34394;&#30340;&#20363;&#23376;&#65292;&#20294;&#36825;&#20010;&#26041;&#27861;&#36831;&#26089;&#20250;&#29992;&#24471;&#19978;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn122&quot;&gt;urlpatterns = patterns(&apos;&apos;,
    (&apos;^hello/$&apos;, hello),
    (&apos;^time/$&apos;, current_datetime),
    (&apos;^another-time-page/$&apos;, current_datetime),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn123&quot;&gt;URLconf&#21644;&#35270;&#22270;&#26159;&#26494;&#32806;&#21512;&#30340;&#12290; &#25105;&#20204;&#23558;&#22312;&#26412;&#20070;&#20013;&#32487;&#32493;&#32473;&#20986;&#36825;&#19968;&#37325;&#35201;&#21746;&#23398;&#30340;&#30456;&#20851;&#20363;&#23376;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn124&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#31532;&#19977;&#20010;&#35270;&#22270; &#21160;&#24577;URL&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#22312;&#25105;&#20204;&#30340;`` current_datetime`` &#35270;&#22270;&#33539;&#20363;&#20013;&#65292;&#23613;&#31649;&#20869;&#23481;&#26159;&#21160;&#24577;&#30340;&#65292;&#20294;&#26159;URL &#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/&lt;/span&gt;&lt;/tt&gt; &#65289;&#26159;&#38745;&#24577;&#30340;&#12290; &#22312; &#22823;&#22810;&#25968;&#21160;&#24577;web&#24212;&#29992;&#31243;&#24207;&#65292;URL&#36890;&#24120;&#37117;&#21253;&#21547;&#26377;&#30456;&#20851;&#30340;&#21442;&#25968;&#12290; &#20030;&#20010;&#20363;&#23376;&#65292;&#19968;&#23478;&#22312;&#32447;&#20070;&#24215;&#20250;&#20026;&#27599;&#19968;&#26412;&#20070;&#25552;&#20379;&#19968;&#20010;URL&#65292;&#22914;&#65306;/books/243/&#12289;/books/81196/&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn126&quot;&gt;&#35753;&#25105;&#20204;&#21019;&#24314;&#31532;&#19977;&#20010;&#35270;&#22270;&#26469;&#26174;&#31034;&#24403;&#21069;&#26102;&#38388;&#21644;&#21152;&#19978;&#26102;&#38388;&#20559;&#24046;&#37327;&#30340;&#26102;&#38388;&#65292;&#35774;&#35745;&#26159;&#36825;&#26679;&#30340;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/plus/1/&lt;/span&gt;&lt;/tt&gt; &#26174;&#31034;&#24403;&#21069;&#26102;&#38388;&#65291;1&#20010;&#23567;&#26102;&#30340;&#39029;&#38754; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/plus/2/&lt;/span&gt;&lt;/tt&gt; &#26174;&#31034;&#24403;&#21069;&#26102;&#38388;&#65291;2&#20010;&#23567;&#26102;&#30340;&#39029;&#38754; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/plus/3/&lt;/span&gt;&lt;/tt&gt; &#26174;&#31034;&#24403;&#21069;&#26102;&#38388;&#65291;3&#20010;&#23567;&#26102;&#30340;&#39029;&#38754;&#65292;&#20197;&#27492;&#31867;&#25512;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&#26032;&#25163;&#21487;&#33021;&#20250;&#32771;&#34385;&#20889;&#19981;&#21516;&#30340;&#35270;&#22270;&#20989;&#25968;&#26469;&#22788;&#29702;&#27599;&#20010;&#26102;&#38388;&#20559;&#24046;&#37327;&#65292;URL&#37197;&#32622;&#30475;&#36215;&#26469;&#23601;&#35937;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn129&quot;&gt;urlpatterns = patterns(&apos;&apos;,
    (&apos;^time/$&apos;, current_datetime),
    (&apos;^time/plus/1/$&apos;, one_hour_ahead),
    (&apos;^time/plus/2/$&apos;, two_hours_ahead),
    (&apos;^time/plus/3/$&apos;, three_hours_ahead),
    (&apos;^time/plus/4/$&apos;, four_hours_ahead),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#24456;&#26126;&#26174;&#65292;&#36825;&#26679;&#22788;&#29702;&#26159;&#19981;&#22826;&#22949;&#24403;&#30340;&#12290; &#19981;&#20294;&#26377;&#24456;&#22810;&#20887;&#20313;&#30340;&#35270;&#22270;&#20989;&#25968;&#65292;&#32780;&#19988;&#25972;&#20010;&#24212;&#29992;&#20063;&#34987;&#38480;&#21046;&#20102;&#21482;&#25903;&#25345; &#39044;&#20808;&#23450;&#20041;&#22909;&#30340;&#26102;&#38388;&#27573;&#65292;2&#23567;&#26102;&#65292;3&#23567;&#26102;&#65292;&#25110;&#32773;4&#23567;&#26102;&#12290; &#22914;&#26524;&#21738;&#22825;&#25105;&#20204;&#35201;&#23454;&#29616; &lt;em&gt;5&lt;/em&gt; &#23567;&#26102;&#65292;&#25105;&#20204;&#23601; &#19981;&#24471;&#19981;&#20877;&#21333;&#29420;&#21019;&#24314;&#26032;&#30340;&#35270;&#22270;&#20989;&#25968;&#21644;&#37197;&#32622;URL&#65292;&#26082;&#37325;&#22797;&#21448;&#28151;&#20081;&#12290; &#25105;&#20204;&#38656;&#35201;&#22312;&#36825;&#37324;&#20570;&#19968;&#28857;&#25277;&#35937;&#65292;&#25552;&#21462; &#19968;&#20123;&#20849;&#21516;&#30340;&#19996;&#35199;&#20986;&#26469;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#20851;&#20110;&#28418;&#20142;URL&#30340;&#19968;&#28857;&#24314;&#35758;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&#22914;&#26524;&#20320;&#26377;&#20854;&#23427;web&#24179;&#21488;&#30340;&#24320;&#21457;&#32463;&#39564;&#65288;&#22914;PHP&#25110;Java&#65289;&#65292;&#20320;&#21487;&#33021;&#20250;&#24819;&#65306;&#22079;&#65281;&#35753;&#25105;&#20204;&#29992;&#26597;&#35810;&#23383;&#31526;&#20018;&#21442;&#25968;&#21543;&#65281; &#23601;&#20687;/time/plus?hours=3&#37324;&#38754;&#30340;&#23567;&#26102;&#24212;&#35813;&#22312;&#26597;&#35810;&#23383;&#31526;&#20018;&#20013;&#34987;&#21442;&#25968;hours&#25351;&#23450;&#65288;&#38382;&#21495;&#21518;&#38754;&#30340;&#26159;&#21442;&#25968;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#20320; &lt;em&gt;&#21487;&#20197;&lt;/em&gt; &#22312;Django&#37324;&#20063;&#36825;&#26679;&#20570; (&#22914;&#26524;&#20320;&#30495;&#30340;&#24819;&#35201;&#36825;&#26679;&#20570;&#65292;&#25105;&#20204;&#31245;&#21518;&#20250;&#21578;&#35785;&#20320;&#24590;&#20040;&#20570;&#65289;&#65292; &#20294;&#26159;Django&#30340;&#19968;&#20010;&#26680;&#24515;&#29702;&#24565;&#23601;&#26159;URL&#24517;&#39035;&#30475;&#36215;&#26469;&#28418;&#20142;&#12290; URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/plus/3/&lt;/span&gt;&lt;/tt&gt; &#26356;&#21152;&#28165;&#26224;&#65292; &#26356;&#31616;&#21333;&#65292;&#20063;&#26356;&#26377;&#21487;&#35835;&#24615;&#65292;&#21487;&#20197;&#24456;&#23481;&#26131;&#30340;&#22823;&#22768;&#24565;&#20986;&#26469;&#65292;&#22240;&#20026;&#23427;&#26159;&#32431;&#25991;&#26412;&#65292;&#27809;&#26377;&#26597;&#35810;&#23383;&#31526;&#20018;&#37027;&#20040; &#22797;&#26434;&#12290; &#28418;&#20142;&#30340;URL&#23601;&#20687;&#26159;&#39640;&#36136;&#37327;&#30340;Web&#24212;&#29992;&#30340;&#19968;&#20010;&#26631;&#24535;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn134&quot;&gt;Django&#30340;URL&#37197;&#32622;&#31995;&#32479;&#21487;&#20197;&#20351;&#20320;&#24456;&#23481;&#26131;&#30340;&#35774;&#32622;&#28418;&#20142;&#30340;URL&#65292;&#32780;&#23613;&#37327;&#19981;&#35201;&#32771;&#34385;&#23427;&#30340; &lt;em&gt;&#21453;&#38754;&lt;/em&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#37027;&#20040;&#65292;&#25105;&#20204;&#22914;&#20309;&#35774;&#35745;&#31243;&#24207;&#26469;&#22788;&#29702;&#20219;&#24847;&#25968;&#37327;&#30340;&#26102;&#24046;&#65311; &#31572;&#26696;&#26159;&#65306;&#20351;&#29992;&#36890;&#37197;&#31526;&#65288;wildcard URLpatterns&#65289;&#12290;&#27491;&#22914;&#25105;&#20204;&#20043;&#21069;&#25552;&#21040;&#36807;&#65292;&#19968;&#20010;URL&#27169;&#24335;&#23601;&#26159;&#19968;&#20010;&#27491;&#21017;&#34920;&#36798;&#24335;&#12290;&#22240;&#27492;&#65292;&#36825;&#37324;&#21487;&#20197;&#20351;&#29992;d+&#26469;&#21305;&#37197;1&#20010;&#20197;&#19978;&#30340;&#25968;&#23383;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn137&quot;&gt;urlpatterns = patterns(&apos;&apos;,
    # ...
    (r&apos;^time/plus/\d+/$&apos;, hours_ahead),
    # ...
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#36825;&#37324;&#20351;&#29992;# &#8230;&#26469;&#34920;&#31034;&#30465;&#30053;&#20102;&#20854;&#23427;&#21487;&#33021;&#23384;&#22312;&#30340;URL&#27169;&#24335;&#23450;&#20041;&#12290; &#65288;&#35265;&#19978;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&#36825;&#20010;URL&#27169;&#24335;&#23558;&#21305;&#37197;&#31867;&#20284; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/plus/2/&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/plus/25/&lt;/span&gt;&lt;/tt&gt; ,&#29978;&#33267; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/plus/100000000000/&lt;/span&gt;&lt;/tt&gt; &#30340;&#20219;&#20309;URL&#12290; &#26356;&#36827;&#19968;&#27493;&#65292;&#35753;&#25105;&#20204;&#25226;&#23427;&#38480;&#21046;&#22312;&#26368;&#22823;&#20801;&#35768;99&#20010;&#23567;&#26102;&#65292; &#36825;&#26679;&#25105;&#20204;&#23601;&#21482;&#20801;&#35768;&#19968;&#20010;&#25110;&#20004;&#20010;&#25968;&#23383;&#65292;&#27491;&#21017;&#34920;&#36798;&#24335;&#30340;&#35821;&#27861;&#23601;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\d{1,2}&lt;/span&gt;&lt;/tt&gt; :&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn141&quot;&gt;(r&apos;^time/plus/\d{1,2}/$&apos;, hours_ahead),
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#22791;&#27880;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn143&quot;&gt;&#22312;&#24314;&#36896;Web&#24212;&#29992;&#30340;&#26102;&#20505;&#65292;&#23613;&#21487;&#33021;&#22810;&#32771;&#34385;&#21487;&#33021;&#30340;&#25968;&#25454;&#36755;&#20837;&#26159;&#24456;&#37325;&#35201;&#30340;&#65292;&#28982;&#21518;&#20915;&#23450;&#21738;&#20123;&#25105;&#20204;&#21487;&#20197;&#25509;&#21463;&#12290; &#22312;&#36825;&#37324;&#25105;&#20204;&#23601;&#35774;&#32622;&#20102;99&#20010;&#23567;&#26102;&#30340;&#26102;&#38388;&#27573;&#38480;&#21046;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn144&quot;&gt;&#21478;&#22806;&#19968;&#20010;&#37325;&#28857;&#65292;&#27491;&#21017;&#34920;&#36798;&#24335;&#23383;&#31526;&#20018;&#30340;&#24320;&#22836;&#23383;&#27597;&#8220;r&#8221;&#12290; &#23427;&#21578;&#35785;Python&#36825;&#26159;&#20010;&#21407;&#22987;&#23383;&#31526;&#20018;&#65292;&#19981;&#38656;&#35201;&#22788;&#29702;&#37324;&#38754;&#30340;&#21453;&#26012;&#26464;&#65288;&#36716;&#20041;&#23383;&#31526;&#65289;&#12290; &#22312;&#26222;&#36890;Python&#23383;&#31526;&#20018;&#20013;&#65292;&#21453;&#26012;&#26464;&#29992;&#20110;&#29305;&#27530;&#23383;&#31526;&#30340;&#36716;&#20041;&#12290;&#27604;&#22914;n&#36716;&#20041;&#25104;&#19968;&#20010;&#25442;&#34892;&#31526;&#12290; &#24403;&#20320;&#29992;r&#25226;&#23427;&#26631;&#31034;&#20026;&#19968;&#20010;&#21407;&#22987;&#23383;&#31526;&#20018;&#21518;&#65292;Python&#19981;&#20877;&#35270;&#20854;&#20013;&#30340;&#21453;&#26012;&#26464;&#20026;&#36716;&#20041;&#23383;&#31526;&#12290;&#20063;&#23601;&#26159;&#35828;&#65292;&#8220;n&#8221;&#26159;&#20004;&#20010;&#23383;&#31526;&#20018;&#65306;&#8220;&#8221;&#21644;&#8220;n&#8221;&#12290;&#30001;&#20110;&#21453;&#26012;&#26464;&#22312;Python&#20195;&#30721;&#21644;&#27491;&#21017;&#34920;&#36798;&#24335;&#20013;&#26377;&#20914;&#31361;&#65292;&#22240;&#27492;&#24314;&#35758;&#20320;&#22312;Python&#23450;&#20041;&#27491;&#21017;&#34920;&#36798;&#24335;&#26102;&#37117;&#20351;&#29992;&#21407;&#22987;&#23383;&#31526;&#20018;&#12290; &#20174;&#29616;&#22312;&#24320;&#22987;&#65292;&#26412;&#25991;&#25152;&#26377;URL&#27169;&#24335;&#37117;&#29992;&#21407;&#22987;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn145&quot;&gt;&#29616;&#22312;&#25105;&#20204;&#24050;&#32463;&#35774;&#35745;&#20102;&#19968;&#20010;&#24102;&#36890;&#37197;&#31526;&#30340;URL&#65292;&#25105;&#20204;&#38656;&#35201;&#19968;&#20010;&#26041;&#27861;&#25226;&#23427;&#20256;&#36882;&#21040;&#35270;&#22270;&#20989;&#25968;&#37324;&#21435;&#65292;&#36825;&#26679; &#25105;&#20204;&#21482;&#29992;&#19968;&#20010;&#35270;&#22270;&#20989;&#25968;&#23601;&#21487;&#20197;&#22788;&#29702;&#25152;&#26377;&#30340;&#26102;&#38388;&#27573;&#20102;&#12290; &#25105;&#20204;&#20351;&#29992;&#22278;&#25324;&#21495;&#25226;&#21442;&#25968;&#22312;URL&#27169;&#24335;&#37324;&#26631;&#35782; &#20986;&#26469;&#12290; &#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#24819;&#35201;&#25226;&#36825;&#20123;&#25968;&#23383;&#20316;&#20026;&#21442;&#25968;&#65292;&#29992;&#22278;&#25324;&#21495;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\d{1,2}&lt;/span&gt;&lt;/tt&gt; &#21253;&#22260;&#36215;&#26469;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn147&quot;&gt;(r&apos;^time/plus/(\d{1,2})/$&apos;, hours_ahead),
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn148&quot;&gt;&#22914;&#26524;&#20320;&#29087;&#24713;&#27491;&#21017;&#34920;&#36798;&#24335;&#65292;&#37027;&#20040;&#20320;&#24212;&#35813;&#24050;&#32463;&#20102;&#35299;&#65292;&#27491;&#21017;&#34920;&#36798;&#24335;&#20063;&#26159;&#29992;&#22278;&#25324;&#21495;&#26469;&#20174;&#25991;&#26412;&#37324; &lt;em&gt;&#25552;&#21462;&lt;/em&gt; &#25968;&#25454;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&#26368;&#32456;&#30340;URLconf&#21253;&#21547;&#19978;&#38754;&#20004;&#20010;&#35270;&#22270;&#65292;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn151&quot;&gt;from django.conf.urls.defaults import *
from mysite.views import hello, current_datetime, hours_ahead

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^hello/$&apos;, hello),
    (r&apos;^time/$&apos;, current_datetime),
    (r&apos;^time/plus/(\d{1,2})/$&apos;, hours_ahead),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn152&quot;&gt;&#29616;&#22312;&#24320;&#22987;&#20889; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hours_ahead&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn153&quot;&gt;&#32534;&#30721;&#27425;&#24207;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#20808;&#20889;&#20102;URLpattern &#65292;&#28982;&#21518;&#26159;&#35270;&#22270;&#65292;&#20294;&#26159;&#22312;&#21069;&#38754;&#30340;&#20363;&#23376;&#20013;&#65292; &#25105;&#20204;&#20808;&#20889;&#20102;&#35270;&#22270;&#65292;&#28982;&#21518;&#26159;URLpattern &#12290; &#21738;&#19968;&#31181;&#26041;&#24335;&#27604;&#36739;&#22909;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&#21999;&#65292;&#24590;&#20040;&#35828;&#21602;&#65292;&#27599;&#20010;&#24320;&#21457;&#32773;&#26159;&#19981;&#19968;&#26679;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn156&quot;&gt;&#22914;&#26524;&#20320;&#26159;&#21916;&#27426;&#20174;&#24635;&#20307;&#19978;&#26469;&#25226;&#25569;&#20107;&#29289;&#65288;&#27880;&#65306; &#25110;&#35793;&#20026;&#8220;&#22823;&#23616;&#35266;&#8221;&#65289;&#31867;&#22411;&#30340;&#20154;&#65292;&#20320;&#24212;&#35813;&#20250;&#24819;&#22312;&#39033;&#30446;&#24320;&#22987; &#30340;&#26102;&#20505;&#23601;&#20889;&#19979;&#25152;&#26377;&#30340;URL&#37197;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn157&quot;&gt;&#22914;&#26524;&#20320;&#20174;&#26356;&#20687;&#26159;&#19968;&#20010;&#33258;&#24213;&#21521;&#19978;&#30340;&#24320;&#21457;&#32773;&#65292;&#20320;&#21487;&#33021;&#26356;&#21916;&#27426;&#20808;&#20889;&#35270;&#22270;&#65292; &#28982;&#21518;&#25226;&#23427;&#20204;&#25346;&#25509;&#21040;URL&#19978;&#12290; &#36825;&#21516;&#26679;&#26159;&#21487;&#20197;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn158&quot;&gt;&#26368;&#21518;&#65292;&#21462;&#20915;&#19982;&#20320;&#21916;&#27426;&#21738;&#31181;&#25216;&#26415;&#65292;&#20004;&#31181;&#26041;&#27861;&#37117;&#26159;&#21487;&#20197;&#30340;&#12290; (&#35265;&#19978;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hours_ahead&lt;/span&gt;&lt;/tt&gt; &#21644;&#25105;&#20204;&#20197;&#21069;&#20889;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime&lt;/span&gt;&lt;/tt&gt; &#24456;&#35937;&#65292;&#20851;&#38190;&#30340;&#21306;&#21035;&#22312;&#20110;&#65306; &#23427;&#22810;&#20102;&#19968;&#20010;&#39069;&#22806;&#21442;&#25968;&#65292;&#26102;&#38388;&#24046;&#12290;
&#20197;&#19979;&#26159;view&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn161&quot;&gt;from django.http import Http404, HttpResponse
import datetime

def hours_ahead(request, offset):
    try:
        offset = int(offset)
    except ValueError:
        raise Http404()
    dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
    html = &quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;In %s hour(s), it will be %s.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot; % (offset, dt)
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#35753;&#25105;&#20204;&#36880;&#34892;&#20998;&#26512;&#19968;&#19979;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn163&quot;&gt;&#35270;&#22270;&#20989;&#25968;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hours_ahead&lt;/span&gt;&lt;/tt&gt; , &#26377; &lt;em&gt;&#20004;&#20010;&lt;/em&gt; &#21442;&#25968;: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;offset&lt;/span&gt;&lt;/tt&gt; . (&#35265;&#19978;)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn164&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; &#26159;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;, &#23601;&#20687;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime&lt;/span&gt;&lt;/tt&gt; &#20013;&#19968;&#26679;. &#20877;&#35828;&#19968;&#27425;&#22909;&#20102;: &#27599;&#19968;&#20010;&#35270;&#22270; &lt;em&gt;&#24635;&#26159;&lt;/em&gt; &#20197;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#20316;&#20026; &#23427;&#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#12290; (&#35265;&#19978;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;offset&lt;/span&gt;&lt;/tt&gt; &#26159;&#20174;&#21305;&#37197;&#30340;URL&#37324;&#25552;&#21462;&#20986;&#26469;&#30340;&#12290; &#20363;&#22914;&#65306;&#22914;&#26524;&#35831;&#27714;URL&#26159;/time/plus/3/&#65292;&#37027;&#20040;offset&#23558;&#20250;&#26159;3&#65307;&#22914;&#26524;&#35831;&#27714;URL&#26159;/time/plus/21/&#65292;&#37027;&#20040;offset&#23558;&#20250;&#26159;21&#12290;&#35831;&#27880;&#24847;&#65306;&#25429;&#33719;&#20540;&#27704;&#36828;&#37117;&#26159;&#23383;&#31526;&#20018;&#65288;string&#65289;&#31867;&#22411;&#65292;&#32780;&#19981;&#20250;&#26159;&#25972;&#25968;&#65288;integer&#65289;&#31867;&#22411;&#65292;&#21363;&#20351;&#36825;&#20010;&#23383;&#31526;&#20018;&#20840;&#30001;&#25968;&#23383;&#26500;&#25104;&#65288;&#22914;&#65306;&#8220;21&#8221;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn166&quot;&gt;&#65288;&#20174;&#25216;&#26415;&#19978;&#26469;&#35828;&#65292;&#25429;&#33719;&#20540;&#24635;&#26159;Unicode objects&#65292;&#32780;&#19981;&#26159;&#31616;&#21333;&#30340;Python&#23383;&#33410;&#20018;&#65292;&#20294;&#30446;&#21069;&#19981;&#38656;&#35201;&#25285;&#24515;&#36825;&#20123;&#24046;&#21035;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn167&quot;&gt;&#22312;&#36825;&#37324;&#25105;&#20204;&#21629;&#21517;&#21464;&#37327;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;offset&lt;/span&gt;&lt;/tt&gt; &#65292;&#20320;&#20063;&#21487;&#20197;&#20219;&#24847;&#21629;&#21517;&#23427;&#65292;&#21482;&#35201;&#31526;&#21512;Python &#30340;&#35821;&#27861;&#12290; &#21464;&#37327;&#21517;&#26159;&#26080;&#20851;&#32039;&#35201;&#30340;&#65292;&#37325;&#35201;&#30340;&#26159;&#23427;&#30340;&#20301;&#32622;&#65292;&#23427;&#26159;&#36825;&#20010;&#20989;&#25968;&#30340;&#31532;&#20108;&#20010; &#21442;&#25968; (&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; &#30340;&#21518;&#38754;&#65289;&#12290; &#20320;&#36824;&#21487;&#20197;&#20351;&#29992;&#20851;&#38190;&#23383;&#26469;&#23450;&#20041;&#23427;&#65292;&#32780;&#19981;&#26159;&#29992; &#20301;&#32622;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&#25105;&#20204;&#22312;&#36825;&#20010;&#20989;&#25968;&#20013;&#35201;&#20570;&#30340;&#31532;&#19968;&#20214;&#20107;&#24773;&#23601;&#26159;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;offset&lt;/span&gt;&lt;/tt&gt; &#19978;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;int()&lt;/span&gt;&lt;/tt&gt; . &#36825;&#20250;&#25226;&#36825;&#20010;&#23383;&#31526;&#20018;&#20540;&#36716;&#25442;&#20026;&#25972;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn169&quot;&gt;&#35831;&#30041;&#24847;&#65306;&#22914;&#26524;&#20320;&#22312;&#19968;&#20010;&#19981;&#33021;&#36716;&#25442;&#25104;&#25972;&#25968;&#31867;&#22411;&#30340;&#20540;&#19978;&#35843;&#29992;int()&#65292;Python&#23558;&#25243;&#20986;&#19968;&#20010;ValueError&#24322;&#24120;&#12290;&#22914;&#65306;int(&#8216;foo&#8217;)&#12290;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#22914;&#26524;&#25105;&#20204;&#36935;&#21040;ValueError&#24322;&#24120;&#65292;&#25105;&#20204;&#23558;&#36716;&#20026;&#25243;&#20986;django.http.Http404&#24322;&#24120;&#8212;&#8212;&#27491;&#22914;&#20320;&#24819;&#35937;&#30340;&#37027;&#26679;&#65306;&#26368;&#32456;&#26174;&#31034;404&#39029;&#38754;&#65288;&#25552;&#31034;&#20449;&#24687;&#65306;&#39029;&#38754;&#19981;&#23384;&#22312;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn170&quot;&gt;&#26426;&#28789;&#30340;&#35835;&#32773;&#21487;&#33021;&#20250;&#38382;&#65306; &#25105;&#20204;&#22312;URL&#27169;&#24335;&#20013;&#29992;&#27491;&#21017;&#34920;&#36798;&#24335;(d{1,2})&#32422;&#26463;&#23427;&#65292;&#20165;&#25509;&#21463;&#25968;&#23383;&#24590;&#20040;&#26679;&#65311;&#36825;&#26679;&#26080;&#35770;&#22914;&#20309;&#65292;offset&#37117;&#26159;&#30001;&#25968;&#23383;&#26500;&#25104;&#30340;&#12290; &#31572;&#26696;&#26159;&#65306;&#25105;&#20204;&#19981;&#20250;&#36825;&#20040;&#20570;&#65292;&#22240;&#20026;URLpattern&#25552;&#20379;&#30340;&#26159;&#8220;&#36866;&#24230;&#20294;&#26377;&#29992;&#8221;&#32423;&#21035;&#30340;&#36755;&#20837;&#26657;&#39564;&#12290;&#19975;&#19968;&#36825;&#20010;&#35270;&#22270;&#20989;&#25968;&#34987;&#20854;&#23427;&#26041;&#24335;&#35843;&#29992;&#65292;&#25105;&#20204;&#20173;&#38656;&#33258;&#34892;&#26816;&#26597;ValueError&#12290;
&#23454;&#36341;&#35777;&#26126;&#65292;&#22312;&#23454;&#29616;&#35270;&#22270;&#20989;&#25968;&#26102;&#65292;&#19981;&#33222;&#27979;&#21442;&#25968;&#20540;&#30340;&#20570;&#27861;&#26159;&#27604;&#36739;&#22909;&#30340;&#12290; &#26494;&#25955;&#32806;&#21512;&#65292;&#36824;&#35760;&#24471;&#20040;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn171&quot;&gt;&#19979;&#19968;&#34892;&#65292;&#35745;&#31639;&#24403;&#21069;&#26085;&#26399;/&#26102;&#38388;&#65292;&#28982;&#21518;&#21152;&#19978;&#36866;&#24403;&#30340;&#23567;&#26102;&#25968;&#12290; &#22312;current_datetime&#35270;&#22270;&#20013;&#65292;&#25105;&#20204;&#24050;&#32463;&#35265;&#36807;datetime.datetime.now()&#12290;&#36825;&#37324;&#26032;&#30340;&#27010;&#24565;&#26159;&#25191;&#34892;&#26085;&#26399;/&#26102;&#38388;&#30340;&#31639;&#26415;&#25805;&#20316;&#12290;&#25105;&#20204;&#38656;&#35201;&#21019;&#24314;&#19968;&#20010;datetime.timedelta&#23545;&#35937;&#21644;&#22686;&#21152;&#19968;&#20010;datetime.datetime&#23545;&#35937;&#12290; &#32467;&#26524;&#20445;&#23384;&#22312;&#21464;&#37327;dt&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn172&quot;&gt;&#36825;&#19968;&#34892;&#36824;&#35828;&#26126;&#20102;&#65292;&#25105;&#20204;&#20026;&#20160;&#20040;&#22312;offset&#19978;&#35843;&#29992;int()&#8212;&#8212;datetime.timedelta&#20989;&#25968;&#35201;&#27714;hours&#21442;&#25968;&#24517;&#39035;&#20026;&#25972;&#25968;&#31867;&#22411;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn173&quot;&gt;&#36825;&#34892;&#21644;&#21069;&#38754;&#30340;&#37027;&#34892;&#30340;&#30340;&#19968;&#20010;&#24494;&#23567;&#24046;&#21035;&#23601;&#26159;&#65292;&#23427;&#20351;&#29992;&#24102;&#26377;&#20004;&#20010;&#20540;&#30340;Python&#30340;&#26684;&#24335;&#21270;&#23383;&#31526;&#20018;&#21151;&#33021;&#65292; &#32780;&#19981;&#20165;&#20165;&#26159;&#19968;&#20010;&#20540;&#12290; &#22240;&#27492;&#65292;&#22312;&#23383;&#31526;&#20018;&#20013;&#26377;&#20004;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;%s&lt;/span&gt;&lt;/tt&gt; &#31526;&#21495;&#21644;&#19968;&#20010;&#20197;&#36827;&#34892;&#25554;&#20837;&#30340;&#20540;&#30340;&#20803;&#32452;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;(offset,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;dt)&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#26368;&#32456;&#65292;&#36820;&#22238;&#19968;&#20010;HTML&#30340;HttpResponse&#12290; &#22914;&#20170;&#65292;&#36825;&#31181;&#26041;&#24335;&#24050;&#32463;&#36807;&#26102;&#20102;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn175&quot;&gt;&#22312;&#23436;&#25104;&#35270;&#22270;&#20989;&#25968;&#21644;URL&#37197;&#32622;&#32534;&#20889;&#21518;&#65292;&#21551;&#21160;Django&#24320;&#21457;&#26381;&#21153;&#22120;&#65292;&#29992;&#27983;&#35272;&#22120;&#35775;&#38382; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/time/plus/3/&lt;/span&gt;&lt;/tt&gt; &#26469;&#30830;&#35748;&#23427;&#24037;&#20316;&#27491;&#24120;&#12290; &#28982;&#21518;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/time/plus/5/&lt;/span&gt;&lt;/tt&gt; &#12290;&#20877;&#28982;&#21518;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/time/plus/24/&lt;/span&gt;&lt;/tt&gt; &#12290;&#26368;&#21518;&#65292;&#35775;&#38382; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/time/plus/100/&lt;/span&gt;&lt;/tt&gt; &#26469;&#26816;&#39564;URL&#37197;&#32622;&#37324;&#35774;&#32622;&#30340;&#27169;&#24335;&#26159;&#21542;&#21482; &#25509;&#21463;&#19968;&#20010;&#25110;&#20004;&#20010;&#25968;&#23383;&#65307;Django&#20250;&#26174;&#31034;&#19968;&#20010; Page not found error &#39029;&#38754;, &#21644;&#20197;&#21069;&#30475;&#21040;&#30340; 404 &#38169;&#35823;&#19968;&#26679;&#12290; &#35775;&#38382;URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/time/plus/&lt;/span&gt;&lt;/tt&gt; (&lt;em&gt;&#27809;&#26377;&lt;/em&gt; &#23450;&#20041;&#26102;&#38388;&#24046;) &#20063;&#20250;&#25243;&#20986;404&#38169;&#35823;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn176&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn176&quot;&gt;Django &#28418;&#20142;&#30340;&#20986;&#38169;&#39029;&#38754;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn177&quot;&gt;&#33457;&#20960;&#20998;&#38047;&#26102;&#38388;&#27427;&#36175;&#19968;&#19979;&#25105;&#20204;&#20889;&#22909;&#30340;Web&#24212;&#29992;&#31243;&#24207;&#65292;&#28982;&#21518;&#25105;&#20204;&#20877;&#26469;&#25630;&#28857;&#23567;&#30772;&#22351;&#12290; &#25105;&#20204;&#25925;&#24847;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;views.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#20013;&#24341;&#20837;&#19968;&#39033; Python &#38169;&#35823;&#65292;&#27880;&#37322;&#25481; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hours_ahead&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;int(offset)&lt;/span&gt;&lt;/tt&gt; &#19968;&#34892;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn179&quot;&gt;def hours_ahead(request, offset):
    # try:
    #     offset = int(offset)
    # except ValueError:
    #     raise Http404()
    dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
    html = &quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;In %s hour(s), it will be %s.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot; % (offset, dt)
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;&#21551;&#21160;&#24320;&#21457;&#26381;&#21153;&#22120;&#65292;&#28982;&#21518;&#35775;&#38382; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/time/plus/3/&lt;/span&gt;&lt;/tt&gt; &#12290;&#20320;&#20250;&#30475;&#21040;&#19968;&#20010;&#21253;&#21547;&#22823;&#37327;&#20449;&#24687;&#30340;&#20986;&#38169;&#39029;&#65292;&#26368;&#19978;&#38754; &#30340;&#19968;&#26465; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TypeError&lt;/span&gt;&lt;/tt&gt; &#20449;&#24687;&#26159;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;unsupported&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;timedelta&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;hours&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;component:&lt;/span&gt;&amp;nbsp; &lt;span class=&quot;pre&quot;&gt;unicode&quot;&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn181&quot;&gt;&#24590;&#20040;&#22238;&#20107;&#21602;&#65311; &#26159;&#30340;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime.timedelta&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#35201;&#27714; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hours&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#24517;&#39035;&#20026;&#25972;&#22411;&#65292; &#32780;&#25105;&#20204;&#27880;&#37322;&#25481;&#20102;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;offset&lt;/span&gt;&lt;/tt&gt; &#36716;&#20026;&#25972;&#22411;&#30340;&#20195;&#30721;&#12290; &#36825;&#26679;&#23548;&#33268; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime.timedelta&lt;/span&gt;&lt;/tt&gt; &#24377;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TypeError&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn182&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#26159;&#20026;&#20102;&#23637;&#31034; Django &#30340;&#20986;&#38169;&#39029;&#38754;&#12290; &#25105;&#20204;&#26469;&#33457;&#20123;&#26102;&#38388;&#30475;&#19968;&#30475;&#36825;&#20010;&#20986;&#38169;&#39029;&#65292;&#20102;&#35299;&#19968;&#19979;&#20854;&#20013; &#32473;&#20986;&#20102;&#21738;&#20123;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn183&quot;&gt;&#20197;&#19979;&#26159;&#20540;&#24471;&#27880;&#24847;&#30340;&#19968;&#20123;&#35201;&#28857;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn184&quot;&gt;&#22312;&#39029;&#38754;&#39030;&#37096;&#65292;&#20320;&#21487;&#20197;&#24471;&#21040;&#20851;&#38190;&#30340;&#24322;&#24120;&#20449;&#24687;&#65306; &#24322;&#24120;&#25968;&#25454;&#31867;&#22411;&#12289;&#24322;&#24120;&#30340;&#21442;&#25968; (&#22914;&#26412;&#20363;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;unsupported&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;type&quot;&lt;/span&gt;&lt;/tt&gt; &#65289;&#12289;&#22312;&#21738;&#20010;&#25991;&#20214;&#20013;&#24341;&#21457;&#20102;&#24322;&#24120;&#12289;&#20986;&#38169;&#30340;&#34892;&#21495;&#31561;&#31561;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#22312;&#20851;&#38190;&#24322;&#24120;&#20449;&#24687;&#19979;&#26041;&#65292;&#35813;&#39029;&#38754;&#26174;&#31034;&#20102;&#23545;&#35813;&#24322;&#24120;&#30340;&#23436;&#25972; Python &#36861;&#36394;&#20449;&#24687;&#12290; &#36825;&#31867;&#20284;&#20110;&#20320;&#22312; Python &#21629;&#20196;&#34892;&#35299;&#37322;&#22120;&#20013;&#33719;&#24471;&#30340;&#36861;&#28335;&#20449;&#24687;&#65292;&#21482;&#19981;&#36807;&#21518;&#32773;&#26356;&#20855;&#20132;&#20114;&#24615;&#12290; &#23545;&#26632;&#20013;&#30340;&#27599;&#19968;&#24103;&#65292;Django &#22343;&#26174;&#31034;&#20102;&#20854;&#25991;&#20214;&#21517;&#12289;&#20989;&#25968;&#25110;&#26041;&#27861;&#21517;&#12289;&#34892;&#21495;&#21450;&#35813;&#34892;&#28304;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#28857;&#20987;&#35813;&#34892;&#20195;&#30721; (&#20197;&#28145;&#28784;&#33394;&#26174;&#31034;)&#65292;&#20320;&#21487;&#20197;&#30475;&#21040;&#20986;&#38169;&#34892;&#30340;&#21069;&#21518;&#20960;&#34892;&#65292;&#20174;&#32780;&#24471;&#30693;&#30456;&#20851;&#19978;&#19979;&#25991;&#24773;&#20917;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn187&quot;&gt;&#28857;&#20987;&#26632;&#20013;&#30340;&#20219;&#20309;&#19968;&#24103;&#30340;&#8220;Local vars&#8221;&#21487;&#20197;&#30475;&#21040;&#19968;&#20010;&#25152;&#26377;&#23616;&#37096;&#21464;&#37327;&#30340;&#21015;&#34920;&#65292;&#20197;&#21450;&#22312;&#20986;&#38169; &#37027;&#19968;&#24103;&#26102;&#23427;&#20204;&#30340;&#20540;&#12290; &#36825;&#20123;&#35843;&#35797;&#20449;&#24687;&#30456;&#24403;&#26377;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn188&quot;&gt;&#27880;&#24847;&#8220;Traceback&#8221;&#19979;&#38754;&#30340;&#8220;Switch to copy-and-paste view&#8221;&#25991;&#23383;&#12290; &#28857;&#20987;&#36825;&#20123;&#23383;&#65292;&#36861;&#28335;&#20250; &#20999;&#25442;&#21478;&#19968;&#20010;&#35270;&#22270;&#65292;&#23427;&#35753;&#20320;&#24456;&#23481;&#26131;&#22320;&#22797;&#21046;&#21644;&#31896;&#36148;&#36825;&#20123;&#20869;&#23481;&#12290; &#24403;&#20320;&#24819;&#21516;&#20854;&#20182;&#20154;&#20998;&#20139;&#36825;&#20123;&#24322;&#24120; &#36861;&#28335;&#20197;&#33719;&#24471;&#25216;&#26415;&#25903;&#25345;&#26102;&#65288;&#27604;&#22914;&#22312; Django &#30340; IRC &#32842;&#22825;&#23460;&#25110;&#37038;&#20214;&#21015;&#34920;&#20013;&#65289;&#65292;&#21487;&#20197;&#20351;&#29992;&#23427;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn189&quot;&gt;&#20320;&#25353;&#19968;&#19979;&#19979;&#38754;&#30340;&#8220;Share this traceback on a public Web site&#8221;&#25353;&#38062;&#65292;&#23427;&#23558;&#20250;&#23436;&#25104;&#36825;&#39033;&#24037;&#20316;&#12290; &#28857;&#20987;&#23427;&#20197;&#20256;&#22238;&#36861;&#28335;&#20449;&#24687;&#33267;http://www.dpaste.com/&#65292;&#22312;&#37027;&#37324;&#20320;&#21487;&#20197;&#24471;&#21040;&#19968;&#20010;&#21333;&#29420;&#30340;URL&#24182;&#19982;&#20854;&#20182;&#20154;&#20998;&#20139;&#20320;&#30340;&#36861;&#28335;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&#25509;&#19979;&#26469;&#30340;&#8220;Request information&#8221;&#37096;&#20998;&#21253;&#21547;&#20102;&#26377;&#20851;&#20135;&#29983;&#38169;&#35823;&#30340; Web &#35831;&#27714;&#30340;&#22823;&#37327;&#20449;&#24687;&#65306; GET &#21644; POST&#12289;cookie &#20540;&#12289;&#20803;&#25968;&#25454;&#65288;&#35937; CGI &#22836;&#65289;&#12290; &#22312;&#38468;&#24405;H&#37324;&#32473;&#20986;&#20102;request&#30340;&#23545;&#35937;&#30340; &#23436;&#25972;&#21442;&#32771;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn191&quot;&gt;Request&#20449;&#24687;&#30340;&#19979;&#38754;&#65292;&#8220;Settings&#8221;&#21015;&#20986;&#20102; Django &#20351;&#29992;&#30340;&#20855;&#20307;&#37197;&#32622;&#20449;&#24687;&#12290; &#65288;&#25105;&#20204;&#24050;&#32463;&#25552;&#21450;&#36807;ROOT_URLCONF&#65292;&#25509;&#19979;&#26469;&#25105;&#20204;&#23558;&#21521;&#20320;&#23637;&#31034;&#21508;&#24335;&#30340;Django&#35774;&#32622;&#12290; &#38468;&#24405;D&#35206;&#30422;&#20102;&#25152;&#26377;&#21487;&#29992;&#30340;&#35774;&#32622;&#12290;&#65289;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn192&quot;&gt;Django &#30340;&#20986;&#38169;&#39029;&#26576;&#20123;&#24773;&#20917;&#19979;&#26377;&#33021;&#21147;&#26174;&#31034;&#26356;&#22810;&#30340;&#20449;&#24687;&#65292;&#27604;&#22914;&#27169;&#26495;&#35821;&#27861;&#38169;&#35823;&#12290; &#25105;&#20204;&#35752;&#35770; Django &#27169;&#26495;&#31995;&#32479;&#26102;&#20877;&#35828;&#23427;&#20204;&#12290; &#29616;&#22312;&#65292;&#21462;&#28040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;int(offset)&lt;/span&gt;&lt;/tt&gt; &#36825;&#34892;&#30340;&#27880;&#37322;&#65292;&#35753;&#23427;&#37325;&#26032;&#27491;&#24120; &#24037;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&#19981;&#30693;&#36947;&#20320;&#26159;&#19981;&#26159;&#37027;&#31181;&#20351;&#29992;&#23567;&#24515;&#25918;&#32622;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;print&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#26469;&#24110;&#21161;&#35843;&#35797;&#30340;&#31243;&#24207;&#21592;&#65311; &#20320;&#20854;&#23454;&#21487;&#20197;&#29992; Django &#20986;&#38169;&#39029;&#26469;&#20570;&#36825;&#20123;&#65292;&#32780;&#19981;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;print&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#12290; &#22312;&#20320;&#35270;&#22270;&#30340;&#20219;&#20309;&#20301;&#32622;&#65292;&#20020;&#26102;&#25554;&#20837;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt; &#26469;&#35302;&#21457;&#20986;&#38169;&#39029;&#12290; &#28982;&#21518;&#65292;&#20320;&#23601;&#21487;&#20197;&#30475;&#21040;&#23616;&#37096;&#21464;&#37327;&#21644;&#31243;&#24207;&#35821;&#21477;&#20102;&#12290; &#36825;&#37324;&#26377;&#20010;&#20351;&#29992;hours_ahead&#35270;&#22270;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn195&quot;&gt;def hours_ahead(request, offset):
    try:
        offset = int(offset)
    except ValueError:
        raise Http404()
    dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
    assert False
    html = &quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;In %s hour(s), it will be %s.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot; % (offset, dt)
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn196&quot;&gt;&#26368;&#21518;&#65292;&#24456;&#26174;&#28982;&#36825;&#20123;&#20449;&#24687;&#24456;&#22810;&#26159;&#25935;&#24863;&#30340;&#65292;&#23427;&#26292;&#38706;&#20102;&#20320; Python &#20195;&#30721;&#30340;&#20869;&#37096;&#32467;&#26500;&#20197;&#21450; Django &#37197;&#32622;&#65292;&#22312; Internet &#19978;&#20844;&#24320;&#36825;&#20449;&#24687;&#26159;&#24456;&#24858;&#34850;&#30340;&#12290; &#19981;&#24576;&#22909;&#24847;&#30340;&#20154;&#20250;&#23581;&#35797;&#20351;&#29992;&#23427;&#25915;&#20987;&#20320;&#30340; Web &#24212;&#29992;&#31243;&#24207;&#65292;&#20570;&#20123;&#19979;&#27969;&#20043;&#20107;&#12290; &#22240;&#27492;&#65292;Django &#20986;&#38169;&#20449;&#24687;&#20165;&#22312; debug &#27169;&#24335;&#19979;&#25165;&#20250;&#26174;&#29616;&#12290; &#25105;&#20204;&#31245;&#21518; &#35828;&#26126;&#22914;&#20309;&#31105;&#29992; debug &#27169;&#24335;&#12290; &#29616;&#22312;&#65292;&#20320;&#21482;&#35201;&#30693;&#36947; Django &#26381;&#21153;&#22120;&#22312;&#20320;&#24320;&#21551;&#23427;&#26102;&#40664;&#35748;&#36816;&#34892;&#22312; debug &#27169;&#24335;&#23601;&#34892;&#20102;&#12290;
&#65288;&#21548;&#36215;&#26469;&#24456;&#29087;&#24713;&#65311; &#39029;&#38754;&#27809;&#26377;&#21457;&#29616;&#38169;&#35823;&#65292;&#22914;&#21069;&#25152;&#36848;&#65292;&#24037;&#20316;&#27491;&#24120;&#12290;&#65289;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn197&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&#30446;&#21069;&#20026;&#27490;&#65292;&#25105;&#20204;&#24050;&#32463;&#20889;&#22909;&#20102;&#35270;&#22270;&#20989;&#25968;&#21644;&#30828;&#32534;&#30721;&#30340;HTML&#12290; &#22312;&#28436;&#31034;&#26680;&#24515;&#27010;&#24565;&#26102;&#65292;&#25105;&#20204;&#25152;&#20316;&#30340;&#26159;&#20026;&#20102;&#20445;&#25345;&#31616;&#21333;&#12290;&#20294;&#26159;&#22312;&#29616;&#23454;&#19990;&#30028;&#20013;&#65292;&#36825;&#24046;&#19981;&#22810;&#24635;&#26159;&#20010;&#22351;&#20027;&#24847;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&#24184;&#36816;&#30340;&#26159;&#65292;Django&#20869;&#24314;&#26377;&#19968;&#20010;&#31616;&#21333;&#26377;&#24378;&#22823;&#30340;&#27169;&#26495;&#22788;&#29702;&#24341;&#25806;&#26469;&#35753;&#20320;&#20998;&#31163;&#20004;&#31181;&#24037;&#20316;&#65306; &#19979;&#19968;&#31456;&#65292;&#25105;&#20204;&#23558;&#23398;&#20064;&#27169;&#26495;&#24341;&#25806;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter04</id>
        <title type="html">chapter04</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter04"/>
        <published>2015-02-26T23:30:11+08:00</published>
        <updated>2015-02-26T23:30:11+08:00</updated> 
        <category term="/General" label="General" />
        <summary type="html">&lt;p class=&quot;cn&quot; id=&quot;cn215&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#20165;&#20165;&#33021;&#22815;&#22312;&#24490;&#29615;&#20013;&#20351;&#29992;&#12290; &#22312;&#27169;&#26495;&#35299;&#26512;&#22120;&#30896;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endfor&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#26631;&#31614;&#21518;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop&lt;/span&gt;&lt;/tt&gt;&#23601;&#19981;&#21487;&#35775;&#38382;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn216&quot;&gt;Context&#21644;forloop&#21464;&#37327;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&#22312;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#22359;&#20013;&#65292;&#24050;&#23384;&#22312;&#30340;&#21464;&#37327;&#20250;&#34987;&#31227;&#38500;&#65292;&#20197;&#36991;&#20813; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#34987;&#35206;&#30422;&#12290; Django&#20250;&#25226;&#36825;&#20010;&#21464;&#37327;&#31227;&#21160;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.parentloop&lt;/span&gt;&lt;/tt&gt; &#20013;&#12290;&#36890;&#24120;&#25105;&#20204;&#19981;&#29992;&#25285;&#24515;&#36825;&#20010;&#38382;&#39064;&#65292;&#20294;&#26159;&#19968;&#26086;&#25105;&#20204;&#22312;&#27169;&#26495;&#20013;&#23450;&#20041;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#21464;&#37327;&#65288;&#24403;&#28982;&#25105;&#20204;&#21453;&#23545;&#36825;&#26679;&#20570;&#65289;&#65292;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#22359;&#20013;&#23427;&#20250;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.parentloop&lt;/span&gt;&lt;/tt&gt; &#34987;&#37325;&#26032;&#21629;&#21517;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;ifequal-ifnotequal&quot;&gt;
&lt;span id=&quot;cn218&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn218&quot;&gt;ifequal/ifnotequal&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn219&quot;&gt;Django&#27169;&#26495;&#31995;&#32479;&#21387;&#26681;&#20799;&#23601;&#27809;&#24819;&#36807;&#23454;&#29616;&#19968;&#20010;&#20840;&#21151;&#33021;&#30340;&#32534;&#31243;&#35821;&#35328;&#65292;&#25152;&#20197;&#23427;&#19981;&#20801;&#35768;&#25105;&#20204;&#22312;&#27169;&#26495;&#20013;&#25191;&#34892;Python&#30340;&#35821;&#21477;&#65288;&#36824;&#26159;&#37027;&#21477;&#35805;&#65292;&#35201;&#20102;&#35299;&#26356;&#22810;&#35831;&#21442;&#30475;&#29702;&#24565;&#21644;&#38480;&#21046;&#23567;&#33410;&#65289;&#12290; &#20294;&#26159;&#27604;&#36739;&#20004;&#20010;&#21464;&#37327;&#30340;&#20540;&#24182;&#19988;&#26174;&#31034;&#19968;&#20123;&#32467;&#26524;&#23454;&#22312;&#26159;&#20010;&#22826;&#24120;&#35265;&#30340;&#38656;&#27714;&#20102;&#65292;&#25152;&#20197;Django&#25552;&#20379;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ifequal&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#20379;&#25105;&#20204;&#20351;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn220&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ifequal&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#27604;&#36739;&#20004;&#20010;&#20540;&#65292;&#24403;&#20182;&#20204;&#30456;&#31561;&#26102;&#65292;&#26174;&#31034;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ifequal&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endifequal&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20043;&#20013;&#25152;&#26377;&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn221&quot;&gt;&#19979;&#38754;&#30340;&#20363;&#23376;&#27604;&#36739;&#20004;&#20010;&#27169;&#26495;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;currentuser&lt;/span&gt;&lt;/tt&gt; :&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn223&quot;&gt;{% ifequal user currentuser %}
    &amp;lt;h1&amp;gt;Welcome!&amp;lt;/h1&amp;gt;
{% endifequal %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn224&quot;&gt;&#21442;&#25968;&#21487;&#20197;&#26159;&#30828;&#32534;&#30721;&#30340;&#23383;&#31526;&#20018;&#65292;&#38543;&#20415;&#29992;&#21333;&#24341;&#21495;&#25110;&#32773;&#21452;&#24341;&#21495;&#24341;&#36215;&#26469;&#65292;&#25152;&#20197;&#19979;&#21015;&#20195;&#30721;&#37117;&#26159;&#27491;&#30830;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn226&quot;&gt;{% ifequal section &apos;sitenews&apos; %}
    &amp;lt;h1&amp;gt;Site News&amp;lt;/h1&amp;gt;
{% endifequal %}

{% ifequal section &quot;community&quot; %}
    &amp;lt;h1&amp;gt;Community&amp;lt;/h1&amp;gt;
{% endifequal %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn227&quot;&gt;&#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#31867;&#20284;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ifequal&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#25903;&#25345;&#21487;&#36873;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;else%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn229&quot;&gt;{% ifequal section &apos;sitenews&apos; %}
    &amp;lt;h1&amp;gt;Site News&amp;lt;/h1&amp;gt;
{% else %}
    &amp;lt;h1&amp;gt;No News Here&amp;lt;/h1&amp;gt;
{% endifequal %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn230&quot;&gt;&#21482;&#26377;&#27169;&#26495;&#21464;&#37327;&#65292;&#23383;&#31526;&#20018;&#65292;&#25972;&#25968;&#21644;&#23567;&#25968;&#21487;&#20197;&#20316;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ifequal&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#30340;&#21442;&#25968;&#12290;&#19979;&#38754;&#26159;&#21512;&#27861;&#21442;&#25968;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn232&quot;&gt;{% ifequal variable 1 %}
{% ifequal variable 1.23 %}
{% ifequal variable &apos;foo&apos; %}
{% ifequal variable &quot;foo&quot; %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn233&quot;&gt;&#20854;&#20182;&#20219;&#20309;&#31867;&#22411;&#65292;&#20363;&#22914;Python&#30340;&#23383;&#20856;&#31867;&#22411;&#12289;&#21015;&#34920;&#31867;&#22411;&#12289;&#24067;&#23572;&#31867;&#22411;&#65292;&#19981;&#33021;&#29992;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ifequal&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20013;&#12290; &#19979;&#38754;&#26159;&#20123;&#38169;&#35823;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn235&quot;&gt;{% ifequal variable True %}
{% ifequal variable [1, 2, 3] %}
{% ifequal variable {&apos;key&apos;: &apos;value&apos;} %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn236&quot;&gt;&#22914;&#26524;&#20320;&#38656;&#35201;&#21028;&#26029;&#21464;&#37327;&#26159;&#30495;&#36824;&#26159;&#20551;&#65292;&#35831;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26469;&#26367;&#20195; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ifequal&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn237&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn237&quot;&gt;&#27880;&#37322;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn238&quot;&gt;&#23601;&#20687;HTML&#25110;&#32773;Python&#65292;Django&#27169;&#26495;&#35821;&#35328;&#21516;&#26679;&#25552;&#20379;&#20195;&#30721;&#27880;&#37322;&#12290; &#27880;&#37322;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{#&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;#}&lt;/span&gt;&lt;/tt&gt; &#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn240&quot;&gt;{# This is a comment #}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn241&quot;&gt;&#27880;&#37322;&#30340;&#20869;&#23481;&#19981;&#20250;&#22312;&#27169;&#26495;&#28210;&#26579;&#26102;&#36755;&#20986;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn242&quot;&gt;&#29992;&#36825;&#31181;&#35821;&#27861;&#30340;&#27880;&#37322;&#19981;&#33021;&#36328;&#36234;&#22810;&#34892;&#12290; &#36825;&#20010;&#38480;&#21046;&#26159;&#20026;&#20102;&#25552;&#39640;&#27169;&#26495;&#35299;&#26512;&#30340;&#24615;&#33021;&#12290; &#22312;&#19979;&#38754;&#36825;&#20010;&#27169;&#26495;&#20013;&#65292;&#36755;&#20986;&#32467;&#26524;&#21644;&#27169;&#26495;&#26412;&#36523;&#26159; &#23436;&#20840;&#19968;&#26679;&#30340;&#65288;&#20063;&#23601;&#26159;&#35828;&#65292;&#27880;&#37322;&#26631;&#31614;&#24182;&#27809;&#26377;&#34987;&#35299;&#26512;&#20026;&#27880;&#37322;&#65289;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn244&quot;&gt;This is a {# this is not
a comment #}
test.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn245&quot;&gt;&#22914;&#26524;&#35201;&#23454;&#29616;&#22810;&#34892;&#27880;&#37322;&#65292;&#21487;&#20197;&#20351;&#29992;`` {% comment %}`` &#27169;&#26495;&#26631;&#31614;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn247&quot;&gt;{% comment %}
This is a
multi-line comment.
{% endcomment %}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id15&quot;&gt;
&lt;span id=&quot;cn248&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn248&quot;&gt;&#36807;&#28388;&#22120;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn249&quot;&gt;&#23601;&#35937;&#26412;&#31456;&#21069;&#38754;&#25552;&#21040;&#30340;&#19968;&#26679;&#65292;&#27169;&#26495;&#36807;&#28388;&#22120;&#26159;&#22312;&#21464;&#37327;&#34987;&#26174;&#31034;&#21069;&#20462;&#25913;&#23427;&#30340;&#20540;&#30340;&#19968;&#20010;&#31616;&#21333;&#26041;&#27861;&#12290; &#36807;&#28388;&#22120;&#20351;&#29992;&#31649;&#36947;&#23383;&#31526;&#65292;&#22914;&#19979;&#25152;&#31034;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn251&quot;&gt;{{ name|lower }}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn252&quot;&gt;&#26174;&#31034;&#30340;&#20869;&#23481;&#26159;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#34987;&#36807;&#28388;&#22120; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;lower&lt;/span&gt;&lt;/tt&gt; &#22788;&#29702;&#21518;&#30340;&#32467;&#26524;&#65292;&#23427;&#21151;&#33021;&#26159;&#36716;&#25442;&#25991;&#26412;&#20026;&#23567;&#20889;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn253&quot;&gt;&#36807;&#28388;&#31649;&#36947;&#21487;&#20197;&#34987;* &#22871;&#25509;* &#65292;&#26082;&#26159;&#35828;&#65292;&#19968;&#20010;&#36807;&#28388;&#22120;&#31649;&#36947;&#30340;&#36755;&#20986;&#21448;&#21487;&#20197;&#20316;&#20026;&#19979;&#19968;&#20010;&#31649;&#36947;&#30340;&#36755;&#20837;&#65292;&#22914;&#27492;&#19979;&#21435;&#12290; &#19979;&#38754;&#30340;&#20363;&#23376;&#23454;&#29616;&#26597;&#25214;&#21015;&#34920;&#30340;&#31532;&#19968;&#20010;&#20803;&#32032;&#24182;&#23558;&#20854;&#36716;&#21270;&#20026;&#22823;&#20889;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn255&quot;&gt;{{ my_list|first|upper }}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn256&quot;&gt;&#26377;&#20123;&#36807;&#28388;&#22120;&#26377;&#21442;&#25968;&#12290; &#36807;&#28388;&#22120;&#30340;&#21442;&#25968;&#36319;&#38543;&#20882;&#21495;&#20043;&#21518;&#24182;&#19988;&#24635;&#26159;&#20197;&#21452;&#24341;&#21495;&#21253;&#21547;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn258&quot;&gt;{{ bio|truncatewords:&quot;30&quot; }}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn259&quot;&gt;&#36825;&#20010;&#23558;&#26174;&#31034;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;bio&lt;/span&gt;&lt;/tt&gt; &#30340;&#21069;30&#20010;&#35789;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn260&quot;&gt;&#20197;&#19979;&#20960;&#20010;&#26159;&#26368;&#20026;&#37325;&#35201;&#30340;&#36807;&#28388;&#22120;&#30340;&#19968;&#37096;&#20998;&#12290; &#38468;&#24405;F&#21253;&#21547;&#20854;&#20313;&#30340;&#36807;&#28388;&#22120;&#12290;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn261&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;addslashes&lt;/span&gt;&lt;/tt&gt; : &#28155;&#21152;&#21453;&#26012;&#26464;&#21040;&#20219;&#20309;&#21453;&#26012;&#26464;&#12289;&#21333;&#24341;&#21495;&#25110;&#32773;&#21452;&#24341;&#21495;&#21069;&#38754;&#12290; &#36825;&#22312;&#22788;&#29702;&#21253;&#21547;JavaScript&#30340;&#25991;&#26412;&#26102;&#26159;&#38750;&#24120;&#26377;&#29992;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn262&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;date&lt;/span&gt;&lt;/tt&gt; : &#25353;&#25351;&#23450;&#30340;&#26684;&#24335;&#23383;&#31526;&#20018;&#21442;&#25968;&#26684;&#24335;&#21270; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;date&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292; &#33539;&#20363;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn264&quot;&gt;{{ pub_date|date:&quot;F j, Y&quot; }}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn265&quot;&gt;&#26684;&#24335;&#21442;&#25968;&#30340;&#23450;&#20041;&#22312;&#38468;&#24405;F&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn266&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;length&lt;/span&gt;&lt;/tt&gt; : &#36820;&#22238;&#21464;&#37327;&#30340;&#38271;&#24230;&#12290; &#23545;&#20110;&#21015;&#34920;&#65292;&#36825;&#20010;&#21442;&#25968;&#23558;&#36820;&#22238;&#21015;&#34920;&#20803;&#32032;&#30340;&#20010;&#25968;&#12290; &#23545;&#20110;&#23383;&#31526;&#20018;&#65292;&#36825;&#20010;&#21442;&#25968;&#23558;&#36820;&#22238;&#23383;&#31526;&#20018;&#20013;&#23383;&#31526;&#30340;&#20010;&#25968;&#12290; &#20320;&#21487;&#20197;&#23545;&#21015;&#34920;&#25110;&#32773;&#23383;&#31526;&#20018;&#65292;&#25110;&#32773;&#20219;&#20309;&#30693;&#36947;&#24590;&#20040;&#27979;&#23450;&#38271;&#24230;&#30340;Python &#23545;&#35937;&#20351;&#29992;&#36825;&#20010;&#26041;&#27861;&#65288;&#20063;&#23601;&#26159;&#35828;&#65292;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__len__()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#30340;&#23545;&#35937;&#65289;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id16&quot;&gt;
&lt;span id=&quot;cn267&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn267&quot;&gt;&#29702;&#24565;&#19982;&#23616;&#38480;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn268&quot;&gt;&#29616;&#22312;&#20320;&#24050;&#32463;&#23545;Django&#30340;&#27169;&#26495;&#35821;&#35328;&#26377;&#19968;&#20123;&#35748;&#35782;&#20102;&#65292;&#25105;&#20204;&#23558;&#25351;&#20986;&#19968;&#20123;&#29305;&#24847;&#35774;&#32622;&#30340;&#38480;&#21046;&#21644;&#20026;&#20160;&#20040;&#35201;&#36825;&#26679;&#20570; &#32972;&#21518;&#30340;&#19968;&#20123;&#35774;&#35745;&#21746;&#23398;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn269&quot;&gt;&#30456;&#23545;&#19982;&#20854;&#20182;&#30340;&#32593;&#32476;&#24212;&#29992;&#30340;&#32452;&#20214;&#65292;&#27169;&#26495;&#30340;&#35821;&#27861;&#24456;&#20855;&#20027;&#35266;&#24615;&#65292;&#22240;&#27492;&#21487;&#20379;&#31243;&#24207;&#21592;&#30340;&#36873;&#25321;&#26041;&#26696;&#20063;&#24456;&#24191;&#27867;&#12290; &#20107;&#23454;&#19978;&#65292;Python&#26377;&#25104;&#21313;&#19978;&#30334;&#30340; &#24320;&#25918;&#28304;&#30721;&#30340;&#27169;&#26495;&#35821;&#35328;&#23454;&#29616;&#12290; &#27599;&#20010;&#23454;&#29616;&#37117;&#26159;&#22240;&#20026;&#24320;&#21457;&#32773;&#35748;&#20026;&#29616;&#23384;&#30340;&#27169;&#26495;&#35821;&#35328;&#19981;&#22815;&#29992;&#12290;
&#65288;&#20107;&#23454;&#19978;&#65292;&#23545;&#19968;&#20010; Python&#24320;&#21457;&#32773;&#26469;&#35828;&#65292;&#20889;&#19968;&#20010;&#33258;&#24049;&#30340;&#27169;&#26495;&#35821;&#35328;&#23601;&#35937;&#26159;&#26576;&#31181;&#8220;&#25104;&#20154;&#31036;&#8221;&#19968;&#26679;&#65281; &#22914;&#26524;&#20320;&#36824;&#27809;&#26377;&#23436;&#25104;&#19968;&#20010;&#33258;&#24049;&#30340; &#27169;&#26495;&#35821;&#35328;&#65292;&#22909;&#22909;&#32771;&#34385;&#20889;&#19968;&#20010;&#65292;&#36825;&#26159;&#19968;&#20010;&#38750;&#24120;&#26377;&#36259;&#30340;&#38203;&#28860;&#12290; &#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn270&quot;&gt;&#26126;&#30333;&#20102;&#36825;&#20010;&#65292;&#20320;&#20063;&#35768;&#26377;&#20852;&#36259;&#30693;&#36947;&#20107;&#23454;&#19978;Django&#24182;&#19981;&#24378;&#21046;&#35201;&#27714;&#20320;&#24517;&#39035;&#20351;&#29992;&#23427;&#30340;&#27169;&#26495;&#35821;&#35328;&#12290; &#22240;&#20026;Django &#34429;&#28982;&#34987;&#35774;&#35745;&#25104;&#19968;&#20010;FULL-Stack&#30340;Web&#26694;&#26550;&#65292;&#23427;&#25552;&#20379;&#20102;&#24320;&#21457;&#32773;&#25152;&#24517;&#38656;&#30340;&#25152;&#26377;&#32452;&#20214;&#65292;&#32780;&#19988;&#22312;&#22823;&#22810;&#25968;&#24773;&#20917; &#20351;&#29992;Django&#27169;&#26495;&#31995;&#32479;&#20250;&#27604;&#20854;&#20182;&#30340;Python&#27169;&#26495;&#24211;&#35201; &lt;em&gt;&#26356;&#26041;&#20415;&lt;/em&gt; &#19968;&#28857;&#65292;&#20294;&#26159;&#24182;&#19981;&#26159;&#20005;&#26684;&#35201;&#27714;&#20320;&#24517;&#39035;&#20351;&#29992; &#23427;&#12290; &#20320;&#23558;&#22312;&#21518;&#32493;&#30340;&#8220;&#35270;&#22270;&#20013;&#24212;&#29992;&#27169;&#26495;&#8221;&#36825;&#19968;&#31456;&#33410;&#20013;&#30475;&#21040;&#65292;&#20320;&#36824;&#21487;&#20197;&#38750;&#24120;&#23481;&#26131;&#22320;&#22312;Django&#20013;&#20351;&#29992;&#20854;&#20182;&#30340;&#27169;&#26495;&#35821;&#35328;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn271&quot;&gt;&#34429;&#28982;&#22914;&#27492;&#65292;&#24456;&#26126;&#26174;&#65292;&#25105;&#20204;&#23545;Django&#27169;&#26495;&#35821;&#35328;&#30340;&#24037;&#20316;&#26041;&#24335;&#26377;&#30528;&#24378;&#28872;&#30340;&#20559;&#29233;&#12290; &#36825;&#20010;&#27169;&#26495;&#35821;&#35328;&#26469;&#28304;&#20110;World Online&#30340;&#24320;&#21457;&#32463;&#39564;&#21644;Django&#21019;&#36896;&#32773;&#20204;&#38598;&#20307;&#26234;&#24935;&#30340;&#32467;&#26230;&#12290; &#19979;&#38754;&#26159;&#20851;&#20110;&#23427;&#30340;&#19968;&#20123;&#35774;&#35745;&#21746;&#23398;&#29702;&#24565;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn272&quot;&gt;&lt;em&gt;&#19994;&#21153;&#36923;&#36753;&#24212;&#35813;&#21644;&#34920;&#29616;&#36923;&#36753;&#30456;&#23545;&#20998;&#24320;&lt;/em&gt; &#12290;&#25105;&#20204;&#23558;&#27169;&#26495;&#31995;&#32479;&#35270;&#20026;&#25511;&#21046;&#34920;&#29616;&#21450;&#34920;&#29616;&#30456;&#20851;&#36923;&#36753;&#30340;&#24037;&#20855;&#65292;&#20165;&#27492;&#32780;&#24050;&#12290; &#27169;&#26495;&#31995;&#32479;&#19981;&#24212;&#25552;&#20379;&#36229;&#20986;&#27492;&#22522;&#26412;&#30446;&#26631;&#30340;&#21151;&#33021;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn273&quot;&gt;&#20986;&#20110;&#36825;&#20010;&#21407;&#22240;&#65292;&#22312; Django &#27169;&#26495;&#20013;&#26159;&#19981;&#21487;&#33021;&#30452;&#25509;&#35843;&#29992; Python &#20195;&#30721;&#30340;&#12290; &#25152;&#26377;&#30340;&#32534;&#31243;&#24037;&#20316;&#22522;&#26412;&#19978;&#37117;&#34987;&#23616;&#38480;&#20110;&#27169;&#26495;&#26631;&#31614;&#30340;&#33021;&#21147;&#33539;&#22260;&#12290; &#24403;&#28982;&#65292; &lt;em&gt;&#26159;&lt;/em&gt; &#26377;&#21487;&#33021;&#20889;&#20986;&#33258;&#23450;&#20041;&#30340;&#27169;&#26495;&#26631;&#31614;&#26469;&#23436;&#25104;&#20219;&#24847;&#24037;&#20316;&#65292;&#20294;&#36825;&#20123;&#8220;&#36229;&#33539;&#22260;&#8221;&#30340; Django &#27169;&#26495;&#26631;&#31614;&#26377;&#24847;&#22320;&#19981;&#20801;&#35768;&#25191;&#34892;&#20219;&#20309; Python &#20195;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn274&quot;&gt;&lt;em&gt;&#35821;&#27861;&#19981;&#24212;&#21463;&#21040; HTML/XML &#30340;&#26463;&#32538;&lt;/em&gt; &#12290;&#23613;&#31649; Django &#27169;&#26495;&#31995;&#32479;&#20027;&#35201;&#29992;&#20110;&#29983;&#25104; HTML&#65292;&#23427;&#36824;&#26159;&#34987;&#26377;&#24847;&#22320;&#35774;&#35745;&#20026;&#21487;&#29983;&#25104;&#38750; HTML &#26684;&#24335;&#65292;&#22914;&#32431;&#25991;&#26412;&#12290; &#19968;&#20123;&#20854;&#23427;&#30340;&#27169;&#26495;&#35821;&#35328;&#26159;&#22522;&#20110; XML &#30340;&#65292;&#23558;&#25152;&#26377;&#30340;&#27169;&#26495;&#36923;&#36753;&#32622;&#20110; XML &#26631;&#31614;&#19982;&#23646;&#24615;&#20043;&#20013;&#65292;&#32780; Django &#26377;&#24847;&#22320;&#36991;&#24320;&#20102;&#36825;&#31181;&#38480;&#21046;&#12290; &#24378;&#21046;&#35201;&#27714;&#20351;&#29992;&#26377;&#25928; XML &#32534;&#20889;&#27169;&#26495;&#23558;&#20250;&#24341;&#21457;&#22823;&#37327;&#30340;&#20154;&#20026;&#38169;&#35823;&#21644;&#38590;&#20197;&#29702;&#35299;&#30340;&#38169;&#35823;&#20449;&#24687;&#65292;&#32780;&#19988;&#20351;&#29992; XML &#24341;&#25806;&#35299;&#26512;&#27169;&#26495;&#20063;&#20250;&#23548;&#33268;&#20196;&#20154;&#26080;&#27861;&#23481;&#24525;&#30340;&#27169;&#26495;&#22788;&#29702;&#24320;&#38144;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn275&quot;&gt;&lt;em&gt;&#20551;&#23450;&#35774;&#35745;&#24072;&#31934;&#36890; HTML &#32534;&#30721;&lt;/em&gt; &#12290;&#27169;&#26495;&#31995;&#32479;&#30340;&#35774;&#35745;&#24847;&#22270;&#24182;&#19981;&#26159;&#20026;&#20102;&#35753;&#27169;&#26495;&#19968;&#23450;&#33021;&#22815;&#24456;&#22909;&#22320;&#26174;&#31034;&#22312; Dreamweaver &#36825;&#26679;&#30340;&#25152;&#35265;&#21363;&#25152;&#24471;&#32534;&#36753;&#22120;&#20013;&#12290; &#36825;&#31181;&#38480;&#21046;&#36807;&#20110;&#33499;&#21051;&#65292;&#32780;&#19988;&#20250;&#20351;&#24471;&#35821;&#27861;&#19981;&#33021;&#20687;&#30446;&#21069;&#36825;&#26679;&#30340;&#23436;&#32654;&#12290; Django &#35201;&#27714;&#27169;&#26495;&#21019;&#20316;&#20154;&#21592;&#23545;&#30452;&#25509;&#32534;&#36753; HTML &#38750;&#24120;&#29087;&#24713;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn276&quot;&gt;&lt;em&gt;&#20551;&#23450;&#35774;&#35745;&#24072;&#19981;&#26159; Python &#31243;&#24207;&#21592;&lt;/em&gt; &#12290;&#27169;&#26495;&#31995;&#32479;&#24320;&#21457;&#20154;&#21592;&#35748;&#20026;&#65306;&#27169;&#26495;&#36890;&#24120;&#30001;&#35774;&#35745;&#24072;&#32780;&#38750;&#31243;&#24207;&#21592;&#26469;&#32534;&#20889;&#65292;&#22240;&#27492;&#19981;&#24212;&#34987;&#20551;&#23450;&#25317;&#26377;Python&#24320;&#21457;&#30693;&#35782;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn277&quot;&gt;&#24403;&#28982;&#65292;&#31995;&#32479;&#21516;&#26679;&#20063;&#29305;&#24847;&#22320;&#25552;&#20379;&#20102;&#23545;&#37027;&#20123; &lt;em&gt;&#30001;&lt;/em&gt; Python &#31243;&#24207;&#21592;&#36827;&#34892;&#27169;&#26495;&#21046;&#20316;&#30340;&#23567;&#22411;&#22242;&#38431;&#30340;&#25903;&#25345;&#12290; &#23427;&#25552;&#20379;&#20102;&#19968;&#31181;&#24037;&#20316;&#27169;&#24335;&#65292;&#20801;&#35768;&#36890;&#36807;&#32534;&#20889;&#21407;&#29983; Python &#20195;&#30721;&#36827;&#34892;&#31995;&#32479;&#35821;&#27861;&#25299;&#23637;&#12290; &#65288;&#35814;&#35265;&#31532;&#21313;&#31456;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn278&quot;&gt;&lt;em&gt;&#30446;&#26631;&#24182;&#19981;&#26159;&#35201;&#21457;&#26126;&#19968;&#31181;&#32534;&#31243;&#35821;&#35328;&lt;/em&gt; &#12290;&#30446;&#26631;&#26159;&#24688;&#21040;&#22909;&#22788;&#22320;&#25552;&#20379;&#22914;&#20998;&#25903;&#21644;&#24490;&#29615;&#36825;&#19968;&#31867;&#32534;&#31243;&#24335;&#21151;&#33021;&#65292;&#36825;&#26159;&#36827;&#34892;&#19982;&#34920;&#29616;&#30456;&#20851;&#21028;&#26029;&#30340;&#22522;&#30784;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id17&quot;&gt;
&lt;span id=&quot;cn279&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn279&quot;&gt;&#22312;&#35270;&#22270;&#20013;&#20351;&#29992;&#27169;&#26495;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn280&quot;&gt;&#22312;&#23398;&#20064;&#20102;&#27169;&#26495;&#31995;&#32479;&#30340;&#22522;&#30784;&#20043;&#21518;&#65292;&#29616;&#22312;&#35753;&#25105;&#20204;&#20351;&#29992;&#30456;&#20851;&#30693;&#35782;&#26469;&#21019;&#24314;&#35270;&#22270;&#12290; &#37325;&#26032;&#25171;&#24320;&#25105;&#20204;&#22312;&#21069;&#19968;&#31456;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.views&lt;/span&gt;&lt;/tt&gt; &#20013;&#21019;&#24314;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#12290; &#20197;&#19979;&#26159;&#20854;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn282&quot;&gt;from django.http import HttpResponse
import datetime

def current_datetime(request):
    now = datetime.datetime.now()
    html = &quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;It is now %s.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot; % now
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn283&quot;&gt;&#35753;&#25105;&#20204;&#29992; Django &#27169;&#26495;&#31995;&#32479;&#26469;&#20462;&#25913;&#35813;&#35270;&#22270;&#12290; &#31532;&#19968;&#27493;&#65292;&#20320;&#21487;&#33021;&#24050;&#32463;&#24819;&#21040;&#20102;&#35201;&#20570;&#19979;&#38754;&#36825;&#26679;&#30340;&#20462;&#25913;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn285&quot;&gt;from django.template import Template, Context
from django.http import HttpResponse
import datetime

def current_datetime(request):
    now = datetime.datetime.now()
    t = Template(&quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;It is now {{ current_date }}.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot;)
    html = t.render(Context({&apos;current_date&apos;: now}))
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn286&quot;&gt;&#27809;&#38169;&#65292;&#23427;&#30830;&#23454;&#20351;&#29992;&#20102;&#27169;&#26495;&#31995;&#32479;&#65292;&#20294;&#26159;&#24182;&#27809;&#26377;&#35299;&#20915;&#25105;&#20204;&#22312;&#26412;&#31456;&#24320;&#22836;&#25152;&#25351;&#20986;&#30340;&#38382;&#39064;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;&#27169;&#26495;&#20173;&#28982;&#23884;&#20837;&#22312;Python&#20195;&#30721;&#37324;&#65292;&#24182;&#26410;&#30495;&#27491;&#30340;&#23454;&#29616;&#25968;&#25454;&#19982;&#34920;&#29616;&#30340;&#20998;&#31163;&#12290; &#35753;&#25105;&#20204;&#23558;&#27169;&#26495;&#32622;&#20110;&#19968;&#20010; &lt;em&gt;&#21333;&#29420;&#30340;&#25991;&#20214;&lt;/em&gt; &#20013;&#65292;&#24182;&#19988;&#35753;&#35270;&#22270;&#21152;&#36733;&#35813;&#25991;&#20214;&#26469;&#35299;&#20915;&#27492;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn287&quot;&gt;&#20320;&#21487;&#33021;&#39318;&#20808;&#32771;&#34385;&#25226;&#27169;&#26495;&#20445;&#23384;&#22312;&#25991;&#20214;&#31995;&#32479;&#30340;&#26576;&#20010;&#20301;&#32622;&#24182;&#29992; Python &#20869;&#24314;&#30340;&#25991;&#20214;&#25805;&#20316;&#20989;&#25968;&#26469;&#35835;&#21462;&#25991;&#20214;&#20869;&#23481;&#12290;
&#20551;&#35774;&#25991;&#20214;&#20445;&#23384;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/home/djangouser/templates/mytemplate.html&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#35805;&#65292;&#20195;&#30721;&#23601;&#20250;&#20687;&#19979;&#38754;&#36825;&#26679;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn289&quot;&gt;from django.template import Template, Context
from django.http import HttpResponse
import datetime

def current_datetime(request):
    now = datetime.datetime.now()
    # Simple way of using templates from the filesystem.
    # This is BAD because it doesn&apos;t account for missing files!
    fp = open(&apos;/home/djangouser/templates/mytemplate.html&apos;)
    t = Template(fp.read())
    fp.close()
    html = t.render(Context({&apos;current_date&apos;: now}))
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn290&quot;&gt;&#28982;&#32780;&#65292;&#22522;&#20110;&#20197;&#19979;&#20960;&#20010;&#21407;&#22240;&#65292;&#35813;&#26041;&#27861;&#36824;&#31639;&#19981;&#19978;&#31616;&#27905;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn291&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn291&quot;&gt;&#23427;&#27809;&#26377;&#23545;&#25991;&#20214;&#20002;&#22833;&#30340;&#24773;&#20917;&#20570;&#20986;&#22788;&#29702;&#12290; &#22914;&#26524;&#25991;&#20214; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mytemplate.html&lt;/span&gt;&lt;/tt&gt; &#19981;&#23384;&#22312;&#25110;&#32773;&#19981;&#21487;&#35835;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;open()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#35843;&#29992;&#23558;&#20250;&#24341;&#21457; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;IOError&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn292&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn292&quot;&gt;&#36825;&#37324;&#23545;&#27169;&#26495;&#25991;&#20214;&#30340;&#20301;&#32622;&#36827;&#34892;&#20102;&#30828;&#32534;&#30721;&#12290; &#22914;&#26524;&#20320;&#22312;&#27599;&#20010;&#35270;&#22270;&#20989;&#25968;&#37117;&#29992;&#35813;&#25216;&#26415;&#65292;&#23601;&#35201;&#19981;&#26029;&#22797;&#21046;&#36825;&#20123;&#27169;&#26495;&#30340;&#20301;&#32622;&#12290; &#26356;&#19981;&#29992;&#35828;&#36824;&#35201;&#24102;&#26469;&#22823;&#37327;&#30340;&#36755;&#20837;&#24037;&#20316;&#65281;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn293&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn293&quot;&gt;&#23427;&#21253;&#21547;&#20102;&#22823;&#37327;&#20196;&#20154;&#29983;&#21388;&#30340;&#37325;&#22797;&#20195;&#30721;&#12290; &#19982;&#20854;&#22312;&#27599;&#27425;&#21152;&#36733;&#27169;&#26495;&#26102;&#37117;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;open()&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;fp.read()&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;fp.close()&lt;/span&gt;&lt;/tt&gt; &#65292;&#36824;&#19981;&#22914;&#20570;&#20986;&#26356;&#20339;&#36873;&#25321;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn294&quot;&gt;&#20026;&#20102;&#35299;&#20915;&#36825;&#20123;&#38382;&#39064;&#65292;&#25105;&#20204;&#37319;&#29992;&#20102; &lt;em&gt;&#27169;&#26495;&#33258;&#21152;&#36733;&lt;/em&gt; &#36319; &lt;em&gt;&#27169;&#26495;&#30446;&#24405;&lt;/em&gt; &#30340;&#25216;&#24039;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id18&quot;&gt;
&lt;span id=&quot;cn295&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn295&quot;&gt;&#27169;&#26495;&#21152;&#36733;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn296&quot;&gt;&#20026;&#20102;&#20943;&#23569;&#27169;&#26495;&#21152;&#36733;&#35843;&#29992;&#36807;&#31243;&#21450;&#27169;&#26495;&#26412;&#36523;&#30340;&#20887;&#20313;&#20195;&#30721;&#65292;Django &#25552;&#20379;&#20102;&#19968;&#31181;&#20351;&#29992;&#26041;&#20415;&#19988;&#21151;&#33021;&#24378;&#22823;&#30340; API &#65292;&#29992;&#20110;&#20174;&#30913;&#30424;&#20013;&#21152;&#36733;&#27169;&#26495;&#65292;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn297&quot;&gt;&#35201;&#20351;&#29992;&#27492;&#27169;&#26495;&#21152;&#36733;API&#65292;&#39318;&#20808;&#20320;&#24517;&#39035;&#23558;&#27169;&#26495;&#30340;&#20445;&#23384;&#20301;&#32622;&#21578;&#35785;&#26694;&#26550;&#12290; &#35774;&#32622;&#30340;&#20445;&#23384;&#25991;&#20214;&#23601;&#26159;&#25105;&#20204;&#21069;&#19968;&#31456;&#33410;&#35762;&#36848;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ROOT_URLCONF&lt;/span&gt;&lt;/tt&gt;&#37197;&#32622;&#30340;&#26102;&#20505;&#25552;&#21040;&#30340;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;settings.py&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn298&quot;&gt;&#22914;&#26524;&#20320;&#26159;&#19968;&#27493;&#27493;&#36319;&#38543;&#25105;&#20204;&#23398;&#20064;&#36807;&#26469;&#30340;&#65292;&#39532;&#19978;&#25171;&#24320;&#20320;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;settings.py&lt;/span&gt;&lt;/tt&gt;&#37197;&#32622;&#25991;&#20214;&#65292;&#25214;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt;&#36825;&#39033;&#35774;&#32622;&#21543;&#12290; &#23427;&#30340;&#40664;&#35748;&#35774;&#32622;&#26159;&#19968;&#20010;&#31354;&#20803;&#32452;&#65288;tuple&#65289;&#65292;&#21152;&#19978;&#19968;&#20123;&#33258;&#21160;&#29983;&#25104;&#30340;&#27880;&#37322;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn300&quot;&gt;TEMPLATE_DIRS = (
    # Put strings here, like &quot;/home/html/django_templates&quot; or &quot;C:/www/django/templates&quot;.
    # Always use forward slashes, even on Windows.
    # Don&apos;t forget to use absolute paths, not relative paths.
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn301&quot;&gt;&#35813;&#35774;&#32622;&#21578;&#35785; Django &#30340;&#27169;&#26495;&#21152;&#36733;&#26426;&#21046;&#22312;&#21738;&#37324;&#26597;&#25214;&#27169;&#26495;&#12290; &#36873;&#25321;&#19968;&#20010;&#30446;&#24405;&#29992;&#20110;&#23384;&#25918;&#27169;&#26495;&#24182;&#23558;&#20854;&#28155;&#21152;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#20013;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn303&quot;&gt;TEMPLATE_DIRS = (
    &apos;/home/django/mysite/templates&apos;,
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn304&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20123;&#27880;&#24847;&#20107;&#39033;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn305&quot;&gt;&#20320;&#21487;&#20197;&#20219;&#24847;&#25351;&#23450;&#24819;&#35201;&#30340;&#30446;&#24405;&#65292;&#21482;&#35201;&#36816;&#34892; Web &#26381;&#21153;&#22120;&#30340;&#29992;&#25143;&#21487;&#20197;&#35835;&#21462;&#35813;&#30446;&#24405;&#30340;&#23376;&#30446;&#24405;&#21644;&#27169;&#26495;&#25991;&#20214;&#12290; &#22914;&#26524;&#23454;&#22312;&#24819;&#19981;&#20986;&#21512;&#36866;&#30340;&#20301;&#32622;&#26469;&#25918;&#32622;&#27169;&#26495;&#65292;&#25105;&#20204;&#24314;&#35758;&#22312; Django &#39033;&#30446;&#20013;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;templates&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#65288;&#20063;&#23601;&#26159;&#35828;&#65292;&#22914;&#26524;&#20320;&#19968;&#30452;&#37117;&#25353;&#26412;&#20070;&#30340;&#33539;&#20363;&#25805;&#20316;&#30340;&#35805;&#65292;&#22312;&#31532;&#20108;&#31456;&#21019;&#24314;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#20013;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn306&quot;&gt;&#22914;&#26524;&#20320;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt;&#21482;&#21253;&#21547;&#19968;&#20010;&#30446;&#24405;&#65292;&#21035;&#24536;&#20102;&#22312;&#35813;&#30446;&#24405;&#21518;&#21152;&#19978;&#20010;&#36887;&#21495;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn307&quot;&gt;Bad:&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn309&quot;&gt;# Missing comma!
TEMPLATE_DIRS = (
    &apos;/home/django/mysite/templates&apos;
)
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn310&quot;&gt;Good:&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn312&quot;&gt;# Comma correctly in place.
TEMPLATE_DIRS = (
    &apos;/home/django/mysite/templates&apos;,
)
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn313&quot;&gt;Python &#35201;&#27714;&#21333;&#20803;&#32032;&#20803;&#32452;&#20013;&#24517;&#39035;&#20351;&#29992;&#36887;&#21495;&#65292;&#20197;&#27492;&#28040;&#38500;&#19982;&#22278;&#25324;&#21495;&#34920;&#36798;&#24335;&#20043;&#38388;&#30340;&#27495;&#20041;&#12290; &#36825;&#26159;&#26032;&#25163;&#24120;&#29359;&#30340;&#38169;&#35823;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn314&quot;&gt;&#22914;&#26524;&#20351;&#29992;&#30340;&#26159; Windows &#24179;&#21488;&#65292;&#35831;&#21253;&#21547;&#39537;&#21160;&#22120;&#31526;&#21495;&#24182;&#20351;&#29992;Unix&#39118;&#26684;&#30340;&#26012;&#26464;&#65288;/&#65289;&#32780;&#19981;&#26159;&#21453;&#26012;&#26464;&#65288;&#65289;,&#23601;&#20687;&#19979;&#38754;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn316&quot;&gt;TEMPLATE_DIRS = (
    &apos;C:/www/django/templates&apos;,
)
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn317&quot;&gt;&#26368;&#30465;&#20107;&#30340;&#26041;&#24335;&#26159;&#20351;&#29992;&#32477;&#23545;&#36335;&#24452;&#65288;&#21363;&#20174;&#25991;&#20214;&#31995;&#32479;&#26681;&#30446;&#24405;&#24320;&#22987;&#30340;&#30446;&#24405;&#36335;&#24452;&#65289;&#12290; &#22914;&#26524;&#24819;&#35201;&#26356;&#28789;&#27963;&#19968;&#28857;&#24182;&#20943;&#23569;&#19968;&#20123;&#36127;&#38754;&#24178;&#25200;&#65292;&#21487;&#21033;&#29992; Django &#37197;&#32622;&#25991;&#20214;&#23601;&#26159; Python &#20195;&#30721;&#36825;&#19968;&#28857;&#26469;&#21160;&#24577;&#26500;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#30340;&#20869;&#23481;&#65292;&#22914;&#65306; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn319&quot;&gt;import os.path

TEMPLATE_DIRS = (
    os.path.join(os.path.dirname(__file__), &apos;templates&apos;).replace(&apos;\\&apos;,&apos;/&apos;),
)
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn320&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#20351;&#29992;&#20102;&#31070;&#22855;&#30340; Python &#20869;&#37096;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__file__&lt;/span&gt;&lt;/tt&gt; &#65292;&#35813;&#21464;&#37327;&#34987;&#33258;&#21160;&#35774;&#32622;&#20026;&#20195;&#30721;&#25152;&#22312;&#30340; Python &#27169;&#22359;&#25991;&#20214;&#21517;&#12290; `` os.path.dirname(__file__)`` &#23558;&#20250;&#33719;&#21462;&#33258;&#36523;&#25152;&#22312;&#30340;&#25991;&#20214;&#65292;&#21363;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;settings.py&lt;/span&gt;&lt;/tt&gt; &#25152;&#22312;&#30340;&#30446;&#24405;&#65292;&#28982;&#21518;&#30001;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;os.path.join&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#26041;&#27861;&#23558;&#36825;&#30446;&#24405;&#19982; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;templates&lt;/span&gt;&lt;/tt&gt; &#36827;&#34892;&#36830;&#25509;&#12290;&#22914;&#26524;&#22312;windows&#19979;&#65292;&#23427;&#20250;&#26234;&#33021;&#22320;&#36873;&#25321;&#27491;&#30830;&#30340;&#21518;&#21521;&#26012;&#26464;&#8221;&#8220;&#36827;&#34892;&#36830;&#25509;&#65292;&#32780;&#19981;&#26159;&#21069;&#21521;&#26012;&#26464;&#8221;/&#8221;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn321&quot;&gt;&#22312;&#36825;&#37324;&#25105;&#20204;&#38754;&#23545;&#30340;&#26159;&#21160;&#24577;&#35821;&#35328;python&#20195;&#30721;&#65292;&#25105;&#38656;&#35201;&#25552;&#37266;&#20320;&#30340;&#26159;&#65292;&#19981;&#35201;&#22312;&#20320;&#30340;&#35774;&#32622;&#25991;&#20214;&#37324;&#20889;&#20837;&#38169;&#35823;&#30340;&#20195;&#30721;&#65292;&#36825;&#24456;&#37325;&#35201;&#12290; &#22914;&#26524;&#20320;&#22312;&#36825;&#37324;&#24341;&#20837;&#20102;&#35821;&#27861;&#38169;&#35823;&#65292;&#25110;&#36816;&#34892;&#38169;&#35823;&#65292;&#20320;&#30340;Django-powered&#31449;&#28857;&#23558;&#24456;&#21487;&#33021;&#23601;&#35201;&#34987;&#23849;&#28291;&#25481;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn322&quot;&gt;&#23436;&#25104; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#21518;&#65292;&#19979;&#19968;&#27493;&#23601;&#26159;&#20462;&#25913;&#35270;&#22270;&#20195;&#30721;&#65292;&#35753;&#23427;&#20351;&#29992; Django &#27169;&#26495;&#21152;&#36733;&#21151;&#33021;&#32780;&#19981;&#26159;&#23545;&#27169;&#26495;&#36335;&#24452;&#30828;&#32534;&#30721;&#12290; &#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#65292;&#36827;&#34892;&#22914;&#19979;&#20462;&#25913;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn324&quot;&gt;from django.template.loader import get_template
from django.template import Context
from django.http import HttpResponse
import datetime

def current_datetime(request):
    now = datetime.datetime.now()
    t = get_template(&apos;current_datetime.html&apos;)
    html = t.render(Context({&apos;current_date&apos;: now}))
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn325&quot;&gt;&#27492;&#33539;&#20363;&#20013;&#65292;&#25105;&#20204;&#20351;&#29992;&#20102;&#20989;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.loader.get_template()&lt;/span&gt;&lt;/tt&gt; &#65292;&#32780;&#19981;&#26159;&#25163;&#21160;&#20174;&#25991;&#20214;&#31995;&#32479;&#21152;&#36733;&#27169;&#26495;&#12290; &#35813; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#20197;&#27169;&#26495;&#21517;&#31216;&#20026;&#21442;&#25968;&#65292;&#22312;&#25991;&#20214;&#31995;&#32479;&#20013;&#25214;&#20986;&#27169;&#22359;&#30340;&#20301;&#32622;&#65292;&#25171;&#24320;&#25991;&#20214;&#24182;&#36820;&#22238;&#19968;&#20010;&#32534;&#35793;&#22909;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn326&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#37324;&#65292;&#25105;&#20204;&#36873;&#25321;&#30340;&#27169;&#26495;&#25991;&#20214;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime.html&lt;/span&gt;&lt;/tt&gt;&#65292;&#20294;&#36825;&#20010;&#19982;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.html&lt;/span&gt;&lt;/tt&gt;&#21518;&#32512;&#27809;&#26377;&#30452;&#25509;&#30340;&#32852;&#31995;&#12290; &#20320;&#21487;&#20197;&#36873;&#25321;&#20219;&#24847;&#21518;&#32512;&#30340;&#20219;&#24847;&#25991;&#20214;&#65292;&#21482;&#35201;&#26159;&#31526;&#21512;&#36923;&#36753;&#30340;&#37117;&#34892;&#12290;&#29978;&#33267;&#36873;&#25321;&#27809;&#26377;&#21518;&#32512;&#30340;&#25991;&#20214;&#20063;&#19981;&#20250;&#26377;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn327&quot;&gt;&#35201;&#30830;&#23450;&#26576;&#20010;&#27169;&#26495;&#25991;&#20214;&#22312;&#20320;&#30340;&#31995;&#32479;&#37324;&#30340;&#20301;&#32622;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#20250;&#33258;&#21160;&#20026;&#20320;&#36830;&#25509;&#24050;&#32463;&#35774;&#32622;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt;&#30446;&#24405;&#21644;&#20320;&#20256;&#20837;&#35813;&#27861;&#30340;&#27169;&#26495;&#21517;&#31216;&#21442;&#25968;&#12290;&#27604;&#22914;&#65292;&#20320;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt;&#30446;&#24405;&#35774;&#32622;&#20026;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;/home/django/mysite/templates&apos;&lt;/span&gt;&lt;/tt&gt;&#65292;&#19978;&#38754;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt;&#35843;&#29992;&#23601;&#20250;&#20026;&#20320;&#25214;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/home/django/mysite/templates/current_datetime.html&lt;/span&gt;&lt;/tt&gt; &#36825;&#26679;&#19968;&#20010;&#20301;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn328&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt; &#25214;&#19981;&#21040;&#32473;&#23450;&#21517;&#31216;&#30340;&#27169;&#26495;&#65292;&#23558;&#20250;&#24341;&#21457;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TemplateDoesNotExist&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#12290; &#35201;&#20102;&#35299;&#31350;&#31455;&#20250;&#21457;&#29983;&#20160;&#20040;&#65292;&#35753;&#25105;&#20204;&#25353;&#29031;&#31532;&#19977;&#31456;&#20869;&#23481;&#65292;&#22312; Django &#39033;&#30446;&#30446;&#24405;&#20013;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;runserver&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#65292;&#20877;&#27425;&#21551;&#21160;Django&#24320;&#21457;&#26381;&#21153;&#22120;&#12290; &#25509;&#30528;&#65292;&#21578;&#35785;&#20320;&#30340;&#27983;&#35272;&#22120;&#65292;&#20351;&#20854;&#23450;&#20301;&#21040;&#25351;&#23450;&#39029;&#38754;&#20197;&#28608;&#27963;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime&lt;/span&gt;&lt;/tt&gt;&#35270;&#22270;&#65288;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/time/&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290;&#20551;&#35774;&#20320;&#30340;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt;&#39033;&#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt;&#65292;&#32780;&#20320;&#26377;&#27809;&#26377;&#24314;&#31435;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime.html&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#27169;&#26495;&#25991;&#20214;&#65292;&#20320;&#20250;&#30475;&#21040;Django&#30340;&#38169;&#35823;&#25552;&#31034;&#32593;&#39029;&#65292;&#21578;&#35785;&#20320;&#21457;&#29983;&#20102;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TemplateDoesNotExist&lt;/span&gt;&lt;/tt&gt; &#38169;&#35823;&#12290;&lt;/p&gt;
&lt;img alt=&quot;Screenshot of a TemplateDoesNotExist error.&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter04/missing_template.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn307&quot;&gt;&#22270; 4-1: &#27169;&#26495;&#25991;&#20214;&#26080;&#27861;&#25214;&#21040;&#26102;&#65292;&#23558;&#20250;&#21457;&#36865;&#25552;&#31034;&#38169;&#35823;&#30340;&#32593;&#39029;&#32473;&#29992;&#25143;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn331&quot;&gt;&#35813;&#39029;&#38754;&#19982;&#25105;&#20204;&#22312;&#31532;&#19977;&#31456;&#35299;&#37322;&#36807;&#30340;&#38169;&#35823;&#39029;&#38754;&#30456;&#20284;&#65292;&#21482;&#19981;&#36807;&#22810;&#20102;&#19968;&#22359;&#35843;&#35797;&#20449;&#24687;&#21306;&#65306; &#27169;&#26495;&#21152;&#36733;&#22120;&#20107;&#21518;&#26816;&#26597;&#21306;&#12290; &#35813;&#21306;&#22495;&#26174;&#31034; Django &#35201;&#21152;&#36733;&#21738;&#20010;&#27169;&#26495;&#12289;&#27599;&#27425;&#23581;&#35797;&#20986;&#38169;&#30340;&#21407;&#22240;&#65288;&#22914;&#65306;&#25991;&#20214;&#19981;&#23384;&#22312;&#31561;&#65289;&#12290; &#24403;&#20320;&#23581;&#35797;&#35843;&#35797;&#27169;&#26495;&#21152;&#36733;&#38169;&#35823;&#26102;&#65292;&#36825;&#20123;&#20449;&#24687;&#20250;&#38750;&#24120;&#26377;&#24110;&#21161;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn332&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#22312;&#27169;&#26495;&#30446;&#24405;&#20013;&#21019;&#24314;&#21253;&#25324;&#20197;&#19979;&#27169;&#26495;&#20195;&#30721; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime.html&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn334&quot;&gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;It is now {{ current_date }}.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn335&quot;&gt;&#22312;&#32593;&#39029;&#27983;&#35272;&#22120;&#20013;&#21047;&#26032;&#35813;&#39029;&#65292;&#20320;&#23558;&#20250;&#30475;&#21040;&#23436;&#25972;&#35299;&#26512;&#21518;&#30340;&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;render-to-response&quot;&gt;
&lt;span id=&quot;cn336&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn336&quot;&gt;render_to_response()&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn337&quot;&gt;&#25105;&#20204;&#24050;&#32463;&#21578;&#35785;&#20320;&#22914;&#20309;&#36733;&#20837;&#19968;&#20010;&#27169;&#26495;&#25991;&#20214;&#65292;&#28982;&#21518;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt;&#28210;&#26579;&#23427;&#65292;&#26368;&#21518;&#36820;&#22238;&#36825;&#20010;&#22788;&#29702;&#22909;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#32473;&#29992;&#25143;&#12290; &#25105;&#20204;&#24050;&#32463;&#20248;&#21270;&#20102;&#26041;&#26696;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#20195;&#26367;&#32321;&#26434;&#30340;&#29992;&#20195;&#30721;&#26469;&#22788;&#29702;&#27169;&#26495;&#21450;&#20854;&#36335;&#24452;&#30340;&#24037;&#20316;&#12290; &#20294;&#36825;&#20173;&#28982;&#38656;&#35201;&#19968;&#23450;&#37327;&#30340;&#26102;&#38388;&#26469;&#25970;&#20986;&#36825;&#20123;&#31616;&#21270;&#30340;&#20195;&#30721;&#12290; &#36825;&#26159;&#19968;&#20010;&#26222;&#36941;&#23384;&#22312;&#30340;&#37325;&#22797;&#33510;&#21147;&#21171;&#21160;&#12290;Django&#20026;&#27492;&#25552;&#20379;&#20102;&#19968;&#20010;&#25463;&#24452;&#65292;&#35753;&#20320;&#19968;&#27425;&#24615;&#22320;&#36733;&#20837;&#26576;&#20010;&#27169;&#26495;&#25991;&#20214;&#65292;&#28210;&#26579;&#23427;&#65292;&#28982;&#21518;&#23558;&#27492;&#20316;&#20026;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt;&#36820;&#22238;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn338&quot;&gt;&#35813;&#25463;&#24452;&#23601;&#26159;&#20301;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.shortcuts&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#20013;&#21517;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#30340;&#20989;&#25968;&#12290;&#22823;&#22810;&#25968;&#24773;&#20917;&#19979;&#65292;&#20320;&#20250;&#20351;&#29992;&lt;a href=&quot;#id19&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id20&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;``&lt;/span&gt;&lt;/tt&gt;&lt;a href=&quot;#id21&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id22&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;#id23&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id24&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&#23545;&#35937;&#65292;&#38500;&#38750;&#20320;&#30340;&#32769;&#26495;&#20197;&#20195;&#30721;&#34892;&#25968;&#26469;&#34913;&#37327;&#20320;&#30340;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id19&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 1736); &lt;em&gt;&lt;a href=&quot;#id20&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn338&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id21&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 1736); &lt;em&gt;&lt;a href=&quot;#id22&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn338&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id23&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 1736); &lt;em&gt;&lt;a href=&quot;#id24&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn338&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn339&quot;&gt;&#19979;&#38754;&#23601;&#26159;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#37325;&#26032;&#32534;&#20889;&#36807;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime&lt;/span&gt;&lt;/tt&gt; &#33539;&#20363;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn341&quot;&gt;from django.shortcuts import render_to_response
import datetime

def current_datetime(request):
    now = datetime.datetime.now()
    return render_to_response(&apos;current_datetime.html&apos;, {&apos;current_date&apos;: now})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn342&quot;&gt;&#22823;&#21464;&#26679;&#20102;&#65281; &#35753;&#25105;&#20204;&#36880;&#21477;&#30475;&#30475;&#20195;&#30721;&#21457;&#29983;&#30340;&#21464;&#21270;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn343&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn343&quot;&gt;&#25105;&#20204;&#19981;&#20877;&#38656;&#35201;&#23548;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#12290;&#30456;&#21453;&#65292;&#25105;&#20204;&#23548;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.shortcuts.render_to_response&lt;/span&gt;&lt;/tt&gt; &#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;datetime&lt;/span&gt;&lt;/tt&gt; &#32487;&#32493;&#20445;&#30041;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn344&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn344&quot;&gt;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#20013;&#65292;&#25105;&#20204;&#20173;&#28982;&#36827;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;now&lt;/span&gt;&lt;/tt&gt; &#35745;&#31639;&#65292;&#20294;&#27169;&#26495;&#21152;&#36733;&#12289;&#19978;&#19979;&#25991;&#21019;&#24314;&#12289;&#27169;&#26495;&#35299;&#26512;&#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#21019;&#24314;&#24037;&#20316;&#22343;&#22312;&#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#30340;&#35843;&#29992;&#20013;&#23436;&#25104;&#20102;&#12290; &#30001;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#22240;&#27492;&#25105;&#20204;&#20165;&#38656;&#22312;&#35270;&#22270;&#20013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;return&lt;/span&gt;&lt;/tt&gt; &#35813;&#20540;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn345&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#24517;&#39035;&#26159;&#35201;&#20351;&#29992;&#30340;&#27169;&#26495;&#21517;&#31216;&#12290; &#22914;&#26524;&#35201;&#32473;&#23450;&#31532;&#20108;&#20010;&#21442;&#25968;&#65292;&#37027;&#20040;&#35813;&#21442;&#25968;&#24517;&#39035;&#26159;&#20026;&#35813;&#27169;&#26495;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#26102;&#25152;&#20351;&#29992;&#30340;&#23383;&#20856;&#12290; &#22914;&#26524;&#19981;&#25552;&#20379;&#31532;&#20108;&#20010;&#21442;&#25968;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#20351;&#29992;&#19968;&#20010;&#31354;&#23383;&#20856;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;locals&quot;&gt;
&lt;span id=&quot;cn346&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn346&quot;&gt;locals() &#25216;&#24039;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn347&quot;&gt;&#24605;&#32771;&#19968;&#19979;&#25105;&#20204;&#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime&lt;/span&gt;&lt;/tt&gt; &#30340;&#26368;&#21518;&#19968;&#27425;&#36171;&#20540;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn349&quot;&gt;def current_datetime(request):
    now = datetime.datetime.now()
    return render_to_response(&apos;current_datetime.html&apos;, {&apos;current_date&apos;: now})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn350&quot;&gt;&#24456;&#22810;&#26102;&#20505;&#65292;&#23601;&#20687;&#22312;&#36825;&#20010;&#33539;&#20363;&#20013;&#37027;&#26679;&#65292;&#20320;&#21457;&#29616;&#33258;&#24049;&#19968;&#30452;&#22312;&#35745;&#31639;&#26576;&#20010;&#21464;&#37327;&#65292;&#20445;&#23384;&#32467;&#26524;&#21040;&#21464;&#37327;&#20013;&#65288;&#27604;&#22914;&#21069;&#38754;&#20195;&#30721;&#20013;&#30340; now &#65289;&#65292;&#28982;&#21518;&#23558;&#36825;&#20123;&#21464;&#37327;&#21457;&#36865;&#32473;&#27169;&#26495;&#12290; &#23588;&#20854;&#21916;&#27426;&#20599;&#25042;&#30340;&#31243;&#24207;&#21592;&#24212;&#35813;&#27880;&#24847;&#21040;&#20102;&#65292;&#19981;&#26029;&#22320;&#20026;&#20020;&#26102;&#21464;&#37327;&lt;em&gt;&#21644;&lt;/em&gt;&#20020;&#26102;&#27169;&#26495;&#21629;&#21517;&#26377;&#37027;&#20040;&#19968;&#28857;&#28857;&#22810;&#20313;&#12290;
&#19981;&#20165;&#22810;&#20313;&#65292;&#32780;&#19988;&#38656;&#35201;&#39069;&#22806;&#30340;&#36755;&#20837;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn351&quot;&gt;&#22914;&#26524;&#20320;&#26159;&#20010;&#21916;&#27426;&#20599;&#25042;&#30340;&#31243;&#24207;&#21592;&#24182;&#24819;&#35753;&#20195;&#30721;&#30475;&#36215;&#26469;&#26356;&#21152;&#31616;&#26126;&#65292;&#21487;&#20197;&#21033;&#29992; Python &#30340;&#20869;&#24314;&#20989;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locals()&lt;/span&gt;&lt;/tt&gt; &#12290;&#23427;&#36820;&#22238;&#30340;&#23383;&#20856;&#23545;&#25152;&#26377;&#23616;&#37096;&#21464;&#37327;&#30340;&#21517;&#31216;&#19982;&#20540;&#36827;&#34892;&#26144;&#23556;&#12290; &#22240;&#27492;&#65292;&#21069;&#38754;&#30340;&#35270;&#22270;&#21487;&#20197;&#37325;&#20889;&#25104;&#19979;&#38754;&#36825;&#20010;&#26679;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn353&quot;&gt;def current_datetime(request):
    current_date = datetime.datetime.now()
    return render_to_response(&apos;current_datetime.html&apos;, locals())
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn354&quot;&gt;&#22312;&#27492;&#65292;&#25105;&#20204;&#27809;&#26377;&#20687;&#20043;&#21069;&#37027;&#26679;&#25163;&#24037;&#25351;&#23450; context &#23383;&#20856;&#65292;&#32780;&#26159;&#20256;&#20837;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locals()&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#65292;&#23427;&#22218;&#25324;&#20102;&#20989;&#25968;&#25191;&#34892;&#21040;&#35813;&#26102;&#38388;&#28857;&#26102;&#25152;&#23450;&#20041;&#30340;&#19968;&#20999;&#21464;&#37327;&#12290; &#22240;&#27492;&#65292;&#25105;&#20204;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;now&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#37325;&#21629;&#21517;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_date&lt;/span&gt;&lt;/tt&gt; &#65292;&#22240;&#20026;&#37027;&#25165;&#26159;&#27169;&#26495;&#25152;&#39044;&#26399;&#30340;&#21464;&#37327;&#21517;&#31216;&#12290; &#22312;&#26412;&#20363;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locals()&lt;/span&gt;&lt;/tt&gt; &#24182;&#27809;&#26377;&#24102;&#26469;&#22810; &lt;em&gt;&#22823;&lt;/em&gt; &#30340;&#25913;&#36827;&#65292;&#20294;&#26159;&#22914;&#26524;&#26377;&#22810;&#20010;&#27169;&#26495;&#21464;&#37327;&#35201;&#30028;&#23450;&#32780;&#20320;&#21448;&#24819;&#20599;&#25042;&#65292;&#36825;&#31181;&#25216;&#26415;&#21487;&#20197;&#20943;&#23569;&#19968;&#20123;&#38190;&#30424;&#36755;&#20837;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn355&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locals()&lt;/span&gt;&lt;/tt&gt; &#26102;&#35201;&#27880;&#24847;&#26159;&#23427;&#23558;&#21253;&#25324; &lt;em&gt;&#25152;&#26377;&lt;/em&gt; &#30340;&#23616;&#37096;&#21464;&#37327;&#65292;&#23427;&#20204;&#21487;&#33021;&#27604;&#20320;&#24819;&#35753;&#27169;&#26495;&#35775;&#38382;&#30340;&#35201;&#22810;&#12290; &#22312;&#21069;&#20363;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locals()&lt;/span&gt;&lt;/tt&gt; &#36824;&#21253;&#21547;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; &#12290;&#23545;&#27492;&#22914;&#20309;&#21462;&#33293;&#21462;&#20915;&#20320;&#30340;&#24212;&#29992;&#31243;&#24207;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;get-template&quot;&gt;
&lt;span id=&quot;cn356&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn356&quot;&gt;get_template()&#20013;&#20351;&#29992;&#23376;&#30446;&#24405;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn357&quot;&gt;&#25226;&#25152;&#26377;&#30340;&#27169;&#26495;&#37117;&#23384;&#25918;&#22312;&#19968;&#20010;&#30446;&#24405;&#19979;&#21487;&#33021;&#20250;&#35753;&#20107;&#24773;&#21464;&#24471;&#38590;&#20197;&#25484;&#25511;&#12290; &#20320;&#21487;&#33021;&#20250;&#32771;&#34385;&#25226;&#27169;&#26495;&#23384;&#25918;&#22312;&#20320;&#27169;&#26495;&#30446;&#24405;&#30340;&#23376;&#30446;&#24405;&#20013;&#65292;&#36825;&#38750;&#24120;&#22909;&#12290; &#20107;&#23454;&#19978;&#65292;&#25105;&#20204;&#25512;&#33616;&#36825;&#26679;&#20570;&#65307;&#19968;&#20123;Django&#30340;&#39640;&#32423;&#29305;&#24615;&#65288;&#20363;&#22914;&#23558;&#22312;&#31532;&#21313;&#19968;&#31456;&#35762;&#21040;&#30340;&#36890;&#29992;&#35270;&#22270;&#31995;&#32479;&#65289;&#30340;&#32570;&#30465;&#32422;&#23450;&#23601;&#26159;&#26399;&#26395;&#20351;&#29992;&#36825;&#31181;&#27169;&#26495;&#24067;&#23616;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn358&quot;&gt;&#25226;&#27169;&#26495;&#23384;&#25918;&#20110;&#27169;&#26495;&#30446;&#24405;&#30340;&#23376;&#30446;&#24405;&#20013;&#26159;&#20214;&#24456;&#36731;&#26494;&#30340;&#20107;&#24773;&#12290; &#21482;&#38656;&#22312;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt; &#26102;&#65292;&#25226;&#23376;&#30446;&#24405;&#21517;&#21644;&#19968;&#26465;&#26012;&#26464;&#28155;&#21152;&#21040;&#27169;&#26495;&#21517;&#31216;&#20043;&#21069;&#65292;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn360&quot;&gt;t = get_template(&apos;dateapp/current_datetime.html&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn361&quot;&gt;&#30001;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#21482;&#26159;&#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt; &#30340;&#31616;&#21333;&#23553;&#35013;&#65292; &#20320;&#21487;&#20197;&#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#20570;&#30456;&#21516;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn363&quot;&gt;return render_to_response(&apos;dateapp/current_datetime.html&apos;, {&apos;current_date&apos;: now})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn364&quot;&gt;&#23545;&#23376;&#30446;&#24405;&#26641;&#30340;&#28145;&#24230;&#27809;&#26377;&#38480;&#21046;&#65292;&#20320;&#24819;&#35201;&#22810;&#23569;&#23618;&#37117;&#21487;&#20197;&#12290; &#21482;&#35201;&#20320;&#21916;&#27426;&#65292;&#29992;&#22810;&#23569;&#23618;&#30340;&#23376;&#30446;&#24405;&#37117;&#26080;&#25152;&#35859;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn365&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn366&quot;&gt;Windows&#29992;&#25143;&#24517;&#39035;&#20351;&#29992;&#26012;&#26464;&#32780;&#19981;&#26159;&#21453;&#26012;&#26464;&#12290;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt; &#20551;&#23450;&#30340;&#26159; Unix &#39118;&#26684;&#30340;&#25991;&#20214;&#21517;&#31526;&#21495;&#32422;&#23450;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;include&quot;&gt;
&lt;span id=&quot;cn367&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn367&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;include&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#26631;&#31614;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn368&quot;&gt;&#22312;&#35762;&#35299;&#20102;&#27169;&#26495;&#21152;&#36733;&#26426;&#21046;&#20043;&#21518;&#65292;&#25105;&#20204;&#20877;&#20171;&#32461;&#19968;&#20010;&#21033;&#29992;&#35813;&#26426;&#21046;&#30340;&#20869;&#24314;&#27169;&#26495;&#26631;&#31614;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#12290;&#35813;&#26631;&#31614;&#20801;&#35768;&#22312;&#65288;&#27169;&#26495;&#20013;&#65289;&#21253;&#21547;&#20854;&#23427;&#30340;&#27169;&#26495;&#30340;&#20869;&#23481;&#12290; &#26631;&#31614;&#30340;&#21442;&#25968;&#26159;&#25152;&#35201;&#21253;&#21547;&#30340;&#27169;&#26495;&#21517;&#31216;&#65292;&#21487;&#20197;&#26159;&#19968;&#20010;&#21464;&#37327;&#65292;&#20063;&#21487;&#20197;&#26159;&#29992;&#21333;/&#21452;&#24341;&#21495;&#30828;&#32534;&#30721;&#30340;&#23383;&#31526;&#20018;&#12290; &#27599;&#24403;&#22312;&#22810;&#20010;&#27169;&#26495;&#20013;&#20986;&#29616;&#30456;&#21516;&#30340;&#20195;&#30721;&#26102;&#65292;&#23601;&#24212;&#35813;&#32771;&#34385;&#26159;&#21542;&#35201;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26469;&#20943;&#23569;&#37325;&#22797;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn369&quot;&gt;&#19979;&#38754;&#36825;&#20004;&#20010;&#20363;&#23376;&#37117;&#21253;&#21547;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;nav.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#12290;&#36825;&#20004;&#20010;&#20363;&#23376;&#26159;&#31561;&#20215;&#30340;&#65292;&#23427;&#20204;&#35777;&#26126;&#21333;/&#21452;&#24341;&#21495;&#37117;&#26159;&#20801;&#35768;&#30340;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn371&quot;&gt;{% include &apos;nav.html&apos; %}
{% include &quot;nav.html&quot; %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn372&quot;&gt;&#19979;&#38754;&#30340;&#20363;&#23376;&#21253;&#21547;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;includes/nav.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#30340;&#20869;&#23481;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn374&quot;&gt;{% include &apos;includes/nav.html&apos; %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn375&quot;&gt;&#19979;&#38754;&#30340;&#20363;&#23376;&#21253;&#21547;&#20102;&#20197;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_name&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#20026;&#21517;&#31216;&#30340;&#27169;&#26495;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn377&quot;&gt;{% include template_name %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn378&quot;&gt;&#21644;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt; &#20013;&#19968;&#26679;&#65292; &#23545;&#27169;&#26495;&#30340;&#25991;&#20214;&#21517;&#36827;&#34892;&#21028;&#26029;&#26102;&#20250;&#22312;&#25152;&#35843;&#21462;&#30340;&#27169;&#26495;&#21517;&#31216;&#20043;&#21069;&#21152;&#19978;&#26469;&#33258; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#30340;&#27169;&#26495;&#30446;&#24405;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn379&quot;&gt;&#25152;&#21253;&#21547;&#30340;&#27169;&#26495;&#25191;&#34892;&#26102;&#30340; context &#21644;&#21253;&#21547;&#23427;&#20204;&#30340;&#27169;&#26495;&#26159;&#19968;&#26679;&#30340;&#12290;
&#20030;&#20363;&#35828;&#65292;&#32771;&#34385;&#19979;&#38754;&#20004;&#20010;&#27169;&#26495;&#25991;&#20214;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn381&quot;&gt;# mypage.html

&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
{% include &quot;includes/nav.html&quot; %}
&amp;lt;h1&amp;gt;{{ title }}&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

# includes/nav.html

&amp;lt;div id=&quot;nav&quot;&amp;gt;
    You are in: {{ current_section }}
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn382&quot;&gt;&#22914;&#26524;&#20320;&#29992;&#19968;&#20010;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_section&lt;/span&gt;&lt;/tt&gt;&#30340;&#19978;&#19979;&#25991;&#21435;&#28210;&#26579; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mypage.html&lt;/span&gt;&lt;/tt&gt;&#36825;&#20010;&#27169;&#26495;&#25991;&#20214;&#65292;&#36825;&#20010;&#21464;&#37327;&#23558;&#23384;&#22312;&#20110;&#23427;&#25152;&#21253;&#21547;&#65288;include&#65289;&#30340;&#27169;&#26495;&#37324;&#65292;&#23601;&#20687;&#20320;&#24819;&#35937;&#30340;&#37027;&#26679;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn383&quot;&gt;&#22914;&#26524;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#26631;&#31614;&#25351;&#23450;&#30340;&#27169;&#26495;&#27809;&#25214;&#21040;&#65292;Django&#23558;&#20250;&#22312;&#19979;&#38754;&#20004;&#20010;&#22788;&#29702;&#26041;&#27861;&#20013;&#36873;&#25321;&#19968;&#20010;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn384&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn384&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#65292;&#20320;&#23558;&#20250;&#22312; Django &#38169;&#35823;&#20449;&#24687;&#39029;&#38754;&#30475;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TemplateDoesNotExist&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn385&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn385&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt; &#65292;&#35813;&#26631;&#31614;&#19981;&#20250;&#24341;&#21457;&#38169;&#35823;&#20449;&#24687;&#65292;&#22312;&#26631;&#31614;&#20301;&#32622;&#19981;&#26174;&#31034;&#20219;&#20309;&#19996;&#35199;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id25&quot;&gt;
&lt;span id=&quot;cn386&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn386&quot;&gt;&#27169;&#26495;&#32487;&#25215;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn387&quot;&gt;&#21040;&#30446;&#21069;&#20026;&#27490;&#65292;&#25105;&#20204;&#30340;&#27169;&#26495;&#33539;&#20363;&#37117;&#21482;&#26159;&#20123;&#38646;&#26143;&#30340; HTML &#29255;&#27573;&#65292;&#20294;&#22312;&#23454;&#38469;&#24212;&#29992;&#20013;&#65292;&#20320;&#23558;&#29992; Django &#27169;&#26495;&#31995;&#32479;&#26469;&#21019;&#24314;&#25972;&#20010; HTML &#39029;&#38754;&#12290; &#36825;&#23601;&#24102;&#26469;&#19968;&#20010;&#24120;&#35265;&#30340; Web &#24320;&#21457;&#38382;&#39064;&#65306; &#22312;&#25972;&#20010;&#32593;&#31449;&#20013;&#65292;&#22914;&#20309;&#20943;&#23569;&#20849;&#29992;&#39029;&#38754;&#21306;&#22495;&#65288;&#27604;&#22914;&#31449;&#28857;&#23548;&#33322;&#65289;&#25152;&#24341;&#36215;&#30340;&#37325;&#22797;&#21644;&#20887;&#20313;&#20195;&#30721;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn388&quot;&gt;&#35299;&#20915;&#35813;&#38382;&#39064;&#30340;&#20256;&#32479;&#20570;&#27861;&#26159;&#20351;&#29992; &lt;em&gt;&#26381;&#21153;&#22120;&#31471;&#30340; includes&lt;/em&gt; &#65292;&#20320;&#21487;&#20197;&#22312; HTML &#39029;&#38754;&#20013;&#20351;&#29992;&#35813;&#25351;&#20196;&#23558;&#19968;&#20010;&#32593;&#39029;&#23884;&#20837;&#21040;&#21478;&#19968;&#20010;&#20013;&#12290; &#20107;&#23454;&#19978;&#65292; Django &#36890;&#36807;&#21018;&#25165;&#35762;&#36848;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#25903;&#25345;&#20102;&#36825;&#31181;&#26041;&#27861;&#12290; &#20294;&#26159;&#29992; Django &#35299;&#20915;&#27492;&#31867;&#38382;&#39064;&#30340;&#39318;&#36873;&#26041;&#27861;&#26159;&#20351;&#29992;&#26356;&#21152;&#20248;&#38597;&#30340;&#31574;&#30053;&#8212;&#8212; &lt;em&gt;&#27169;&#26495;&#32487;&#25215;&lt;/em&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn389&quot;&gt;&#26412;&#36136;&#19978;&#26469;&#35828;&#65292;&#27169;&#26495;&#32487;&#25215;&#23601;&#26159;&#20808;&#26500;&#36896;&#19968;&#20010;&#22522;&#30784;&#26694;&#26550;&#27169;&#26495;&#65292;&#32780;&#21518;&#22312;&#20854;&#23376;&#27169;&#26495;&#20013;&#23545;&#23427;&#25152;&#21253;&#21547;&#31449;&#28857;&#20844;&#29992;&#37096;&#20998;&#21644;&#23450;&#20041;&#22359;&#36827;&#34892;&#37325;&#36733;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn390&quot;&gt;&#35753;&#25105;&#20204;&#36890;&#36807;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime.html&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#65292;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime&lt;/span&gt;&lt;/tt&gt; &#21019;&#24314;&#19968;&#20010;&#26356;&#21152;&#23436;&#25972;&#30340;&#27169;&#26495;&#26469;&#20307;&#20250;&#19968;&#19979;&#36825;&#31181;&#20570;&#27861;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn392&quot;&gt;&amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;&amp;gt;
&amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;The current time&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;My helpful timestamp site&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;It is now {{ current_date }}.&amp;lt;/p&amp;gt;

    &amp;lt;hr&amp;gt;
    &amp;lt;p&amp;gt;Thanks for visiting my site.&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn393&quot;&gt;&#36825;&#30475;&#36215;&#26469;&#24456;&#26834;&#65292;&#20294;&#22914;&#26524;&#25105;&#20204;&#35201;&#20026;&#31532;&#19977;&#31456;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hours_ahead&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#21019;&#24314;&#21478;&#19968;&#20010;&#27169;&#26495;&#20250;&#21457;&#29983;&#20160;&#20040;&#20107;&#24773;&#21602;&#65311;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn395&quot;&gt;&amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;&amp;gt;
&amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Future time&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;My helpful timestamp site&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;In {{ hour_offset }} hour(s), it will be {{ next_time }}.&amp;lt;/p&amp;gt;

    &amp;lt;hr&amp;gt;
    &amp;lt;p&amp;gt;Thanks for visiting my site.&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn396&quot;&gt;&#24456;&#26126;&#26174;&#65292;&#25105;&#20204;&#21018;&#25165;&#37325;&#22797;&#20102;&#22823;&#37327;&#30340; HTML &#20195;&#30721;&#12290; &#24819;&#35937;&#19968;&#19979;&#65292;&#22914;&#26524;&#26377;&#19968;&#20010;&#26356;&#20856;&#22411;&#30340;&#32593;&#31449;&#65292;&#23427;&#26377;&#23548;&#33322;&#26465;&#12289;&#26679;&#24335;&#34920;&#65292;&#21487;&#33021;&#36824;&#26377;&#19968;&#20123; JavaScript &#20195;&#30721;&#65292;&#20107;&#24773;&#24517;&#23558;&#20197;&#21521;&#27599;&#20010;&#27169;&#26495;&#22635;&#20805;&#21508;&#31181;&#20887;&#20313;&#30340; HTML &#32780;&#21578;&#32456;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn397&quot;&gt;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#30340;&#26381;&#21153;&#22120;&#31471; include &#26041;&#26696;&#26159;&#25214;&#20986;&#20004;&#20010;&#27169;&#26495;&#20013;&#30340;&#20849;&#21516;&#37096;&#20998;&#65292;&#23558;&#20854;&#20445;&#23384;&#20026;&#19981;&#21516;&#30340;&#27169;&#26495;&#29255;&#27573;&#65292;&#28982;&#21518;&#22312;&#27599;&#20010;&#27169;&#26495;&#20013;&#36827;&#34892; include&#12290; &#20063;&#35768;&#20320;&#20250;&#25226;&#27169;&#26495;&#22836;&#37096;&#30340;&#19968;&#20123;&#20195;&#30721;&#20445;&#23384;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;header.html&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn399&quot;&gt;&amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;&amp;gt;
&amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn400&quot;&gt;&#20320;&#21487;&#33021;&#20250;&#25226;&#24213;&#37096;&#20445;&#23384;&#21040;&#25991;&#20214; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;footer.html&lt;/span&gt;&lt;/tt&gt; :&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn402&quot;&gt;    &amp;lt;hr&amp;gt;
    &amp;lt;p&amp;gt;Thanks for visiting my site.&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn403&quot;&gt;&#23545;&#22522;&#20110; include &#30340;&#31574;&#30053;&#65292;&#22836;&#37096;&#21644;&#24213;&#37096;&#30340;&#21253;&#21547;&#24456;&#31616;&#21333;&#12290; &#40635;&#28902;&#30340;&#26159;&#20013;&#38388;&#37096;&#20998;&#12290; &#22312;&#27492;&#33539;&#20363;&#20013;&#65292;&#27599;&#20010;&#39029;&#38754;&#37117;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;h1&amp;gt;My&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;helpful&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;timestamp&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;site&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#26631;&#39064;&#65292;&#20294;&#26159;&#36825;&#20010;&#26631;&#39064;&#19981;&#33021;&#25918;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;header.html&lt;/span&gt;&lt;/tt&gt; &#20013;&#65292;&#22240;&#20026;&#27599;&#20010;&#39029;&#38754;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#26159;&#19981;&#21516;&#30340;&#12290; &#22914;&#26524;&#25105;&#20204;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#21253;&#21547;&#22312;&#22836;&#37096;&#65292;&#25105;&#20204;&#23601;&#19981;&#24471;&#19981;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#65292;&#20294;&#36825;&#26679;&#21448;&#19981;&#20801;&#35768;&#22312;&#27599;&#20010;&#39029;&#38754;&#23545;&#23427;&#36827;&#34892;&#23450;&#21046;&#12290; &#20309;&#21435;&#20309;&#20174;&#21602;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn404&quot;&gt;Django &#30340;&#27169;&#26495;&#32487;&#25215;&#31995;&#32479;&#35299;&#20915;&#20102;&#36825;&#20123;&#38382;&#39064;&#12290; &#20320;&#21487;&#20197;&#23558;&#20854;&#35270;&#20026;&#26381;&#21153;&#22120;&#31471; include &#30340;&#36870;&#21521;&#24605;&#32500;&#29256;&#26412;&#12290; &#20320;&#21487;&#20197;&#23545;&#37027;&#20123; &lt;em&gt;&#19981;&#21516;&lt;/em&gt; &#30340;&#20195;&#30721;&#27573;&#36827;&#34892;&#23450;&#20041;&#65292;&#32780;&#19981;&#26159; &lt;em&gt;&#20849;&#21516;&lt;/em&gt; &#20195;&#30721;&#27573;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn405&quot;&gt;&#31532;&#19968;&#27493;&#26159;&#23450;&#20041; &lt;em&gt;&#22522;&#30784;&#27169;&#26495;&lt;/em&gt; &#65292; &#35813;&#26694;&#26550;&#20043;&#21518;&#23558;&#30001; &lt;em&gt;&#23376;&#27169;&#26495;&lt;/em&gt; &#25152;&#32487;&#25215;&#12290; &#20197;&#19979;&#26159;&#25105;&#20204;&#30446;&#21069;&#25152;&#35762;&#36848;&#33539;&#20363;&#30340;&#22522;&#30784;&#27169;&#26495;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn407&quot;&gt;&amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;&amp;gt;
&amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;{% block title %}{% endblock %}&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;My helpful timestamp site&amp;lt;/h1&amp;gt;
    {% block content %}{% endblock %}
    {% block footer %}
    &amp;lt;hr&amp;gt;
    &amp;lt;p&amp;gt;Thanks for visiting my site.&amp;lt;/p&amp;gt;
    {% endblock %}
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn408&quot;&gt;&#36825;&#20010;&#21483;&#20570; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base.html&lt;/span&gt;&lt;/tt&gt; &#30340;&#27169;&#26495;&#23450;&#20041;&#20102;&#19968;&#20010;&#31616;&#21333;&#30340; HTML &#26694;&#26550;&#25991;&#26723;&#65292;&#25105;&#20204;&#23558;&#22312;&#26412;&#31449;&#28857;&#30340;&#25152;&#26377;&#39029;&#38754;&#20013;&#20351;&#29992;&#12290; &#23376;&#27169;&#26495;&#30340;&#20316;&#29992;&#23601;&#26159;&#37325;&#36733;&#12289;&#28155;&#21152;&#25110;&#20445;&#30041;&#37027;&#20123;&#22359;&#30340;&#20869;&#23481;&#12290; &#65288;&#22914;&#26524;&#20320;&#19968;&#30452;&#25353;&#39034;&#24207;&#23398;&#20064;&#21040;&#36825;&#37324;&#65292;&#20445;&#23384;&#36825;&#20010;&#25991;&#20214;&#21040;&#20320;&#30340;template&#30446;&#24405;&#19979;&#65292;&#21629;&#21517;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base.html&lt;/span&gt;&lt;/tt&gt; .&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn409&quot;&gt;&#25105;&#20204;&#20351;&#29992;&#19968;&#20010;&#20197;&#21069;&#24050;&#32463;&#35265;&#36807;&#30340;&#27169;&#26495;&#26631;&#31614;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#12290; &#25152;&#26377;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#21578;&#35785;&#27169;&#26495;&#24341;&#25806;&#65292;&#23376;&#27169;&#26495;&#21487;&#20197;&#37325;&#36733;&#36825;&#20123;&#37096;&#20998;&#12290;
&#27599;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#26631;&#31614;&#25152;&#35201;&#20570;&#30340;&#26159;&#21578;&#35785;&#27169;&#26495;&#24341;&#25806;&#65292;&#35813;&#27169;&#26495;&#19979;&#30340;&#36825;&#19968;&#22359;&#20869;&#23481;&#23558;&#26377;&#21487;&#33021;&#34987;&#23376;&#27169;&#26495;&#35206;&#30422;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn410&quot;&gt;&#29616;&#22312;&#25105;&#20204;&#24050;&#32463;&#26377;&#20102;&#19968;&#20010;&#22522;&#26412;&#27169;&#26495;&#65292;&#25105;&#20204;&#21487;&#20197;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#26469; &#20351;&#29992;&#23427;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn412&quot;&gt;{% extends &quot;base.html&quot; %}

{% block title %}The current time{% endblock %}

{% block content %}
&amp;lt;p&amp;gt;It is now {{ current_date }}.&amp;lt;/p&amp;gt;
{% endblock %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn413&quot;&gt;&#20877;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hours_ahead&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#21019;&#24314;&#19968;&#20010;&#27169;&#26495;&#65292;&#30475;&#36215;&#26469;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn415&quot;&gt;{% extends &quot;base.html&quot; %}

{% block title %}Future time{% endblock %}

{% block content %}
&amp;lt;p&amp;gt;In {{ hour_offset }} hour(s), it will be {{ next_time }}.&amp;lt;/p&amp;gt;
{% endblock %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn416&quot;&gt;&#30475;&#36215;&#26469;&#24456;&#28418;&#20142;&#26159;&#19981;&#26159;&#65311; &#27599;&#20010;&#27169;&#26495;&#21482;&#21253;&#21547;&#23545;&#33258;&#24049;&#32780;&#35328; &lt;em&gt;&#29420;&#19968;&#26080;&#20108;&lt;/em&gt; &#30340;&#20195;&#30721;&#12290; &#26080;&#38656;&#22810;&#20313;&#30340;&#37096;&#20998;&#12290; &#22914;&#26524;&#24819;&#36827;&#34892;&#31449;&#28857;&#32423;&#30340;&#35774;&#35745;&#20462;&#25913;&#65292;&#20165;&#38656;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base.html&lt;/span&gt;&lt;/tt&gt; &#65292;&#25152;&#26377;&#20854;&#23427;&#27169;&#26495;&#20250;&#31435;&#21363;&#21453;&#26144;&#20986;&#25152;&#20316;&#20462;&#25913;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn417&quot;&gt;&#20197;&#19979;&#26159;&#20854;&#24037;&#20316;&#26041;&#24335;&#12290; &#22312;&#21152;&#36733; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_datetime.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#26102;&#65292;&#27169;&#26495;&#24341;&#25806;&#21457;&#29616;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#65292; &#27880;&#24847;&#21040;&#35813;&#27169;&#26495;&#26159;&#19968;&#20010;&#23376;&#27169;&#26495;&#12290;
&#27169;&#26495;&#24341;&#25806;&#31435;&#21363;&#35013;&#36733;&#20854;&#29238;&#27169;&#26495;&#65292;&#21363;&#26412;&#20363;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base.html&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn418&quot;&gt;&#27492;&#26102;&#65292;&#27169;&#26495;&#24341;&#25806;&#27880;&#24847;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base.html&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#19977;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#65292;&#24182;&#29992;&#23376;&#27169;&#26495;&#30340;&#20869;&#23481;&#26367;&#25442;&#36825;&#20123; block &#12290;&#22240;&#27492;&#65292;&#24341;&#25806;&#23558;&#20250;&#20351;&#29992;&#25105;&#20204;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20013;&#23450;&#20041;&#30340;&#26631;&#39064;&#65292;&#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20063;&#26159;&#22914;&#27492;&#12290; &#25152;&#20197;&#65292;&#32593;&#39029;&#26631;&#39064;&#19968;&#22359;&#23558;&#30001; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#26367;&#25442;&#65292;&#21516;&#26679;&#22320;&#65292;&#32593;&#39029;&#30340;&#20869;&#23481;&#19968;&#22359;&#23558;&#30001; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt;
&lt;span class=&quot;pre&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#26367;&#25442;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn419&quot;&gt;&#27880;&#24847;&#30001;&#20110;&#23376;&#27169;&#26495;&#24182;&#27809;&#26377;&#23450;&#20041; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;footer&lt;/span&gt;&lt;/tt&gt; &#22359;&#65292;&#27169;&#26495;&#31995;&#32479;&#23558;&#20351;&#29992;&#22312;&#29238;&#27169;&#26495;&#20013;&#23450;&#20041;&#30340;&#20540;&#12290; &#29238;&#27169;&#26495; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#20013;&#30340;&#20869;&#23481;&#24635;&#26159;&#34987;&#24403;&#20316;&#19968;&#26465;&#36864;&#36335;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn420&quot;&gt;&#32487;&#25215;&#24182;&#19981;&#20250;&#24433;&#21709;&#21040;&#27169;&#26495;&#30340;&#19978;&#19979;&#25991;&#12290; &#25442;&#21477;&#35805;&#35828;&#65292;&#20219;&#20309;&#22788;&#22312;&#32487;&#25215;&#26641;&#19978;&#30340;&#27169;&#26495;&#37117;&#21487;&#20197;&#35775;&#38382;&#21040;&#20320;&#20256;&#21040;&#27169;&#26495;&#20013;&#30340;&#27599;&#19968;&#20010;&#27169;&#26495;&#21464;&#37327;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn421&quot;&gt;&#20320;&#21487;&#20197;&#26681;&#25454;&#38656;&#35201;&#20351;&#29992;&#20219;&#24847;&#22810;&#30340;&#32487;&#25215;&#27425;&#25968;&#12290; &#20351;&#29992;&#32487;&#25215;&#30340;&#19968;&#31181;&#24120;&#35265;&#26041;&#24335;&#26159;&#19979;&#38754;&#30340;&#19977;&#23618;&#27861;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn422&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn422&quot;&gt;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#65292;&#22312;&#20854;&#20013;&#23450;&#20041;&#31449;&#28857;&#30340;&#20027;&#35201;&#22806;&#35266;&#24863;&#21463;&#12290; &#36825;&#20123;&#37117;&#26159;&#19981;&#24120;&#20462;&#25913;&#29978;&#33267;&#20174;&#19981;&#20462;&#25913;&#30340;&#37096;&#20998;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn423&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn423&quot;&gt;&#20026;&#32593;&#31449;&#30340;&#27599;&#20010;&#21306;&#22495;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base_SECTION.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;(&#20363;&#22914;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base_photos.html&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base_forum.html&lt;/span&gt;&lt;/tt&gt; )&#12290;&#36825;&#20123;&#27169;&#26495;&#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base.html&lt;/span&gt;&lt;/tt&gt; &#36827;&#34892;&#25299;&#23637;&#65292;&#24182;&#21253;&#21547;&#21306;&#22495;&#29305;&#23450;&#30340;&#39118;&#26684;&#19982;&#35774;&#35745;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn424&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn424&quot;&gt;&#20026;&#27599;&#31181;&#31867;&#22411;&#30340;&#39029;&#38754;&#21019;&#24314;&#29420;&#31435;&#30340;&#27169;&#26495;&#65292;&#20363;&#22914;&#35770;&#22363;&#39029;&#38754;&#25110;&#32773;&#22270;&#29255;&#24211;&#12290; &#36825;&#20123;&#27169;&#26495;&#25299;&#23637;&#30456;&#24212;&#30340;&#21306;&#22495;&#27169;&#26495;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn425&quot;&gt;&#36825;&#20010;&#26041;&#27861;&#21487;&#26368;&#22823;&#38480;&#24230;&#22320;&#37325;&#29992;&#20195;&#30721;&#65292;&#24182;&#20351;&#24471;&#21521;&#20844;&#20849;&#21306;&#22495;&#65288;&#22914;&#21306;&#22495;&#32423;&#30340;&#23548;&#33322;&#65289;&#28155;&#21152;&#20869;&#23481;&#25104;&#20026;&#19968;&#20214;&#36731;&#26494;&#30340;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn426&quot;&gt;&#20197;&#19979;&#26159;&#20351;&#29992;&#27169;&#26495;&#32487;&#25215;&#30340;&#19968;&#20123;&#35776;&#31373;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn427&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn427&quot;&gt;&#22914;&#26524;&#22312;&#27169;&#26495;&#20013;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#65292;&#24517;&#39035;&#20445;&#35777;&#20854;&#20026;&#27169;&#26495;&#20013;&#30340;&#31532;&#19968;&#20010;&#27169;&#26495;&#26631;&#35760;&#12290; &#21542;&#21017;&#65292;&#27169;&#26495;&#32487;&#25215;&#23558;&#19981;&#36215;&#20316;&#29992;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn428&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn428&quot;&gt;&#19968;&#33324;&#26469;&#35828;&#65292;&#22522;&#30784;&#27169;&#26495;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#36234;&#22810;&#36234;&#22909;&#12290;
&#35760;&#20303;&#65292;&#23376;&#27169;&#26495;&#19981;&#24517;&#23450;&#20041;&#29238;&#27169;&#26495;&#20013;&#25152;&#26377;&#30340;&#20195;&#30721;&#22359;&#65292;&#22240;&#27492;&#20320;&#21487;&#20197;&#29992;&#21512;&#29702;&#30340;&#32570;&#30465;&#20540;&#23545;&#19968;&#20123;&#20195;&#30721;&#22359;&#36827;&#34892;&#22635;&#20805;&#65292;&#28982;&#21518;&#21482;&#23545;&#23376;&#27169;&#26495;&#25152;&#38656;&#30340;&#20195;&#30721;&#22359;&#36827;&#34892;&#65288;&#37325;&#65289;&#23450;&#20041;&#12290; &#20439;&#35805;&#35828;&#65292;&#38057;&#23376;&#36234;&#22810;&#36234;&#22909;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn429&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn429&quot;&gt;&#22914;&#26524;&#21457;&#35273;&#33258;&#24049;&#22312;&#22810;&#20010;&#27169;&#26495;&#20043;&#38388;&#25335;&#36125;&#20195;&#30721;&#65292;&#20320;&#24212;&#35813;&#32771;&#34385;&#23558;&#35813;&#20195;&#30721;&#27573;&#25918;&#32622;&#21040;&#29238;&#27169;&#26495;&#30340;&#26576;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20013;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn430&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn430&quot;&gt;&#22914;&#26524;&#20320;&#38656;&#35201;&#35775;&#38382;&#29238;&#27169;&#26495;&#20013;&#30340;&#22359;&#30340;&#20869;&#23481;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt;
&lt;span class=&quot;pre&quot;&gt;block.super&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt;&#36825;&#20010;&#26631;&#31614;&#21543;&#65292;&#36825;&#19968;&#20010;&#39764;&#27861;&#21464;&#37327;&#23558;&#20250;&#34920;&#29616;&#20986;&#29238;&#27169;&#26495;&#20013;&#30340;&#20869;&#23481;&#12290; &#22914;&#26524;&#21482;&#24819;&#22312;&#19978;&#32423;&#20195;&#30721;&#22359;&#22522;&#30784;&#19978;&#28155;&#21152;&#20869;&#23481;&#65292;&#32780;&#19981;&#26159;&#20840;&#37096;&#37325;&#36733;&#65292;&#35813;&#21464;&#37327;&#23601;&#26174;&#24471;&#38750;&#24120;&#26377;&#29992;&#20102;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn431&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn431&quot;&gt;&#19981;&#20801;&#35768;&#22312;&#21516;&#19968;&#20010;&#27169;&#26495;&#20013;&#23450;&#20041;&#22810;&#20010;&#21516;&#21517;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;block&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#12290; &#23384;&#22312;&#36825;&#26679;&#30340;&#38480;&#21046;&#26159;&#22240;&#20026;block &#26631;&#31614;&#30340;&#24037;&#20316;&#26041;&#24335;&#26159;&#21452;&#21521;&#30340;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;block &#26631;&#31614;&#19981;&#20165;&#25366;&#20102;&#19968;&#20010;&#35201;&#22635;&#30340;&#22353;&#65292;&#20063;&#23450;&#20041;&#20102;&#22312;&lt;em&gt;&#29238;&lt;/em&gt;&#27169;&#26495;&#20013;&#36825;&#20010;&#22353;&#25152;&#22635;&#20805;&#30340;&#20869;&#23481;&#12290;&#22914;&#26524;&#27169;&#26495;&#20013;&#20986;&#29616;&#20102;&#20004;&#20010;&#30456;&#21516;&#21517;&#31216;&#30340; &lt;em&gt;{% block %}&lt;/em&gt; &#26631;&#31614;&#65292;&#29238;&#27169;&#26495;&#23558;&#26080;&#20174;&#24471;&#30693;&#35201;&#20351;&#29992;&#21738;&#20010;&#22359;&#30340;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn432&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn432&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#23545;&#25152;&#20256;&#20837;&#27169;&#26495;&#21517;&#31216;&#20351;&#29992;&#30340;&#21152;&#36733;&#26041;&#27861;&#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template()&lt;/span&gt;&lt;/tt&gt; &#30456;&#21516;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;&#20250;&#23558;&#27169;&#26495;&#21517;&#31216;&#34987;&#28155;&#21152;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20043;&#21518;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn433&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn433&quot;&gt;&#22810;&#25968;&#24773;&#20917;&#19979;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#30340;&#21442;&#25968;&#24212;&#35813;&#26159;&#23383;&#31526;&#20018;&#65292;&#20294;&#26159;&#22914;&#26524;&#30452;&#21040;&#36816;&#34892;&#26102;&#26041;&#33021;&#30830;&#23450;&#29238;&#27169;&#26495;&#21517;&#65292;&#36825;&#20010;&#21442;&#25968;&#20063;&#21487;&#20197;&#26159;&#20010;&#21464;&#37327;&#12290; &#36825;&#20351;&#24471;&#20320;&#33021;&#22815;&#23454;&#29616;&#19968;&#20123;&#24456;&#37239;&#30340;&#21160;&#24577;&#21151;&#33021;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id26&quot;&gt;
&lt;span id=&quot;cn434&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn434&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn435&quot;&gt;&#20320;&#29616;&#22312;&#24050;&#32463;&#25484;&#25569;&#20102;&#27169;&#26495;&#31995;&#32479;&#30340;&#22522;&#26412;&#30693;&#35782;&#12290; &#25509;&#19979;&#26469;&#21602;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn436&quot;&gt;&#26102;&#19979;&#22823;&#22810;&#25968;&#32593;&#31449;&#37117;&#26159; &lt;em&gt;&#25968;&#25454;&#24211;&#39537;&#21160;&lt;/em&gt; &#30340;&#65306;&#32593;&#31449;&#30340;&#20869;&#23481;&#37117;&#26159;&#23384;&#20648;&#22312;&#20851;&#31995;&#22411;&#25968;&#25454;&#24211;&#20013;&#12290; &#36825;&#20351;&#24471;&#25968;&#25454;&#21644;&#36923;&#36753;&#33021;&#22815;&#24443;&#24213;&#22320;&#20998;&#24320;&#65288;&#35270;&#22270;&#21644;&#27169;&#26495;&#20063;&#20197;&#21516;&#26679;&#26041;&#24335;&#23545;&#36923;&#36753;&#21644;&#26174;&#31034;&#36827;&#34892;&#20102;&#20998;&#38548;&#12290;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn437&quot;&gt;&#19979;&#19968;&#31456;&#23558;&#35762;&#36848;&#22914;&#20309;&#19982;&#25968;&#25454;&#24211;&#25171;&#20132;&#36947;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</summary>
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#22235;&#31456; &#27169;&#26495;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#22312;&#21069;&#19968;&#31456;&#20013;&#65292;&#20320;&#21487;&#33021;&#24050;&#32463;&#27880;&#24847;&#21040;&#25105;&#20204;&#22312;&#20363;&#23376;&#35270;&#22270;&#20013;&#36820;&#22238;&#25991;&#26412;&#30340;&#26041;&#24335;&#26377;&#28857;&#29305;&#21035;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;HTML&#34987;&#30452;&#25509;&#30828;&#32534;&#30721;&#22312; Python &#20195;&#30721;&#20043;&#20013;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn3&quot;&gt;def current_datetime(request):
    now = datetime.datetime.now()
    html = &quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;It is now %s.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot; % now
    return HttpResponse(html)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#23613;&#31649;&#36825;&#31181;&#25216;&#26415;&#20415;&#20110;&#35299;&#37322;&#35270;&#22270;&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#65292;&#20294;&#30452;&#25509;&#23558;HTML&#30828;&#32534;&#30721;&#21040;&#20320;&#30340;&#35270;&#22270;&#37324;&#21364;&#24182;&#19981;&#26159;&#19968;&#20010;&#22909;&#20027;&#24847;&#12290; &#35753;&#25105;&#20204;&#26469;&#30475;&#19968;&#19979;&#20026;&#20160;&#20040;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn5&quot;&gt;&#23545;&#39029;&#38754;&#35774;&#35745;&#36827;&#34892;&#30340;&#20219;&#20309;&#25913;&#21464;&#37117;&#24517;&#39035;&#23545; Python &#20195;&#30721;&#36827;&#34892;&#30456;&#24212;&#30340;&#20462;&#25913;&#12290; &#31449;&#28857;&#35774;&#35745;&#30340;&#20462;&#25913;&#24448;&#24448;&#27604;&#24213;&#23618; Python &#20195;&#30721;&#30340;&#20462;&#25913;&#35201;&#39057;&#32321;&#24471;&#22810;&#65292;&#22240;&#27492;&#22914;&#26524;&#21487;&#20197;&#22312;&#19981;&#36827;&#34892; Python &#20195;&#30721;&#20462;&#25913;&#30340;&#24773;&#20917;&#19979;&#21464;&#26356;&#35774;&#35745;&#65292;&#37027;&#23558;&#20250;&#26041;&#20415;&#24471;&#22810;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn6&quot;&gt;Python &#20195;&#30721;&#32534;&#20889;&#21644; HTML &#35774;&#35745;&#26159;&#20004;&#39033;&#19981;&#21516;&#30340;&#24037;&#20316;&#65292;&#22823;&#22810;&#25968;&#19987;&#19994;&#30340;&#32593;&#31449;&#24320;&#21457;&#29615;&#22659;&#37117;&#23558;&#20182;&#20204;&#20998;&#37197;&#32473;&#19981;&#21516;&#30340;&#20154;&#21592;&#65288;&#29978;&#33267;&#19981;&#21516;&#37096;&#38376;&#65289;&#26469;&#23436;&#25104;&#12290; &#35774;&#35745;&#32773;&#21644;HTML/CSS&#30340;&#32534;&#30721;&#20154;&#21592;&#19981;&#24212;&#35813;&#34987;&#35201;&#27714;&#21435;&#32534;&#36753;Python&#30340;&#20195;&#30721;&#26469;&#23436;&#25104;&#20182;&#20204;&#30340;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn7&quot;&gt;&#31243;&#24207;&#21592;&#32534;&#20889; Python&#20195;&#30721;&#21644;&#35774;&#35745;&#20154;&#21592;&#21046;&#20316;&#27169;&#26495;&#20004;&#39033;&#24037;&#20316;&#21516;&#26102;&#36827;&#34892;&#30340;&#25928;&#29575;&#26159;&#26368;&#39640;&#30340;&#65292;&#36828;&#32988;&#20110;&#35753;&#19968;&#20010;&#20154;&#31561;&#24453;&#21478;&#19968;&#20010;&#20154;&#23436;&#25104;&#23545;&#26576;&#20010;&#26082;&#21253;&#21547; Python&#21448;&#21253;&#21547; HTML &#30340;&#25991;&#20214;&#30340;&#32534;&#36753;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#22522;&#20110;&#36825;&#20123;&#21407;&#22240;&#65292;&#23558;&#39029;&#38754;&#30340;&#35774;&#35745;&#21644;Python&#30340;&#20195;&#30721;&#20998;&#31163;&#24320;&#20250;&#26356;&#24178;&#20928;&#31616;&#27905;&#26356;&#23481;&#26131;&#32500;&#25252;&#12290; &#25105;&#20204;&#21487;&#20197;&#20351;&#29992; Django&#30340; &lt;em&gt;&#27169;&#26495;&#31995;&#32479;&lt;/em&gt; (Template System)&#26469;&#23454;&#29616;&#36825;&#31181;&#27169;&#24335;&#65292;&#36825;&#23601;&#26159;&#26412;&#31456;&#35201;&#20855;&#20307;&#35752;&#35770;&#30340;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn9&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#27169;&#26495;&#31995;&#32479;&#22522;&#26412;&#30693;&#35782;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#27169;&#26495;&#26159;&#19968;&#20010;&#25991;&#26412;&#65292;&#29992;&#20110;&#20998;&#31163;&#25991;&#26723;&#30340;&#34920;&#29616;&#24418;&#24335;&#21644;&#20869;&#23481;&#12290; &#27169;&#26495;&#23450;&#20041;&#20102;&#21344;&#20301;&#31526;&#20197;&#21450;&#21508;&#31181;&#29992;&#20110;&#35268;&#33539;&#25991;&#26723;&#35813;&#22914;&#20309;&#26174;&#31034;&#30340;&#21508;&#37096;&#20998;&#22522;&#26412;&#36923;&#36753;&#65288;&#27169;&#26495;&#26631;&#31614;&#65289;&#12290; &#27169;&#26495;&#36890;&#24120;&#29992;&#20110;&#20135;&#29983;HTML&#65292;&#20294;&#26159;Django&#30340;&#27169;&#26495;&#20063;&#33021;&#20135;&#29983;&#20219;&#20309;&#22522;&#20110;&#25991;&#26412;&#26684;&#24335;&#30340;&#25991;&#26723;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#35753;&#25105;&#20204;&#20174;&#19968;&#20010;&#31616;&#21333;&#30340;&#20363;&#23376;&#27169;&#26495;&#24320;&#22987;&#12290; &#35813;&#27169;&#26495;&#25551;&#36848;&#20102;&#19968;&#20010;&#21521;&#26576;&#20010;&#19982;&#20844;&#21496;&#31614;&#21333;&#20154;&#21592;&#33268;&#35874; HTML &#39029;&#38754;&#12290; &#21487;&#23558;&#20854;&#35270;&#20026;&#19968;&#20010;&#26684;&#24335;&#20449;&#20989;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn13&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Ordering notice&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;

&amp;lt;h1&amp;gt;Ordering notice&amp;lt;/h1&amp;gt;

&amp;lt;p&amp;gt;Dear {{ person_name }},&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Thanks for placing an order from {{ company }}. It&apos;s scheduled to
ship on {{ ship_date|date:&quot;F j, Y&quot; }}.&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Here are the items you&apos;ve ordered:&amp;lt;/p&amp;gt;

&amp;lt;ul&amp;gt;
{% for item in item_list %}
    &amp;lt;li&amp;gt;{{ item }}&amp;lt;/li&amp;gt;
{% endfor %}
&amp;lt;/ul&amp;gt;

{% if ordered_warranty %}
    &amp;lt;p&amp;gt;Your warranty information will be included in the packaging.&amp;lt;/p&amp;gt;
{% else %}
    &amp;lt;p&amp;gt;You didn&apos;t order a warranty, so you&apos;re on your own when
    the products inevitably stop working.&amp;lt;/p&amp;gt;
{% endif %}

&amp;lt;p&amp;gt;Sincerely,&amp;lt;br /&amp;gt;{{ company }}&amp;lt;/p&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&#35813;&#27169;&#26495;&#26159;&#19968;&#27573;&#28155;&#21152;&#20102;&#20123;&#35768;&#21464;&#37327;&#21644;&#27169;&#26495;&#26631;&#31614;&#30340;&#22522;&#30784; HTML &#12290; &#35753;&#25105;&#20204;&#36880;&#27493;&#20998;&#26512;&#19968;&#19979;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#29992;&#20004;&#20010;&#22823;&#25324;&#21495;&#25324;&#36215;&#26469;&#30340;&#25991;&#23383;&#65288;&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;person_name&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#65289;&#31216;&#20026; &lt;em&gt;&#21464;&#37327;(variable)&lt;/em&gt; &#12290;&#36825;&#24847;&#21619;&#30528;&#22312;&#27492;&#22788;&#25554;&#20837;&#25351;&#23450;&#21464;&#37327;&#30340;&#20540;&#12290; &#22914;&#20309;&#25351;&#23450;&#21464;&#37327;&#30340;&#20540;&#21602;&#65311; &#31245;&#21518;&#23601;&#20250;&#35828;&#26126;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#34987;&#22823;&#25324;&#21495;&#21644;&#30334;&#20998;&#21495;&#21253;&#22260;&#30340;&#25991;&#26412;(&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ordered_warranty&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; )&#26159; &lt;em&gt;&#27169;&#26495;&#26631;&#31614;(template tag)&lt;/em&gt; &#12290;&#26631;&#31614;(tag)&#23450;&#20041;&#27604;&#36739;&#26126;&#30830;&#65292;&#21363;&#65306; &#20165;&#36890;&#30693;&#27169;&#26495;&#31995;&#32479;&#23436;&#25104;&#26576;&#20123;&#24037;&#20316;&#30340;&#26631;&#31614;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#20013;&#30340;&#27169;&#26495;&#21253;&#21547;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt;&lt;/tt&gt;&#26631;&#31614;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;item_list&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#65289;&#21644;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt;&lt;/tt&gt;  &#26631;&#31614;&#65288;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ordered_warranty&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;for&#26631;&#31614;&#31867;&#20284;Python&#30340;for&#35821;&#21477;&#65292;&#21487;&#35753;&#20320;&#24490;&#29615;&#35775;&#38382;&#24207;&#21015;&#37324;&#30340;&#27599;&#19968;&#20010;&#39033;&#30446;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#65292;&#27491;&#22914;&#20320;&#25152;&#26009;&#65292;&#26159;&#29992;&#26469;&#25191;&#34892;&#36923;&#36753;&#21028;&#26029;&#30340;&#12290; &#22312;&#36825;&#37324;&#65292;tag&#26631;&#31614;&#26816;&#26597;ordered_warranty&#20540;&#26159;&#21542;&#20026;True&#12290;&#22914;&#26524;&#26159;&#65292;&#27169;&#26495;&#31995;&#32479;&#23558;&#26174;&#31034;{% if ordered_warranty %}&#21644;{%
else %}&#20043;&#38388;&#30340;&#20869;&#23481;&#65307;&#21542;&#21017;&#23558;&#26174;&#31034;{% else
%}&#21644;{% endif %}&#20043;&#38388;&#30340;&#20869;&#23481;&#12290;{% else %}&#26159;&#21487;&#36873;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#26368;&#21518;&#65292;&#36825;&#20010;&#27169;&#26495;&#30340;&#31532;&#20108;&#27573;&#20013;&#26377;&#19968;&#20010;&#20851;&#20110;&lt;em&gt;filter&lt;/em&gt;&#36807;&#28388;&#22120;&#30340;&#20363;&#23376;&#65292;&#23427;&#26159;&#19968;&#31181;&#26368;&#20415;&#25463;&#30340;&#36716;&#25442;&#21464;&#37327;&#36755;&#20986;&#26684;&#24335;&#30340;&#26041;&#24335;&#12290; &#22914;&#36825;&#20010;&#20363;&#23376;&#20013;&#30340;{{ship_date|date:&#8221;F j, Y&#8221; }}&#65292;&#25105;&#20204;&#23558;&#21464;&#37327;ship_date&#20256;&#36882;&#32473;date&#36807;&#28388;&#22120;&#65292;&#21516;&#26102;&#25351;&#23450;&#21442;&#25968;&#8221;F j,Y&#8221;&#12290;date&#36807;&#28388;&#22120;&#26681;&#25454;&#21442;&#25968;&#36827;&#34892;&#26684;&#24335;&#36755;&#20986;&#12290; &#36807;&#28388;&#22120;&#26159;&#29992;&#31649;&#36947;&#31526;(|)&#26469;&#35843;&#29992;&#30340;&#65292;&#20855;&#20307;&#21487;&#20197;&#21442;&#35265;Unix&#31649;&#36947;&#31526;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;Django &#27169;&#26495;&#21547;&#26377;&#24456;&#22810;&#20869;&#32622;&#30340;tags&#21644;filters,&#25105;&#20204;&#23558;&#38470;&#32493;&#36827;&#34892;&#23398;&#20064;. &#38468;&#24405;F&#21015;&#20986;&#20102;&#24456;&#22810;&#30340;tags&#21644;filters&#30340;&#21015;&#34920;,&#29087;&#24713;&#36825;&#20123;&#21015;&#34920;&#23545;&#20320;&#26469;&#35828;&#26159;&#20010;&#22909;&#24314;&#35758;. &#20320;&#20381;&#28982;&#21487;&#20197;&#21033;&#29992;&#23427;&#21019;&#24314;&#33258;&#24049;&#30340;tag&#21644;filters&#12290;&#36825;&#20123;&#25105;&#20204;&#22312;&#31532;9&#31456;&#20250;&#35762;&#21040;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn21&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#22914;&#20309;&#20351;&#29992;&#27169;&#26495;&#31995;&#32479;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&#35753;&#25105;&#20204;&#28145;&#20837;&#30740;&#31350;&#27169;&#26495;&#31995;&#32479;&#65292;&#20320;&#23558;&#20250;&#26126;&#30333;&#23427;&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#12290;&#20294;&#25105;&#20204;&#26242;&#19981;&#25171;&#31639;&#23558;&#23427;&#19982;&#20808;&#21069;&#21019;&#24314;&#30340;&#35270;&#22270;&#32467;&#21512;&#22312;&#19968;&#36215;&#65292;&#22240;&#20026;&#25105;&#20204;&#29616;&#22312;&#30340;&#30446;&#30340;&#26159;&#20102;&#35299;&#23427;&#26159;&#22914;&#20309;&#29420;&#31435;&#24037;&#20316;&#30340;&#12290; &#12290; &#65288;&#25442;&#35328;&#20043;&#65292; &#36890;&#24120;&#20320;&#20250;&#23558;&#27169;&#26495;&#21644;&#35270;&#22270;&#19968;&#36215;&#20351;&#29992;&#65292;&#20294;&#26159;&#25105;&#20204;&#21482;&#26159;&#24819;&#31361;&#20986;&#27169;&#26495;&#31995;&#32479;&#26159;&#19968;&#20010;Python&#24211;&#65292;&#20320;&#21487;&#20197;&#22312;&#20219;&#20309;&#22320;&#26041;&#20351;&#29992;&#23427;&#65292;&#32780;&#19981;&#20165;&#20165;&#26159;&#22312;Django&#35270;&#22270;&#20013;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#22312;Python&#20195;&#30721;&#20013;&#20351;&#29992;Django&#27169;&#26495;&#30340;&#26368;&#22522;&#26412;&#26041;&#24335;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn24&quot;&gt;&#21487;&#20197;&#29992;&#21407;&#22987;&#30340;&#27169;&#26495;&#20195;&#30721;&#23383;&#31526;&#20018;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292; Django&#21516;&#26679;&#25903;&#25345;&#29992;&#25351;&#23450;&#27169;&#26495;&#25991;&#20214;&#36335;&#24452;&#30340;&#26041;&#24335;&#26469;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn25&quot;&gt;&#35843;&#29992;&#27169;&#26495;&#23545;&#35937;&#30340;render&#26041;&#27861;&#65292;&#24182;&#19988;&#20256;&#20837;&#19968;&#22871;&#21464;&#37327;context&#12290;&#23427;&#23558;&#36820;&#22238;&#19968;&#20010;&#22522;&#20110;&#27169;&#26495;&#30340;&#23637;&#29616;&#23383;&#31526;&#20018;&#65292;&#27169;&#26495;&#20013;&#30340;&#21464;&#37327;&#21644;&#26631;&#31614;&#20250;&#34987;context&#20540;&#26367;&#25442;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&#20195;&#30721;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn28&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django import template
&amp;gt;&amp;gt;&amp;gt; t = template.Template(&apos;My name is {{ name }}.&apos;)
&amp;gt;&amp;gt;&amp;gt; c = template.Context({&apos;name&apos;: &apos;Adrian&apos;})
&amp;gt;&amp;gt;&amp;gt; print t.render(c)
My name is Adrian.
&amp;gt;&amp;gt;&amp;gt; c = template.Context({&apos;name&apos;: &apos;Fred&apos;})
&amp;gt;&amp;gt;&amp;gt; print t.render(c)
My name is Fred.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#20197;&#19979;&#37096;&#20998;&#36880;&#27493;&#30340;&#35814;&#32454;&#20171;&#32461;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn30&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#21019;&#24314;&#27169;&#26495;&#23545;&#35937;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#26368;&#31616;&#21333;&#30340;&#26041;&#27861;&#23601;&#26159;&#30452;&#25509;&#23454;&#20363;&#21270;&#23427;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#31867;&#23601;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#20013;&#65292;&#26500;&#36896;&#20989;&#25968;&#25509;&#21463;&#19968;&#20010;&#21442;&#25968;&#65292;&#21407;&#22987;&#27169;&#26495;&#20195;&#30721;&#12290; &#35753;&#25105;&#20204;&#28145;&#20837;&#25366;&#25496;&#19968;&#19979; Python&#30340;&#35299;&#37322;&#22120;&#30475;&#30475;&#23427;&#26159;&#24590;&#20040;&#24037;&#20316;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#36716;&#21040;project&#30446;&#24405;&#65288;&#22312;&#31532;&#20108;&#31456;&#30001; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#21019;&#24314;&#65289;&#65292; &#36755;&#20837;&#21629;&#20196; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;shell&lt;/span&gt;&lt;/tt&gt; &#21551;&#21160;&#20132;&#20114;&#30028;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#19968;&#20010;&#29305;&#27530;&#30340;Python&#25552;&#31034;&#31526;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#22914;&#26524;&#20320;&#26366;&#32463;&#20351;&#29992;&#36807;Python&#65292;&#20320;&#19968;&#23450;&#22909;&#22855;&#65292;&#20026;&#20160;&#20040;&#25105;&#20204;&#36816;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt;
&lt;span class=&quot;pre&quot;&gt;shell&lt;/span&gt;&lt;/tt&gt;&#32780;&#19981;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt;&lt;/tt&gt;&#12290;&#36825;&#20004;&#20010;&#21629;&#20196;&#37117;&#20250;&#21551;&#21160;&#20132;&#20114;&#35299;&#37322;&#22120;&#65292;&#20294;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;shell&lt;/span&gt;&lt;/tt&gt;&#21629;&#20196;&#26377;&#19968;&#20010;&#37325;&#35201;&#30340;&#19981;&#21516;&#65306; &#22312;&#21551;&#21160;&#35299;&#37322;&#22120;&#20043;&#21069;&#65292;&#23427;&#21578;&#35785;Django&#20351;&#29992;&#21738;&#20010;&#35774;&#32622;&#25991;&#20214;&#12290; Django&#26694;&#26550;&#30340;&#22823;&#37096;&#20998;&#23376;&#31995;&#32479;&#65292;&#21253;&#25324;&#27169;&#26495;&#31995;&#32479;&#65292;&#37117;&#20381;&#36182;&#20110;&#37197;&#32622;&#25991;&#20214;&#65307;&#22914;&#26524;Django&#19981;&#30693;&#36947;&#20351;&#29992;&#21738;&#20010;&#37197;&#32622;&#25991;&#20214;&#65292;&#36825;&#20123;&#31995;&#32479;&#23558;&#19981;&#33021;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#22914;&#26524;&#20320;&#24819;&#30693;&#36947;&#65292;&#36825;&#37324;&#23558;&#21521;&#20320;&#35299;&#37322;&#23427;&#32972;&#21518;&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#12290; Django&#25628;&#32034;DJANGO_SETTINGS_MODULE&#29615;&#22659;&#21464;&#37327;&#65292;&#23427;&#34987;&#35774;&#32622;&#22312;settings.py&#20013;&#12290;&#20363;&#22914;&#65292;&#20551;&#35774;mysite&#22312;&#20320;&#30340;Python&#25628;&#32034;&#36335;&#24452;&#20013;&#65292;&#37027;&#20040;DJANGO_SETTINGS_MODULE&#24212;&#35813;&#34987;&#35774;&#32622;&#20026;&#65306;&#8217;mysite.settings&#8217;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&#24403;&#20320;&#36816;&#34892;&#21629;&#20196;&#65306;python manage.py shell&#65292;&#23427;&#23558;&#33258;&#21160;&#24110;&#20320;&#22788;&#29702;DJANGO_SETTINGS_MODULE&#12290; &#22312;&#24403;&#21069;&#30340;&#36825;&#20123;&#31034;&#20363;&#20013;&#65292;&#25105;&#20204;&#40723;&#21169;&#20320;&#20351;&#29992;`` python manage.py
shell``&#36825;&#20010;&#26041;&#27861;&#65292;&#36825;&#26679;&#21487;&#20197;&#20813;&#21435;&#20320;&#22823;&#36153;&#21608;&#31456;&#22320;&#21435;&#37197;&#32622;&#37027;&#20123;&#20320;&#19981;&#29087;&#24713;&#30340;&#29615;&#22659;&#21464;&#37327;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#38543;&#30528;&#20320;&#36234;&#26469;&#36234;&#29087;&#24713;Django&#65292;&#20320;&#21487;&#33021;&#20250;&#20559;&#21521;&#20110;&#24223;&#24323;&#20351;&#29992;`` manage.py shell``
&#65292;&#32780;&#26159;&#22312;&#20320;&#30340;&#37197;&#32622;&#25991;&#20214;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.bash_profile&lt;/span&gt;&lt;/tt&gt;&#20013;&#25163;&#21160;&#28155;&#21152; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DJANGO_SETTINGS_MODULE&lt;/span&gt;&lt;/tt&gt;&#36825;&#20010;&#29615;&#22659;&#21464;&#37327;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#35753;&#25105;&#20204;&#26469;&#20102;&#35299;&#19968;&#20123;&#27169;&#26495;&#31995;&#32479;&#30340;&#22522;&#26412;&#30693;&#35782;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn40&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;My name is {{ name }}.&apos;)
&amp;gt;&amp;gt;&amp;gt; print t
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#22914;&#26524;&#20320;&#36319;&#25105;&#20204;&#19968;&#36215;&#20570;&#65292;&#20320;&#23558;&#20250;&#30475;&#21040;&#19979;&#38754;&#30340;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn43&quot;&gt;&amp;lt;django.template.Template object at 0xb7d5f24c&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;0xb7d5f24c&lt;/span&gt;&lt;/tt&gt; &#27599;&#27425;&#37117;&#20250;&#19981;&#19968;&#26679;&#65292;&#36825;&#27809;&#20160;&#20040;&#20851;&#31995;&#65307;&#36825;&#21482;&#26159;Python&#36816;&#34892;&#26102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#30340;ID&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#24403;&#20320;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#27169;&#26495;&#31995;&#32479;&#22312;&#20869;&#37096;&#32534;&#35793;&#36825;&#20010;&#27169;&#26495;&#21040;&#20869;&#37096;&#26684;&#24335;&#65292;&#24182;&#20570;&#20248;&#21270;&#65292;&#20570;&#22909; &#28210;&#26579;&#30340;&#20934;&#22791;&#12290; &#22914;&#26524;&#20320;&#30340;&#27169;&#26495;&#35821;&#27861;&#26377;&#38169;&#35823;&#65292;&#37027;&#20040;&#22312;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template()&lt;/span&gt;&lt;/tt&gt; &#26102;&#23601;&#20250;&#25243;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TemplateSyntaxError&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn47&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;{% notatag %}&apos;)
Traceback (most recent call last):
  File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1, in ?
  ...
django.template.TemplateSyntaxError: Invalid block tag: &apos;notatag&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#36825;&#37324;&#65292;&#22359;&#26631;&#31614;(block tag)&#25351;&#21521;&#30340;&#26159;`` {% notatag %}``&#65292;&#22359;&#26631;&#31614;&#19982;&#27169;&#26495;&#26631;&#31614;&#26159;&#21516;&#20041;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#31995;&#32479;&#20250;&#22312;&#19979;&#38754;&#30340;&#24773;&#24418;&#25243;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TemplateSyntaxError&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn50&quot;&gt;&#26080;&#25928;&#30340;tags&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn51&quot;&gt;&#26631;&#31614;&#30340;&#21442;&#25968;&#26080;&#25928;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn52&quot;&gt;&#26080;&#25928;&#30340;&#36807;&#28388;&#22120;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn53&quot;&gt;&#36807;&#28388;&#22120;&#30340;&#21442;&#25968;&#26080;&#25928;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn54&quot;&gt;&#26080;&#25928;&#30340;&#27169;&#26495;&#35821;&#27861;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn55&quot;&gt;&#26410;&#23553;&#38381;&#30340;&#22359;&#26631;&#31614; &#65288;&#38024;&#23545;&#38656;&#35201;&#23553;&#38381;&#30340;&#22359;&#26631;&#31614;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn56&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#27169;&#26495;&#28210;&#26579;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#19968;&#26086;&#20320;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#20320;&#21487;&#20197;&#29992; &lt;em&gt;context&lt;/em&gt; &#26469;&#20256;&#36882;&#25968;&#25454;&#32473;&#23427;&#12290; &#19968;&#20010;context&#26159;&#19968;&#31995;&#21015;&#21464;&#37327;&#21644;&#23427;&#20204;&#20540;&#30340;&#38598;&#21512;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn58&quot;&gt;context&#22312;Django&#37324;&#34920;&#29616;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#31867;&#65292;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#37324;&#12290; &#22905;&#30340;&#26500;&#36896;&#20989;&#25968;&#24102;&#26377;&#19968;&#20010;&#21487;&#36873;&#30340;&#21442;&#25968;&#65306; &#19968;&#20010;&#23383;&#20856;&#26144;&#23556;&#21464;&#37327;&#21644;&#23427;&#20204;&#30340;&#20540;&#12290; &#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937; &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#24182;&#20256;&#36882;context&#26469;&#22635;&#20805;&#27169;&#26495;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn60&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Context, Template
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;My name is {{ name }}.&apos;)
&amp;gt;&amp;gt;&amp;gt; c = Context({&apos;name&apos;: &apos;Stephane&apos;})
&amp;gt;&amp;gt;&amp;gt; t.render(c)
u&apos;My name is Stephane.&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&#25105;&#20204;&#24517;&#39035;&#25351;&#20986;&#30340;&#19968;&#28857;&#26159;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;t.render(c)&lt;/span&gt;&lt;/tt&gt;&#36820;&#22238;&#30340;&#20540;&#26159;&#19968;&#20010;Unicode&#23545;&#35937;&#65292;&#19981;&#26159;&#26222;&#36890;&#30340;Python&#23383;&#31526;&#20018;&#12290; &#20320;&#21487;&#20197;&#36890;&#36807;&#23383;&#31526;&#20018;&#21069;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;u&lt;/span&gt;&lt;/tt&gt;&#26469;&#21306;&#20998;&#12290; &#22312;&#26694;&#26550;&#20013;&#65292;Django&#20250;&#19968;&#30452;&#20351;&#29992;Unicode&#23545;&#35937;&#32780;&#19981;&#26159;&#26222;&#36890;&#30340;&#23383;&#31526;&#20018;&#12290; &#22914;&#26524;&#20320;&#26126;&#30333;&#36825;&#26679;&#20570;&#32473;&#20320;&#24102;&#26469;&#20102;&#22810;&#22823;&#20415;&#21033;&#30340;&#35805;&#65292;&#23613;&#21487;&#33021;&#22320;&#24863;&#28608;Django&#22312;&#24149;&#21518;&#26377;&#26465;&#19981;&#32010;&#22320;&#20026;&#20320;&#25152;&#20570;&#36825;&#36825;&#20040;&#22810;&#24037;&#20316;&#21543;&#12290; &#22914;&#26524;&#19981;&#26126;&#30333;&#20320;&#20174;&#20013;&#33719;&#30410;&#20102;&#20160;&#20040;&#65292;&#21035;&#25285;&#24515;&#12290;&#20320;&#21482;&#38656;&#35201;&#30693;&#36947;Django&#23545;Unicode&#30340;&#25903;&#25345;&#65292;&#23558;&#35753;&#20320;&#30340;&#24212;&#29992;&#31243;&#24207;&#36731;&#26494;&#22320;&#22788;&#29702;&#21508;&#24335;&#21508;&#26679;&#30340;&#23383;&#31526;&#38598;&#65292;&#32780;&#19981;&#20165;&#20165;&#26159;&#22522;&#26412;&#30340;A-Z&#33521;&#25991;&#23383;&#31526;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#23383;&#20856;&#21644;Contexts&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;Python&#30340;&#23383;&#20856;&#25968;&#25454;&#31867;&#22411;&#23601;&#26159;&#20851;&#38190;&#23383;&#21644;&#23427;&#20204;&#20540;&#30340;&#19968;&#20010;&#26144;&#23556;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#21644;&#23383;&#20856;&#24456;&#31867;&#20284;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#36824;&#25552;&#20379;&#26356;&#22810;&#30340;&#21151;&#33021;&#65292;&#35831;&#30475;&#31532;&#20061;&#31456;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#21464;&#37327;&#21517;&#24517;&#39035;&#30001;&#33521;&#25991;&#23383;&#31526;&#24320;&#22987; &#65288;A-Z&#25110;a-z&#65289;&#24182;&#21487;&#20197;&#21253;&#21547;&#25968;&#23383;&#23383;&#31526;&#12289;&#19979;&#21010;&#32447;&#21644;&#23567;&#25968;&#28857;&#12290; &#65288;&#23567;&#25968;&#28857;&#22312;&#36825;&#37324;&#26377;&#29305;&#21035;&#30340;&#29992;&#36884;&#65292;&#31245;&#21518;&#25105;&#20204;&#20250;&#35762;&#21040;&#65289;&#21464;&#37327;&#26159;&#22823;&#23567;&#20889;&#25935;&#24863;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#19979;&#38754;&#26159;&#32534;&#20889;&#27169;&#26495;&#24182;&#28210;&#26579;&#30340;&#31034;&#20363;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn67&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template, Context
&amp;gt;&amp;gt;&amp;gt; raw_template = &quot;&quot;&quot;&amp;lt;p&amp;gt;Dear {{ person_name }},&amp;lt;/p&amp;gt;
...
... &amp;lt;p&amp;gt;Thanks for placing an order from {{ company }}. It&apos;s scheduled to
... ship on {{ ship_date|date:&quot;F j, Y&quot; }}.&amp;lt;/p&amp;gt;
...
... {% if ordered_warranty %}
... &amp;lt;p&amp;gt;Your warranty information will be included in the packaging.&amp;lt;/p&amp;gt;
... {% else %}
... &amp;lt;p&amp;gt;You didn&apos;t order a warranty, so you&apos;re on your own when
... the products inevitably stop working.&amp;lt;/p&amp;gt;
... {% endif %}
...
... &amp;lt;p&amp;gt;Sincerely,&amp;lt;br /&amp;gt;{{ company }}&amp;lt;/p&amp;gt;&quot;&quot;&quot;
&amp;gt;&amp;gt;&amp;gt; t = Template(raw_template)
&amp;gt;&amp;gt;&amp;gt; import datetime
&amp;gt;&amp;gt;&amp;gt; c = Context({&apos;person_name&apos;: &apos;John Smith&apos;,
...     &apos;company&apos;: &apos;Outdoor Equipment&apos;,
...     &apos;ship_date&apos;: datetime.date(2009, 4, 2),
...     &apos;ordered_warranty&apos;: False})
&amp;gt;&amp;gt;&amp;gt; t.render(c)
u&quot;&amp;lt;p&amp;gt;Dear John Smith,&amp;lt;/p&amp;gt;\n\n&amp;lt;p&amp;gt;Thanks for placing an order from Outdoor
Equipment. It&apos;s scheduled to\nship on April 2, 2009.&amp;lt;/p&amp;gt;\n\n\n&amp;lt;p&amp;gt;You
didn&apos;t order a warranty, so you&apos;re on your own when\nthe products
inevitably stop working.&amp;lt;/p&amp;gt;\n\n\n&amp;lt;p&amp;gt;Sincerely,&amp;lt;br /&amp;gt;Outdoor Equipment
&amp;lt;/p&amp;gt;&quot;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#35753;&#25105;&#20204;&#36880;&#27493;&#26469;&#20998;&#26512;&#19979;&#36825;&#27573;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#39318;&#20808;&#25105;&#20204;&#23548;&#20837; &#65288;import&#65289;&#31867; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#65292;&#23427;&#20204;&#37117;&#22312;&#27169;&#22359; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template&lt;/span&gt;&lt;/tt&gt; &#37324;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#25105;&#20204;&#25226;&#27169;&#26495;&#21407;&#22987;&#25991;&#26412;&#20445;&#23384;&#21040;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;raw_template&lt;/span&gt;&lt;/tt&gt; &#12290;&#27880;&#24847;&#21040;&#25105;&#20204;&#20351;&#29992;&#20102;&#19977;&#20010;&#24341;&#21495;&#26469; &#26631;&#35782;&#36825;&#20123;&#25991;&#26412;&#65292;&#22240;&#20026;&#36825;&#26679;&#21487;&#20197;&#21253;&#21547;&#22810;&#34892;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#25105;&#20204;&#21019;&#24314;&#20102;&#19968;&#20010;&#27169;&#26495;&#23545;&#35937; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;t&lt;/span&gt;&lt;/tt&gt; &#65292;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;raw_template&lt;/span&gt;&lt;/tt&gt; &#20316;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#31867;&#26500;&#36896;&#20989;&#25968;&#30340;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&#25105;&#20204;&#20174;Python&#30340;&#26631;&#20934;&#24211;&#23548;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#65292;&#20197;&#21518;&#25105;&#20204;&#23558;&#20250;&#20351;&#29992;&#23427;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&#28982;&#21518;&#65292;&#25105;&#20204;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;c&lt;/span&gt;&lt;/tt&gt; &#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#26500;&#36896;&#30340;&#21442;&#25968;&#26159;Python &#23383;&#20856;&#25968;&#25454;&#31867;&#22411;&#12290; &#22312;&#36825;&#37324;&#65292;&#25105;&#20204;&#25351;&#23450;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;person_name&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;John&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Smith&apos;&lt;/span&gt;&lt;/tt&gt; , &#21442;&#25968;company &#30340;&#20540;&#20026; &#8216;Outdoor
Equipment&#8217; &#65292;&#31561;&#31561;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#26368;&#21518;&#65292;&#25105;&#20204;&#22312;&#27169;&#26495;&#23545;&#35937;&#19978;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#65292;&#20256;&#36882; context&#21442;&#25968;&#32473;&#23427;&#12290; &#36825;&#26159;&#36820;&#22238;&#28210;&#26579;&#21518;&#30340;&#27169;&#26495;&#30340;&#26041;&#27861;&#65292;&#23427;&#20250;&#26367;&#25442;&#27169;&#26495;&#21464;&#37327;&#20026;&#30495;&#23454;&#30340;&#20540;&#21644;&#25191;&#34892;&#22359;&#26631;&#31614;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#27880;&#24847;&#65292;warranty paragraph&#26174;&#31034;&#26159;&#22240;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ordered_warranty&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; . &#27880;&#24847;&#26102;&#38388;&#30340;&#26174;&#31034;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;April&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;2,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;2009&lt;/span&gt;&lt;/tt&gt; , &#23427;&#26159;&#25353; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;F&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;j,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Y&apos;&lt;/span&gt;&lt;/tt&gt; &#26684;&#24335;&#26174;&#31034;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#22914;&#26524;&#20320;&#26159;Python&#21021;&#23398;&#32773;&#65292;&#20320;&#21487;&#33021;&#22312;&#24819;&#20026;&#20160;&#20040;&#36755;&#20986;&#37324;&#26377;&#22238;&#36710;&#25442;&#34892;&#30340;&#23383;&#31526;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;\n&apos;&lt;/span&gt;&lt;/tt&gt; )&#32780;&#19981;&#26159; &#26174;&#31034;&#22238;&#36710;&#25442;&#34892;&#65311; &#22240;&#20026;&#36825;&#26159;Python&#20132;&#20114;&#35299;&#37322;&#22120;&#30340;&#32536;&#25925;&#65306; &#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;t.render(c)&lt;/span&gt;&lt;/tt&gt; &#36820;&#22238;&#23383;&#31526;&#20018;&#65292; &#35299;&#37322;&#22120;&#32570;&#30465;&#26174;&#31034;&#36825;&#20123;&#23383;&#31526;&#20018;&#30340; &lt;em&gt;&#30495;&#23454;&#20869;&#23481;&#21576;&#29616;&lt;/em&gt; &#65292;&#32780;&#19981;&#26159;&#25171;&#21360;&#36825;&#20010;&#21464;&#37327;&#30340;&#20540;&#12290; &#35201;&#26174;&#31034;&#25442;&#34892;&#32780;&#19981;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;\n&apos;&lt;/span&gt;&lt;/tt&gt; &#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;print&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;t.render(c)&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#36825;&#23601;&#26159;&#20351;&#29992;Django&#27169;&#26495;&#31995;&#32479;&#30340;&#22522;&#26412;&#35268;&#21017;&#65306; &#20889;&#27169;&#26495;&#65292;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#65292; &#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn78&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#21516;&#19968;&#27169;&#26495;&#65292;&#22810;&#20010;&#19978;&#19979;&#25991;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&#19968;&#26086;&#26377;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#27169;&#26495;&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#20320;&#23601;&#21487;&#20197;&#36890;&#36807;&#23427;&#28210;&#26579;&#22810;&#20010;context&#65292; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn81&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template, Context
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;Hello, {{ name }}&apos;)
&amp;gt;&amp;gt;&amp;gt; print t.render(Context({&apos;name&apos;: &apos;John&apos;}))
Hello, John
&amp;gt;&amp;gt;&amp;gt; print t.render(Context({&apos;name&apos;: &apos;Julie&apos;}))
Hello, Julie
&amp;gt;&amp;gt;&amp;gt; print t.render(Context({&apos;name&apos;: &apos;Pat&apos;}))
Hello, Pat
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&#26080;&#35770;&#20309;&#26102;&#25105;&#20204;&#37117;&#21487;&#20197;&#20687;&#36825;&#26679;&#20351;&#29992;&#21516;&#19968;&#27169;&#26495;&#28304;&#28210;&#26579;&#22810;&#20010;context&#65292;&#21482;&#36827;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#19968;&#27425;&lt;/span&gt;&lt;/tt&gt;&#27169;&#26495;&#21019;&#24314;&#28982;&#21518;&#22810;&#27425;&#35843;&#29992;render()&#26041;&#27861;&#28210;&#26579;&#20250;&#26356;&#20026;&#39640;&#25928;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn84&quot;&gt;# Bad
for name in (&apos;John&apos;, &apos;Julie&apos;, &apos;Pat&apos;):
    t = Template(&apos;Hello, {{ name }}&apos;)
    print t.render(Context({&apos;name&apos;: name}))

# Good
t = Template(&apos;Hello, {{ name }}&apos;)
for name in (&apos;John&apos;, &apos;Julie&apos;, &apos;Pat&apos;):
    print t.render(Context({&apos;name&apos;: name}))
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;Django &#27169;&#26495;&#35299;&#26512;&#38750;&#24120;&#24555;&#25463;&#12290; &#22823;&#37096;&#20998;&#30340;&#35299;&#26512;&#24037;&#20316;&#37117;&#26159;&#22312;&#21518;&#21488;&#36890;&#36807;&#23545;&#31616;&#30701;&#27491;&#21017;&#34920;&#36798;&#24335;&#19968;&#27425;&#24615;&#35843;&#29992;&#26469;&#23436;&#25104;&#12290; &#36825;&#21644;&#22522;&#20110; XML &#30340;&#27169;&#26495;&#24341;&#25806;&#24418;&#25104;&#40092;&#26126;&#23545;&#27604;&#65292;&#37027;&#20123;&#24341;&#25806;&#25215;&#25285;&#20102; XML &#35299;&#26512;&#22120;&#30340;&#24320;&#38144;&#65292;&#19988;&#24448;&#24448;&#27604; Django &#27169;&#26495;&#28210;&#26579;&#24341;&#25806;&#35201;&#24930;&#19978;&#20960;&#20010;&#25968;&#37327;&#32423;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn86&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#28145;&#24230;&#21464;&#37327;&#30340;&#26597;&#25214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#22312;&#21040;&#30446;&#21069;&#20026;&#27490;&#30340;&#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#36890;&#36807; context &#20256;&#36882;&#30340;&#31616;&#21333;&#21442;&#25968;&#20540;&#20027;&#35201;&#26159;&#23383;&#31526;&#20018;&#65292;&#36824;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime.date&lt;/span&gt;&lt;/tt&gt; &#33539;&#20363;&#12290; &#28982;&#32780;&#65292;&#27169;&#26495;&#31995;&#32479;&#33021;&#22815;&#38750;&#24120;&#31616;&#27905;&#22320;&#22788;&#29702;&#26356;&#21152;&#22797;&#26434;&#30340;&#25968;&#25454;&#32467;&#26500;&#65292;&#20363;&#22914;list&#12289;dictionary&#21644;&#33258;&#23450;&#20041;&#30340;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#22312; Django &#27169;&#26495;&#20013;&#36941;&#21382;&#22797;&#26434;&#25968;&#25454;&#32467;&#26500;&#30340;&#20851;&#38190;&#26159;&#21477;&#28857;&#23383;&#31526; (&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.&lt;/span&gt;&lt;/tt&gt;)&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#26368;&#22909;&#26159;&#29992;&#20960;&#20010;&#20363;&#23376;&#26469;&#35828;&#26126;&#19968;&#19979;&#12290; &#27604;&#22914;&#65292;&#20551;&#35774;&#20320;&#35201;&#21521;&#27169;&#26495;&#20256;&#36882;&#19968;&#20010; Python &#23383;&#20856;&#12290; &#35201;&#36890;&#36807;&#23383;&#20856;&#38190;&#35775;&#38382;&#35813;&#23383;&#20856;&#30340;&#20540;&#65292;&#21487;&#20351;&#29992;&#19968;&#20010;&#21477;&#28857;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn91&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template, Context
&amp;gt;&amp;gt;&amp;gt; person = {&apos;name&apos;: &apos;Sally&apos;, &apos;age&apos;: &apos;43&apos;}
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;{{ person.name }} is {{ person.age }} years old.&apos;)
&amp;gt;&amp;gt;&amp;gt; c = Context({&apos;person&apos;: person})
&amp;gt;&amp;gt;&amp;gt; t.render(c)
u&apos;Sally is 43 years old.&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#21516;&#26679;&#65292;&#20063;&#21487;&#20197;&#36890;&#36807;&#21477;&#28857;&#26469;&#35775;&#38382;&#23545;&#35937;&#30340;&#23646;&#24615;&#12290; &#27604;&#26041;&#35828;&#65292; Python &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime.date&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;year&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;month&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;day&lt;/span&gt;&lt;/tt&gt; &#20960;&#20010;&#23646;&#24615;&#65292;&#20320;&#21516;&#26679;&#21487;&#20197;&#22312;&#27169;&#26495;&#20013;&#20351;&#29992;&#21477;&#28857;&#26469;&#35775;&#38382;&#36825;&#20123;&#23646;&#24615;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn94&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template, Context
&amp;gt;&amp;gt;&amp;gt; import datetime
&amp;gt;&amp;gt;&amp;gt; d = datetime.date(1993, 5, 2)
&amp;gt;&amp;gt;&amp;gt; d.year
1993
&amp;gt;&amp;gt;&amp;gt; d.month
5
&amp;gt;&amp;gt;&amp;gt; d.day
2
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;The month is {{ date.month }} and the year is {{ date.year }}.&apos;)
&amp;gt;&amp;gt;&amp;gt; c = Context({&apos;date&apos;: d})
&amp;gt;&amp;gt;&amp;gt; t.render(c)
u&apos;The month is 5 and the year is 1993.&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#20351;&#29992;&#20102;&#19968;&#20010;&#33258;&#23450;&#20041;&#30340;&#31867;&#65292;&#28436;&#31034;&#20102;&#36890;&#36807;&#23454;&#20363;&#21464;&#37327;&#21152;&#19968;&#28857;(dots)&#26469;&#35775;&#38382;&#23427;&#30340;&#23646;&#24615;&#65292;&#36825;&#20010;&#26041;&#27861;&#36866;&#29992;&#20110;&#20219;&#24847;&#30340;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn97&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template, Context
&amp;gt;&amp;gt;&amp;gt; class Person(object):
...     def __init__(self, first_name, last_name):
...         self.first_name, self.last_name = first_name, last_name
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;Hello, {{ person.first_name }} {{ person.last_name }}.&apos;)
&amp;gt;&amp;gt;&amp;gt; c = Context({&apos;person&apos;: Person(&apos;John&apos;, &apos;Smith&apos;)})
&amp;gt;&amp;gt;&amp;gt; t.render(c)
u&apos;Hello, John Smith.&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#28857;&#35821;&#27861;&#20063;&#21487;&#20197;&#29992;&#26469;&#24341;&#29992;&#23545;&#35937;&#30340;* &#26041;&#27861;*&#12290; &#20363;&#22914;&#65292;&#27599;&#20010; Python &#23383;&#31526;&#20018;&#37117;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;upper()&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;isdigit()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#65292;&#20320;&#22312;&#27169;&#26495;&#20013;&#21487;&#20197;&#20351;&#29992;&#21516;&#26679;&#30340;&#21477;&#28857;&#35821;&#27861;&#26469;&#35843;&#29992;&#23427;&#20204;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn100&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template, Context
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;{{ var }} -- {{ var.upper }} -- {{ var.isdigit }}&apos;)
&amp;gt;&amp;gt;&amp;gt; t.render(Context({&apos;var&apos;: &apos;hello&apos;}))
u&apos;hello -- HELLO -- False&apos;
&amp;gt;&amp;gt;&amp;gt; t.render(Context({&apos;var&apos;: &apos;123&apos;}))
u&apos;123 -- 123 -- True&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&#27880;&#24847;&#36825;&#37324;&#35843;&#29992;&#26041;&#27861;&#26102;&#24182;* &#27809;&#26377;* &#20351;&#29992;&#22278;&#25324;&#21495; &#32780;&#19988;&#20063;&#26080;&#27861;&#32473;&#35813;&#26041;&#27861;&#20256;&#36882;&#21442;&#25968;&#65307;&#20320;&#21482;&#33021;&#35843;&#29992;&#19981;&#38656;&#21442;&#25968;&#30340;&#26041;&#27861;&#12290; &#65288;&#25105;&#20204;&#23558;&#22312;&#26412;&#31456;&#31245;&#21518;&#37096;&#20998;&#35299;&#37322;&#35813;&#35774;&#35745;&#35266;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn102&quot;&gt;&#26368;&#21518;&#65292;&#21477;&#28857;&#20063;&#21487;&#29992;&#20110;&#35775;&#38382;&#21015;&#34920;&#32034;&#24341;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn104&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template, Context
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;Item 2 is {{ items.2 }}.&apos;)
&amp;gt;&amp;gt;&amp;gt; c = Context({&apos;items&apos;: [&apos;apples&apos;, &apos;bananas&apos;, &apos;carrots&apos;]})
&amp;gt;&amp;gt;&amp;gt; t.render(c)
u&apos;Item 2 is carrots.&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&#19981;&#20801;&#35768;&#20351;&#29992;&#36127;&#25968;&#21015;&#34920;&#32034;&#24341;&#12290; &#20687; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;items.-1&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#36825;&#26679;&#30340;&#27169;&#26495;&#21464;&#37327;&#23558;&#20250;&#24341;&#21457;`` TemplateSyntaxError``&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;Python &#21015;&#34920;&#31867;&#22411;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#19968;&#28857;&#25552;&#31034;&#65306; Python&#30340;&#21015;&#34920;&#26159;&#20174;0&#24320;&#22987;&#32034;&#24341;&#12290; &#31532;&#19968;&#39033;&#30340;&#32034;&#24341;&#26159;0&#65292;&#31532;&#20108;&#39033;&#30340;&#26159;1&#65292;&#20381;&#27492;&#31867;&#25512;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&#21477;&#28857;&#26597;&#25214;&#35268;&#21017;&#21487;&#27010;&#25324;&#20026;&#65306; &#24403;&#27169;&#26495;&#31995;&#32479;&#22312;&#21464;&#37327;&#21517;&#20013;&#36935;&#21040;&#28857;&#26102;&#65292;&#25353;&#29031;&#20197;&#19979;&#39034;&#24207;&#23581;&#35797;&#36827;&#34892;&#26597;&#25214;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn109&quot;&gt;&#23383;&#20856;&#31867;&#22411;&#26597;&#25214; &#65288;&#27604;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo[&quot;bar&quot;]&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn110&quot;&gt;&#23646;&#24615;&#26597;&#25214; (&#27604;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo.bar&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn111&quot;&gt;&#26041;&#27861;&#35843;&#29992; &#65288;&#27604;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo.bar()&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn112&quot;&gt;&#21015;&#34920;&#31867;&#22411;&#32034;&#24341;&#26597;&#25214; (&#27604;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo[bar]&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#31995;&#32479;&#20351;&#29992;&#25214;&#21040;&#30340;&#31532;&#19968;&#20010;&#26377;&#25928;&#31867;&#22411;&#12290; &#36825;&#26159;&#19968;&#31181;&#30701;&#36335;&#36923;&#36753;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#21477;&#28857;&#26597;&#25214;&#21487;&#20197;&#22810;&#32423;&#28145;&#24230;&#23884;&#22871;&#12290; &#20363;&#22914;&#22312;&#19979;&#38754;&#36825;&#20010;&#20363;&#23376;&#20013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{person.name.upper}}&lt;/span&gt;&lt;/tt&gt; &#20250;&#36716;&#25442;&#25104;&#23383;&#20856;&#31867;&#22411;&#26597;&#25214;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;person[&apos;name&apos;]&lt;/span&gt;&lt;/tt&gt; ) &#28982;&#21518;&#26159;&#26041;&#27861;&#35843;&#29992;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;upper()&lt;/span&gt;&lt;/tt&gt; ):&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn116&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template, Context
&amp;gt;&amp;gt;&amp;gt; person = {&apos;name&apos;: &apos;Sally&apos;, &apos;age&apos;: &apos;43&apos;}
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;{{ person.name.upper }} is {{ person.age }} years old.&apos;)
&amp;gt;&amp;gt;&amp;gt; c = Context({&apos;person&apos;: person})
&amp;gt;&amp;gt;&amp;gt; t.render(c)
u&apos;SALLY is 43 years old.&apos;
&lt;/pre&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn117&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&#26041;&#27861;&#35843;&#29992;&#34892;&#20026;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&#26041;&#27861;&#35843;&#29992;&#27604;&#20854;&#20182;&#31867;&#22411;&#30340;&#26597;&#25214;&#30053;&#20026;&#22797;&#26434;&#19968;&#28857;&#12290; &#20197;&#19979;&#26159;&#19968;&#20123;&#27880;&#24847;&#20107;&#39033;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#22312;&#26041;&#27861;&#26597;&#25214;&#36807;&#31243;&#20013;&#65292;&#22914;&#26524;&#26576;&#26041;&#27861;&#25243;&#20986;&#19968;&#20010;&#24322;&#24120;&#65292;&#38500;&#38750;&#35813;&#24322;&#24120;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;silent_variable_failure&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;&#24182;&#19988;&#20540;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#65292;&#21542;&#21017;&#30340;&#35805;&#23427;&#23558;&#34987;&#20256;&#25773;&#12290;&#22914;&#26524;&#24322;&#24120;&#34987;&#20256;&#25773;&#65292;&#27169;&#26495;&#37324;&#30340;&#25351;&#23450;&#21464;&#37327;&#20250;&#34987;&#32622;&#20026;&#31354;&#23383;&#31526;&#20018;&#65292;&#27604;&#22914;:&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn121&quot;&gt;&amp;gt;&amp;gt;&amp;gt; t = Template(&quot;My name is {{ person.first_name }}.&quot;)
&amp;gt;&amp;gt;&amp;gt; class PersonClass3:
...     def first_name(self):
...         raise AssertionError, &quot;foo&quot;
&amp;gt;&amp;gt;&amp;gt; p = PersonClass3()
&amp;gt;&amp;gt;&amp;gt; t.render(Context({&quot;person&quot;: p}))
Traceback (most recent call last):
...
AssertionError: foo

&amp;gt;&amp;gt;&amp;gt; class SilentAssertionError(AssertionError):
...     silent_variable_failure = True
&amp;gt;&amp;gt;&amp;gt; class PersonClass4:
...     def first_name(self):
...         raise SilentAssertionError
&amp;gt;&amp;gt;&amp;gt; p = PersonClass4()
&amp;gt;&amp;gt;&amp;gt; t.render(Context({&quot;person&quot;: p}))
u&apos;My name is .&apos;
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn122&quot;&gt;&#20165;&#22312;&#26041;&#27861;&#26080;&#38656;&#20256;&#20837;&#21442;&#25968;&#26102;&#65292;&#20854;&#35843;&#29992;&#25165;&#26377;&#25928;&#12290; &#21542;&#21017;&#65292;&#31995;&#32479;&#23558;&#20250;&#36716;&#31227;&#21040;&#19979;&#19968;&#20010;&#26597;&#25214;&#31867;&#22411;&#65288;&#21015;&#34920;&#32034;&#24341;&#26597;&#25214;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&#26174;&#28982;&#65292;&#26377;&#20123;&#26041;&#27861;&#26159;&#26377;&#21103;&#20316;&#29992;&#30340;&#65292;&#22909;&#30340;&#24773;&#20917;&#19979;&#20801;&#35768;&#27169;&#26495;&#31995;&#32479;&#35775;&#38382;&#23427;&#20204;&#21487;&#33021;&#21482;&#26159;&#24178;&#20214;&#34850;&#20107;&#65292;&#22351;&#30340;&#24773;&#20917;&#19979;&#29978;&#33267;&#20250;&#24341;&#21457;&#23433;&#20840;&#28431;&#27934;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#20363;&#22914;&#65292;&#20320;&#30340;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BankAccount&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;delete()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290;
&#22914;&#26524;&#26576;&#20010;&#27169;&#26495;&#20013;&#21253;&#21547;&#20102;&#20687; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;account.delete&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt;&#36825;&#26679;&#30340;&#26631;&#31614;&#65292;&#20854;&#20013;`` account`` &#21448;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BankAccount&lt;/span&gt;&lt;/tt&gt; &#30340;&#19968;&#20010;&#23454;&#20363;&#65292;&#35831;&#27880;&#24847;&#22312;&#36825;&#20010;&#27169;&#26495;&#36733;&#20837;&#26102;&#65292;account&#23545;&#35937;&#23558;&#34987;&#21024;&#38500;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#35201;&#38450;&#27490;&#36825;&#26679;&#30340;&#20107;&#24773;&#21457;&#29983;&#65292;&#24517;&#39035;&#35774;&#32622;&#35813;&#26041;&#27861;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;alters_data&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#23646;&#24615;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn127&quot;&gt;def delete(self):
    # Delete the account
delete.alters_data = True
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#27169;&#26495;&#31995;&#32479;&#19981;&#20250;&#25191;&#34892;&#20219;&#20309;&#20197;&#35813;&#26041;&#24335;&#36827;&#34892;&#26631;&#35760;&#30340;&#26041;&#27861;&#12290; &#25509;&#19978;&#38754;&#30340;&#20363;&#23376;&#65292;&#22914;&#26524;&#27169;&#26495;&#25991;&#20214;&#37324;&#21253;&#21547;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;account.delete&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#65292;&#23545;&#35937;&#21448;&#20855;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;delete()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#65292;&#32780;&#19988;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;delete()&lt;/span&gt;&lt;/tt&gt; &#26377;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;alters_data=True&lt;/span&gt;&lt;/tt&gt;&#36825;&#20010;&#23646;&#24615;&#65292;&#37027;&#20040;&#22312;&#27169;&#26495;&#36733;&#20837;&#26102;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;delete()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#23558;&#19981;&#20250;&#34987;&#25191;&#34892;&#12290; &#23427;&#23558;&#38745;&#38745;&#22320;&#38169;&#35823;&#36864;&#20986;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn129&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#22914;&#20309;&#22788;&#29702;&#26080;&#25928;&#21464;&#37327;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#40664;&#35748;&#24773;&#20917;&#19979;&#65292;&#22914;&#26524;&#19968;&#20010;&#21464;&#37327;&#19981;&#23384;&#22312;&#65292;&#27169;&#26495;&#31995;&#32479;&#20250;&#25226;&#23427;&#23637;&#31034;&#20026;&#31354;&#23383;&#31526;&#20018;&#65292;&#19981;&#20570;&#20219;&#20309;&#20107;&#24773;&#26469;&#34920;&#31034;&#22833;&#36133;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn132&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Template, Context
&amp;gt;&amp;gt;&amp;gt; t = Template(&apos;Your name is {{ name }}.&apos;)
&amp;gt;&amp;gt;&amp;gt; t.render(Context())
u&apos;Your name is .&apos;
&amp;gt;&amp;gt;&amp;gt; t.render(Context({&apos;var&apos;: &apos;hello&apos;}))
u&apos;Your name is .&apos;
&amp;gt;&amp;gt;&amp;gt; t.render(Context({&apos;NAME&apos;: &apos;hello&apos;}))
u&apos;Your name is .&apos;
&amp;gt;&amp;gt;&amp;gt; t.render(Context({&apos;Name&apos;: &apos;hello&apos;}))
u&apos;Your name is .&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#31995;&#32479;&#38745;&#24708;&#24708;&#22320;&#34920;&#31034;&#22833;&#36133;&#65292;&#32780;&#19981;&#26159;&#24341;&#21457;&#19968;&#20010;&#24322;&#24120;&#65292;&#22240;&#20026;&#36825;&#36890;&#24120;&#26159;&#20154;&#20026;&#38169;&#35823;&#36896;&#25104;&#30340;&#12290; &#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#22240;&#20026;&#21464;&#37327;&#21517;&#26377;&#38169;&#35823;&#30340;&#29366;&#20917;&#25110;&#21517;&#31216;&#65292; &#25152;&#26377;&#30340;&#26597;&#35810;&#37117;&#20250;&#22833;&#36133;&#12290; &#29616;&#23454;&#19990;&#30028;&#20013;&#65292;&#23545;&#20110;&#19968;&#20010;web&#31449;&#28857;&#26469;&#35828;&#65292;&#22914;&#26524;&#20165;&#20165;&#22240;&#20026;&#19968;&#20010;&#23567;&#30340;&#27169;&#26495;&#35821;&#27861;&#38169;&#35823;&#32780;&#36896;&#25104;&#26080;&#27861;&#35775;&#38382;&#65292;&#36825;&#26159;&#19981;&#21487;&#25509;&#21463;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;context&quot;&gt;
&lt;span id=&quot;cn134&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn134&quot;&gt;&#29609;&#19968;&#29609;&#19978;&#19979;&#25991;(context)&#23545;&#35937;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#22810;&#25968;&#26102;&#38388;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;&#20256;&#36882;&#19968;&#20010;&#23436;&#20840;&#22635;&#20805;(full populated)&#30340;&#23383;&#20856;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context()&lt;/span&gt;&lt;/tt&gt; &#26469;&#21021;&#22987;&#21270; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#19978;&#19979;&#25991;(Context)&lt;/span&gt;&lt;/tt&gt; &#12290; &#20294;&#26159;&#21021;&#22987;&#21270;&#20197;&#21518;&#65292;&#20320;&#20063;&#21487;&#20197;&#20351;&#29992;&#26631;&#20934;&#30340;Python&#23383;&#20856;&#35821;&#27861;(syntax)&#21521;``&#19978;&#19979;&#25991;(Context)`` &#23545;&#35937;&#28155;&#21152;&#25110;&#32773;&#21024;&#38500;&#26465;&#30446;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn137&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.template import Context
&amp;gt;&amp;gt;&amp;gt; c = Context({&quot;foo&quot;: &quot;bar&quot;})
&amp;gt;&amp;gt;&amp;gt; c[&apos;foo&apos;]
&apos;bar&apos;
&amp;gt;&amp;gt;&amp;gt; del c[&apos;foo&apos;]
&amp;gt;&amp;gt;&amp;gt; c[&apos;foo&apos;]
Traceback (most recent call last):
  ...
KeyError: &apos;foo&apos;
&amp;gt;&amp;gt;&amp;gt; c[&apos;newvariable&apos;] = &apos;hello&apos;
&amp;gt;&amp;gt;&amp;gt; c[&apos;newvariable&apos;]
&apos;hello&apos;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn138&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#22522;&#26412;&#30340;&#27169;&#26495;&#26631;&#31614;&#21644;&#36807;&#28388;&#22120;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&#20687;&#25105;&#20204;&#20197;&#21069;&#25552;&#21040;&#36807;&#30340;&#65292;&#27169;&#26495;&#31995;&#32479;&#24102;&#26377;&#20869;&#32622;&#30340;&#26631;&#31614;&#21644;&#36807;&#28388;&#22120;&#12290;
&#19979;&#38754;&#30340;&#31456;&#33410;&#25552;&#20379;&#20102;&#19968;&#20010;&#22810;&#25968;&#36890;&#29992;&#26631;&#31614;&#21644;&#36807;&#28388;&#22120;&#30340;&#31616;&#35201;&#35828;&#26126;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn140&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn140&quot;&gt;&#26631;&#31614;&lt;/h3&gt;
&lt;div class=&quot;section&quot; id=&quot;if-else&quot;&gt;
&lt;span id=&quot;cn141&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn141&quot;&gt;if/else&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#26816;&#26597;(evaluate)&#19968;&#20010;&#21464;&#37327;&#65292;&#22914;&#26524;&#36825;&#20010;&#21464;&#37327;&#20026;&#30495;&#65288;&#21363;&#65292;&#21464;&#37327;&#23384;&#22312;&#65292;&#38750;&#31354;&#65292;&#19981;&#26159;&#24067;&#23572;&#20540;&#20551;&#65289;&#65292;&#31995;&#32479;&#20250;&#26174;&#31034;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endif&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20043;&#38388;&#30340;&#20219;&#20309;&#20869;&#23481;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn144&quot;&gt;{% if today_is_weekend %}
    &amp;lt;p&amp;gt;Welcome to the weekend!&amp;lt;/p&amp;gt;
{% endif %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn145&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#26159;&#21487;&#36873;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn147&quot;&gt;{% if today_is_weekend %}
    &amp;lt;p&amp;gt;Welcome to the weekend!&amp;lt;/p&amp;gt;
{% else %}
    &amp;lt;p&amp;gt;Get back to work.&amp;lt;/p&amp;gt;
{% endif %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn148&quot;&gt;Python &#30340;&#8220;&#30495;&#20540;&#8221;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&#22312;Python&#21644;Django&#27169;&#26495;&#31995;&#32479;&#20013;&#65292;&#20197;&#19979;&#36825;&#20123;&#23545;&#35937;&#30456;&#24403;&#20110;&#24067;&#23572;&#20540;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn150&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn150&quot;&gt;&#31354;&#21015;&#34920;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;[]&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn151&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn151&quot;&gt;&#31354;&#20803;&#32452;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;()&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn152&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn152&quot;&gt;&#31354;&#23383;&#20856;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{}&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn153&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn153&quot;&gt;&#31354;&#23383;&#31526;&#20018;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn154&quot;&gt;&#38646;&#20540;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;0&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn155&quot;&gt;&#29305;&#27530;&#23545;&#35937;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn156&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn156&quot;&gt;&#23545;&#35937;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt;&#65288;&#24456;&#26126;&#26174;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn157&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn157&quot;&gt;&#25552;&#31034;&#65306;&#20320;&#20063;&#21487;&#20197;&#22312;&#33258;&#23450;&#20041;&#30340;&#23545;&#35937;&#37324;&#23450;&#20041;&#20182;&#20204;&#30340;&#24067;&#23572;&#20540;&#23646;&#24615;(&#36825;&#20010;&#26159;python&#30340;&#39640;&#32423;&#29992;&#27861;)&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn158&quot;&gt;&#38500;&#20197;&#19978;&#20960;&#28857;&#20197;&#22806;&#30340;&#25152;&#26377;&#19996;&#35199;&#37117;&#35270;&#20026;`` True``&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#25509;&#21463; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;and&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;or&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;not&lt;/span&gt;&lt;/tt&gt; &#20851;&#38190;&#23383;&#26469;&#23545;&#22810;&#20010;&#21464;&#37327;&#20570;&#21028;&#26029; &#65292;&#25110;&#32773;&#23545;&#21464;&#37327;&#21462;&#21453;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;not&lt;/span&gt;&lt;/tt&gt; )&#65292;&#20363;&#22914;&#65306; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn161&quot;&gt;{% if athlete_list and coach_list %}
    Both athletes and coaches are available.
{% endif %}

{% if not athlete_list %}
    There are no athletes.
{% endif %}

{% if athlete_list or coach_list %}
    There are some athletes or some coaches.
{% endif %}

{% if not athlete_list or coach_list %}
    There are no athletes or there are some coaches.
{% endif %}

{% if athlete_list and not coach_list %}
    There are some athletes and absolutely no coaches.
{% endif %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#19981;&#20801;&#35768;&#22312;&#21516;&#19968;&#20010;&#26631;&#31614;&#20013;&#21516;&#26102;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;and&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;or&lt;/span&gt;&lt;/tt&gt; &#65292;&#22240;&#20026;&#36923;&#36753;&#19978;&#21487;&#33021;&#27169;&#31946;&#30340;&#65292;&#20363;&#22914;&#65292;&#22914;&#19979;&#31034;&#20363;&#26159;&#38169;&#35823;&#30340;&#65306; &#27604;&#22914;&#36825;&#26679;&#30340;&#20195;&#30721;&#26159;&#19981;&#21512;&#27861;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn164&quot;&gt;{% if athlete_list and coach_list or cheerleader_list %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&#31995;&#32479;&#19981;&#25903;&#25345;&#29992;&#22278;&#25324;&#21495;&#26469;&#32452;&#21512;&#27604;&#36739;&#25805;&#20316;&#12290; &#22914;&#26524;&#20320;&#30830;&#23454;&#38656;&#35201;&#29992;&#21040;&#22278;&#25324;&#21495;&#26469;&#32452;&#21512;&#34920;&#36798;&#20320;&#30340;&#36923;&#36753;&#24335;&#65292;&#32771;&#34385;&#23558;&#23427;&#31227;&#21040;&#27169;&#26495;&#20043;&#22806;&#22788;&#29702;&#65292;&#28982;&#21518;&#20197;&#27169;&#26495;&#21464;&#37327;&#30340;&#24418;&#24335;&#20256;&#20837;&#32467;&#26524;&#21543;&#12290; &#25110;&#32773;&#65292;&#20165;&#20165;&#29992;&#23884;&#22871;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#26631;&#31614;&#26367;&#25442;&#21543;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn167&quot;&gt;{% if athlete_list %}
    {% if coach_list or cheerleader_list %}
        We have athletes, and either coaches or cheerleaders!
    {% endif %}
{% endif %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&#22810;&#27425;&#20351;&#29992;&#21516;&#19968;&#20010;&#36923;&#36753;&#25805;&#20316;&#31526;&#26159;&#27809;&#26377;&#38382;&#39064;&#30340;&#65292;&#20294;&#26159;&#25105;&#20204;&#19981;&#33021;&#25226;&#19981;&#21516;&#30340;&#25805;&#20316;&#31526;&#32452;&#21512;&#36215;&#26469;&#12290; &#20363;&#22914;&#65292;&#36825;&#26159;&#21512;&#27861;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn170&quot;&gt;{% if athlete_list or coach_list or parent_list or teacher_list %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn171&quot;&gt;&#24182;&#27809;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#65292; &#35831;&#20351;&#29992;&#23884;&#22871;&#30340;`` {% if %}``  &#26631;&#31614;&#26469;&#36798;&#25104;&#21516;&#26679;&#30340;&#25928;&#26524;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn173&quot;&gt;{% if athlete_list %}
    &amp;lt;p&amp;gt;Here are the athletes: {{ athlete_list }}.&amp;lt;/p&amp;gt;
{% else %}
    &amp;lt;p&amp;gt;No athletes are available.&amp;lt;/p&amp;gt;
    {% if coach_list %}
        &amp;lt;p&amp;gt;Here are the coaches: {{ coach_list }}.&amp;lt;/p&amp;gt;
    {% endif %}
{% endif %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#19968;&#23450;&#35201;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endif&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20851;&#38381;&#27599;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;for&quot;&gt;
&lt;span id=&quot;cn175&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn175&quot;&gt;for&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn176&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20801;&#35768;&#25105;&#20204;&#22312;&#19968;&#20010;&#24207;&#21015;&#19978;&#36845;&#20195;&#12290; &#19982;Python&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#30340;&#24773;&#24418;&#31867;&#20284;&#65292;&#24490;&#29615;&#35821;&#27861;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;X&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Y&lt;/span&gt;&lt;/tt&gt; &#65292;Y&#26159;&#35201;&#36845;&#20195;&#30340;&#24207;&#21015;&#32780;X&#26159;&#22312;&#27599;&#19968;&#20010;&#29305;&#23450;&#30340;&#24490;&#29615;&#20013;&#20351;&#29992;&#30340;&#21464;&#37327;&#21517;&#31216;&#12290;
&#27599;&#19968;&#27425;&#24490;&#29615;&#20013;&#65292;&#27169;&#26495;&#31995;&#32479;&#20250;&#28210;&#26579;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endfor&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20043;&#38388;&#30340;&#25152;&#26377;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn177&quot;&gt;&#20363;&#22914;&#65292;&#32473;&#23450;&#19968;&#20010;&#36816;&#21160;&#21592;&#21015;&#34920; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;athlete_list&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#65292;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992;&#19979;&#38754;&#30340;&#20195;&#30721;&#26469;&#26174;&#31034;&#36825;&#20010;&#21015;&#34920;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn179&quot;&gt;&amp;lt;ul&amp;gt;
{% for athlete in athlete_list %}
    &amp;lt;li&amp;gt;{{ athlete.name }}&amp;lt;/li&amp;gt;
{% endfor %}
&amp;lt;/ul&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;&#32473;&#26631;&#31614;&#22686;&#21152;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;reversed&lt;/span&gt;&lt;/tt&gt; &#20351;&#24471;&#35813;&#21015;&#34920;&#34987;&#21453;&#21521;&#36845;&#20195;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn182&quot;&gt;{% for athlete in athlete_list reversed %}
...
{% endfor %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn183&quot;&gt;&#21487;&#20197;&#23884;&#22871;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn185&quot;&gt;{% for athlete in athlete_list %}
    &amp;lt;h1&amp;gt;{{ athlete.name }}&amp;lt;/h1&amp;gt;
    &amp;lt;ul&amp;gt;
    {% for sport in athlete.sports_played %}
        &amp;lt;li&amp;gt;{{ sport }}&amp;lt;/li&amp;gt;
    {% endfor %}
    &amp;lt;/ul&amp;gt;
{% endfor %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#22312;&#25191;&#34892;&#24490;&#29615;&#20043;&#21069;&#20808;&#26816;&#27979;&#21015;&#34920;&#30340;&#22823;&#23567;&#26159;&#19968;&#20010;&#36890;&#24120;&#30340;&#20570;&#27861;&#65292;&#24403;&#21015;&#34920;&#20026;&#31354;&#26102;&#36755;&#20986;&#19968;&#20123;&#29305;&#21035;&#30340;&#25552;&#31034;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn188&quot;&gt;{% if athlete_list %}
    {% for athlete in athlete_list %}
        &amp;lt;p&amp;gt;{{ athlete.name }}&amp;lt;/p&amp;gt;
    {% endfor %}
{% else %}
    &amp;lt;p&amp;gt;There are no athletes. Only computer programmers.&amp;lt;/p&amp;gt;
{% endif %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn189&quot;&gt;&#22240;&#20026;&#36825;&#31181;&#20570;&#27861;&#21313;&#20998;&#24120;&#35265;&#65292;&#25152;&#20197;`` for`` &#26631;&#31614;&#25903;&#25345;&#19968;&#20010;&#21487;&#36873;&#30340;`` {% empty %}`` &#20998;&#21477;&#65292;&#36890;&#36807;&#23427;&#25105;&#20204;&#21487;&#20197;&#23450;&#20041;&#24403;&#21015;&#34920;&#20026;&#31354;&#26102;&#30340;&#36755;&#20986;&#20869;&#23481; &#19979;&#38754;&#30340;&#20363;&#23376;&#19982;&#20043;&#21069;&#37027;&#20010;&#31561;&#20215;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn191&quot;&gt;{% for athlete in athlete_list %}
    &amp;lt;p&amp;gt;{{ athlete.name }}&amp;lt;/p&amp;gt;
{% empty %}
    &amp;lt;p&amp;gt;There are no athletes. Only computer programmers.&amp;lt;/p&amp;gt;
{% endfor %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn192&quot;&gt;Django&#19981;&#25903;&#25345;&#36864;&#20986;&#24490;&#29615;&#25805;&#20316;&#12290; &#22914;&#26524;&#25105;&#20204;&#24819;&#36864;&#20986;&#24490;&#29615;&#65292;&#21487;&#20197;&#25913;&#21464;&#27491;&#22312;&#36845;&#20195;&#30340;&#21464;&#37327;&#65292;&#35753;&#20854;&#20165;&#20165;&#21253;&#21547;&#38656;&#35201;&#36845;&#20195;&#30340;&#39033;&#30446;&#12290; &#21516;&#29702;&#65292;Django&#20063;&#19981;&#25903;&#25345;continue&#35821;&#21477;&#65292;&#25105;&#20204;&#26080;&#27861;&#35753;&#24403;&#21069;&#36845;&#20195;&#25805;&#20316;&#36339;&#22238;&#21040;&#24490;&#29615;&#22836;&#37096;&#12290;
&#65288;&#35831;&#21442;&#30475;&#26412;&#31456;&#31245;&#21518;&#30340;&#29702;&#24565;&#21644;&#38480;&#21046;&#23567;&#33410;&#65292;&#20102;&#35299;&#19979;&#20915;&#23450;&#36825;&#20010;&#35774;&#35745;&#30340;&#32972;&#21518;&#21407;&#22240;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&#22312;&#27599;&#20010;`` {% for %}``&#24490;&#29615;&#37324;&#26377;&#19968;&#20010;&#31216;&#20026;`` forloop`` &#30340;&#27169;&#26495;&#21464;&#37327;&#12290;&#36825;&#20010;&#21464;&#37327;&#26377;&#19968;&#20123;&#25552;&#31034;&#24490;&#29615;&#36827;&#24230;&#20449;&#24687;&#30340;&#23646;&#24615;&#12290;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn194&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.counter&lt;/span&gt;&lt;/tt&gt; &#24635;&#26159;&#19968;&#20010;&#34920;&#31034;&#24403;&#21069;&#24490;&#29615;&#30340;&#25191;&#34892;&#27425;&#25968;&#30340;&#25972;&#25968;&#35745;&#25968;&#22120;&#12290; &#36825;&#20010;&#35745;&#25968;&#22120;&#26159;&#20174;1&#24320;&#22987;&#30340;&#65292;&#25152;&#20197;&#22312;&#31532;&#19968;&#27425;&#24490;&#29615;&#26102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.counter&lt;/span&gt;&lt;/tt&gt; &#23558;&#20250;&#34987;&#35774;&#32622;&#20026;1&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn196&quot;&gt;{% for item in todo_list %}
    &amp;lt;p&amp;gt;{{ forloop.counter }}: {{ item }}&amp;lt;/p&amp;gt;
{% endfor %}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.counter0&lt;/span&gt;&lt;/tt&gt; &#31867;&#20284;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.counter&lt;/span&gt;&lt;/tt&gt; &#65292;&#20294;&#26159;&#23427;&#26159;&#20174;0&#35745;&#25968;&#30340;&#12290; &#31532;&#19968;&#27425;&#25191;&#34892;&#24490;&#29615;&#26102;&#36825;&#20010;&#21464;&#37327;&#20250;&#34987;&#35774;&#32622;&#20026;0&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.revcounter&lt;/span&gt;&lt;/tt&gt; &#26159;&#34920;&#31034;&#24490;&#29615;&#20013;&#21097;&#20313;&#39033;&#30340;&#25972;&#22411;&#21464;&#37327;&#12290; &#22312;&#24490;&#29615;&#21021;&#27425;&#25191;&#34892;&#26102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.revcounter&lt;/span&gt;&lt;/tt&gt; &#23558;&#34987;&#35774;&#32622;&#20026;&#24207;&#21015;&#20013;&#39033;&#30340;&#24635;&#25968;&#12290; &#26368;&#21518;&#19968;&#27425;&#24490;&#29615;&#25191;&#34892;&#20013;&#65292;&#36825;&#20010;&#21464;&#37327;&#23558;&#34987;&#32622;1&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.revcounter0&lt;/span&gt;&lt;/tt&gt; &#31867;&#20284;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.revcounter&lt;/span&gt;&lt;/tt&gt; &#65292;&#20294;&#23427;&#20197;0&#20570;&#20026;&#32467;&#26463;&#32034;&#24341;&#12290;
&#22312;&#31532;&#19968;&#27425;&#25191;&#34892;&#24490;&#29615;&#26102;&#65292;&#35813;&#21464;&#37327;&#20250;&#34987;&#32622;&#20026;&#24207;&#21015;&#30340;&#39033;&#30340;&#20010;&#25968;&#20943;1&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.first&lt;/span&gt;&lt;/tt&gt; &#26159;&#19968;&#20010;&#24067;&#23572;&#20540;&#65292;&#22914;&#26524;&#35813;&#36845;&#20195;&#26159;&#31532;&#19968;&#27425;&#25191;&#34892;&#65292;&#37027;&#20040;&#23427;&#34987;&#32622;&#20026;&lt;a href=&quot;#id12&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id13&quot;&gt;``&lt;/span&gt;&lt;/a&gt;`` &#22312;&#19979;&#38754;&#30340;&#24773;&#24418;&#20013;&#36825;&#20010;&#21464;&#37327;&#26159;&#24456;&#26377;&#29992;&#30340;&#65306;&lt;/p&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id12&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 1071); &lt;em&gt;&lt;a href=&quot;#id13&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn200&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn202&quot;&gt;{% for object in objects %}
    {% if forloop.first %}&amp;lt;li class=&quot;first&quot;&amp;gt;{% else %}&amp;lt;li&amp;gt;{% endif %}
    {{ object }}
    &amp;lt;/li&amp;gt;
{% endfor %}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn203&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.last&lt;/span&gt;&lt;/tt&gt; &#26159;&#19968;&#20010;&#24067;&#23572;&#20540;&#65307;&#22312;&#26368;&#21518;&#19968;&#27425;&#25191;&#34892;&#24490;&#29615;&#26102;&#34987;&#32622;&#20026;True&#12290; &#19968;&#20010;&#24120;&#35265;&#30340;&#29992;&#27861;&#26159;&#22312;&#19968;&#31995;&#21015;&#30340;&#38142;&#25509;&#20043;&#38388;&#25918;&#32622;&#31649;&#36947;&#31526;&#65288;|&#65289;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn205&quot;&gt;{% for link in links %}{{ link }}{% if not forloop.last %} | {% endif %}{% endfor %}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn206&quot;&gt;&#19978;&#38754;&#30340;&#27169;&#26495;&#21487;&#33021;&#20250;&#20135;&#29983;&#22914;&#19979;&#30340;&#32467;&#26524;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn208&quot;&gt;Link1 | Link2 | Link3 | Link4
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&#21478;&#19968;&#20010;&#24120;&#35265;&#30340;&#29992;&#36884;&#26159;&#20026;&#21015;&#34920;&#30340;&#27599;&#20010;&#21333;&#35789;&#30340;&#21152;&#19978;&#36887;&#21495;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn211&quot;&gt;Favorite places:
{% for p in places %}{{ p }}{% if not forloop.last %}, {% endif %}{% endfor %}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn212&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop.parentloop&lt;/span&gt;&lt;/tt&gt; &#26159;&#19968;&#20010;&#25351;&#21521;&#24403;&#21069;&#24490;&#29615;&#30340;&#19978;&#19968;&#32423;&#24490;&#29615;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forloop&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#30340;&#24341;&#29992;&#65288;&#22312;&#23884;&#22871;&#24490;&#29615;&#30340;&#24773;&#20917;&#19979;&#65289;&#12290; &#20363;&#23376;&#22312;&#27492;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn214&quot;&gt;{% for country in countries %}
    &amp;lt;table&amp;gt;
    {% for city in country.city_list %}
        &amp;lt;tr&amp;gt;
        &amp;lt;td&amp;gt;Country #{{ forloop.parentloop.counter }}&amp;lt;/td&amp;gt;
        &amp;lt;td&amp;gt;City #{{ forloop.counter }}&amp;lt;/td&amp;gt;
        &amp;lt;td&amp;gt;{{ city }}&amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
    {% endfor %}
    &amp;lt;/table&amp;gt;
{% endfor %}
&lt;/pre&gt;
</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter05</id>
        <title type="html">chapter05</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter05"/>
        <published>2015-02-26T23:29:04+08:00</published>
        <updated>2015-02-26T23:29:04+08:00</updated> 
        <category term="/General" label="General" />
        <summary type="html">&lt;p class=&quot;cn&quot; id=&quot;cn141&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sqlall&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#24182;&#27809;&#26377;&#22312;&#25968;&#25454;&#24211;&#20013;&#30495;&#27491;&#21019;&#24314;&#25968;&#25454;&#34920;&#65292;&#21482;&#26159;&#25226;SQL&#35821;&#21477;&#27573;&#25171;&#21360;&#20986;&#26469;&#65292;&#36825;&#26679;&#20320;&#21487;&#20197;&#30475;&#21040;Django&#31350;&#31455;&#20250;&#20570;&#20123;&#20160;&#20040;&#12290; &#22914;&#26524;&#20320;&#24819;&#36825;&#20040;&#20570;&#30340;&#35805;&#65292;&#20320;&#21487;&#20197;&#25226;&#37027;&#20123;SQL&#35821;&#21477;&#22797;&#21046;&#21040;&#20320;&#30340;&#25968;&#25454;&#24211;&#23458;&#25143;&#31471;&#25191;&#34892;&#65292;&#25110;&#32773;&#36890;&#36807;Unix&#31649;&#36947;&#30452;&#25509;&#36827;&#34892;&#25805;&#20316;&#65288;&#20363;&#22914;&#65292;`` python manager.py sqlall books | psql mydb`` &#65289;&#12290;&#19981;&#36807;&#65292;Django&#25552;&#20379;&#20102;&#19968;&#31181;&#26356;&#20026;&#31616;&#26131;&#30340;&#25552;&#20132;SQL&#35821;&#21477;&#33267;&#25968;&#25454;&#24211;&#30340;&#26041;&#27861;&#65306; `` syncdb`` &#21629;&#20196;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn143&quot;&gt;python manage.py syncdb
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn144&quot;&gt;&#25191;&#34892;&#36825;&#20010;&#21629;&#20196;&#21518;&#65292;&#23558;&#30475;&#21040;&#31867;&#20284;&#20197;&#19979;&#30340;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn146&quot;&gt;Creating table books_publisher
Creating table books_author
Creating table books_book
Installing index for books.Book model
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn147&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#26159;&#21516;&#27493;&#20320;&#30340;&#27169;&#22411;&#21040;&#25968;&#25454;&#24211;&#30340;&#19968;&#20010;&#31616;&#21333;&#26041;&#27861;&#12290; &#23427;&#20250;&#26681;&#25454; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#37324;&#35774;&#32622;&#30340;app&#26469;&#26816;&#26597;&#25968;&#25454;&#24211;&#65292; &#22914;&#26524;&#34920;&#19981;&#23384;&#22312;&#65292;&#23427;&#23601;&#20250;&#21019;&#24314;&#23427;&#12290; &#38656;&#35201;&#27880;&#24847;&#30340;&#26159;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt; &#24182; &lt;em&gt;&#19981;&#33021;&lt;/em&gt;&#23558;&#27169;&#22411;&#30340;&#20462;&#25913;&#25110;&#21024;&#38500;&#21516;&#27493;&#21040;&#25968;&#25454;&#24211;&#65307;&#22914;&#26524;&#20320;&#20462;&#25913;&#25110;&#21024;&#38500;&#20102;&#19968;&#20010;&#27169;&#22411;&#65292;&#24182;&#24819;&#25226;&#23427;&#25552;&#20132;&#21040;&#25968;&#25454;&#24211;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt;&#24182;&#19981;&#20250;&#20570;&#20986;&#20219;&#20309;&#22788;&#29702;&#12290; &#65288;&#26356;&#22810;&#20869;&#23481;&#35831;&#26597;&#30475;&#26412;&#31456;&#26368;&#21518;&#30340;&#8220;&#20462;&#25913;&#25968;&#25454;&#24211;&#30340;&#26550;&#26500;&#8221;&#19968;&#27573;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn148&quot;&gt;&#22914;&#26524;&#20320;&#20877;&#27425;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt; &#65292;&#20160;&#20040;&#20063;&#27809;&#21457;&#29983;&#65292;&#22240;&#20026;&#20320;&#27809;&#26377;&#28155;&#21152;&#26032;&#30340;&#27169;&#22411;&#25110;&#32773; &#28155;&#21152;&#26032;&#30340;app&#12290;&#22240;&#27492;&#65292;&#36816;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt;&#24635;&#26159;&#23433;&#20840;&#30340;&#65292;&#22240;&#20026;&#23427;&#19981;&#20250;&#37325;&#22797;&#25191;&#34892;SQL&#35821;&#21477;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&#22914;&#26524;&#20320;&#26377;&#20852;&#36259;&#65292;&#33457;&#28857;&#26102;&#38388;&#29992;&#20320;&#30340;SQL&#23458;&#25143;&#31471;&#30331;&#24405;&#36827;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#30475;&#30475;&#21018;&#25165;Django&#21019;&#24314;&#30340;&#25968;&#25454;&#34920;&#12290; &#20320;&#21487;&#20197;&#25163;&#21160;&#21551;&#21160;&#21629;&#20196;&#34892;&#23458;&#25143;&#31471;&#65288;&#20363;&#22914;&#65292;&#25191;&#34892;PostgreSQL&#30340;`` psql`` &#21629;&#20196;&#65289;&#65292;&#20063;&#21487;&#20197;&#25191;&#34892; `` python manage.py dbshell``  &#65292;&#36825;&#20010;&#21629;&#20196;&#23558;&#20381;&#25454;`` DATABASE_SERVER`` &#30340;&#37324;&#35774;&#32622;&#33258;&#21160;&#26816;&#27979;&#20351;&#29992;&#21738;&#31181;&#21629;&#20196;&#34892;&#23458;&#25143;&#31471;&#12290; &#24120;&#35328;&#35828;&#65292;&#21518;&#26469;&#32773;&#23621;&#19978;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn150&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn150&quot;&gt;&#22522;&#26412;&#25968;&#25454;&#35775;&#38382;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn151&quot;&gt;&#19968;&#26086;&#20320;&#21019;&#24314;&#20102;&#27169;&#22411;&#65292;Django&#33258;&#21160;&#20026;&#36825;&#20123;&#27169;&#22411;&#25552;&#20379;&#20102;&#39640;&#32423;&#30340;Python API&#12290; &#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;shell&lt;/span&gt;&lt;/tt&gt; &#24182;&#36755;&#20837;&#19979;&#38754;&#30340;&#20869;&#23481;&#35797;&#35797;&#30475;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn153&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from books.models import Publisher
&amp;gt;&amp;gt;&amp;gt; p1 = Publisher(name=&apos;Apress&apos;, address=&apos;2855 Telegraph Avenue&apos;,
...     city=&apos;Berkeley&apos;, state_province=&apos;CA&apos;, country=&apos;U.S.A.&apos;,
...     website=&apos;http://www.apress.com/&apos;)
&amp;gt;&amp;gt;&amp;gt; p1.save()
&amp;gt;&amp;gt;&amp;gt; p2 = Publisher(name=&quot;O&apos;Reilly&quot;, address=&apos;10 Fawcett St.&apos;,
...     city=&apos;Cambridge&apos;, state_province=&apos;MA&apos;, country=&apos;U.S.A.&apos;,
...     website=&apos;http://www.oreilly.com/&apos;)
&amp;gt;&amp;gt;&amp;gt; p2.save()
&amp;gt;&amp;gt;&amp;gt; publisher_list = Publisher.objects.all()
&amp;gt;&amp;gt;&amp;gt; publisher_list
[&amp;lt;Publisher: Publisher object&amp;gt;, &amp;lt;Publisher: Publisher object&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&#36825;&#30701;&#30701;&#20960;&#34892;&#20195;&#30721;&#24178;&#20102;&#19981;&#23569;&#30340;&#20107;&#12290; &#36825;&#37324;&#31616;&#21333;&#30340;&#35828;&#19968;&#19979;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn155&quot;&gt;&#39318;&#20808;&#65292;&#23548;&#20837;Publisher&#27169;&#22411;&#31867;&#65292; &#36890;&#36807;&#36825;&#20010;&#31867;&#25105;&#20204;&#21487;&#20197;&#19982;&#21253;&#21547; &#20986;&#29256;&#31038; &#30340;&#25968;&#25454;&#34920;&#36827;&#34892;&#20132;&#20114;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn156&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn156&quot;&gt;&#25509;&#30528;&#65292;&#21019;&#24314;&#19968;&#20010;`` Publisher`` &#31867;&#30340;&#23454;&#20363;&#24182;&#35774;&#32622;&#20102;&#23383;&#27573;`` name, address`` &#31561;&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn157&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn157&quot;&gt;&#35843;&#29992;&#35813;&#23545;&#35937;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;save()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#65292;&#23558;&#23545;&#35937;&#20445;&#23384;&#21040;&#25968;&#25454;&#24211;&#20013;&#12290; Django &#20250;&#22312;&#21518;&#21488;&#25191;&#34892;&#19968;&#26465; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSERT&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn158&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn158&quot;&gt;&#26368;&#21518;&#65292;&#20351;&#29992;`` Publisher.objects`` &#23646;&#24615;&#20174;&#25968;&#25454;&#24211;&#21462;&#20986;&#20986;&#29256;&#21830;&#30340;&#20449;&#24687;&#65292;&#36825;&#20010;&#23646;&#24615;&#21487;&#20197;&#35748;&#20026;&#26159;&#21253;&#21547;&#20986;&#29256;&#21830;&#30340;&#35760;&#24405;&#38598;&#12290; &#36825;&#20010;&#23646;&#24615;&#26377;&#35768;&#22810;&#26041;&#27861;&#65292; &#36825;&#37324;&#20808;&#20171;&#32461;&#35843;&#29992;`` Publisher.objects.all()`` &#26041;&#27861;&#33719;&#21462;&#25968;&#25454;&#24211;&#20013;`` Publisher`` &#31867;&#30340;&#25152;&#26377;&#23545;&#35937;&#12290;&#36825;&#20010;&#25805;&#20316;&#30340;&#24149;&#21518;&#65292;Django&#25191;&#34892;&#20102;&#19968;&#26465;SQL `` SELECT`` &#35821;&#21477;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&#36825;&#37324;&#26377;&#19968;&#20010;&#20540;&#24471;&#27880;&#24847;&#30340;&#22320;&#26041;&#65292;&#22312;&#36825;&#20010;&#20363;&#23376;&#21487;&#33021;&#24182;&#26410;&#28165;&#26224;&#22320;&#23637;&#31034;&#12290; &#24403;&#20320;&#20351;&#29992;Django modle API&#21019;&#24314;&#23545;&#35937;&#26102;Django&#24182;&#26410;&#23558;&#23545;&#35937;&#20445;&#23384;&#33267;&#25968;&#25454;&#24211;&#20869;&#65292;&#38500;&#38750;&#20320;&#35843;&#29992;`` save()`` &#26041;&#27861;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn161&quot;&gt;p1 = Publisher(...)
# At this point, p1 is not saved to the database yet!
p1.save()
# Now it is.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#22914;&#26524;&#38656;&#35201;&#19968;&#27493;&#23436;&#25104;&#23545;&#35937;&#30340;&#21019;&#24314;&#19982;&#23384;&#20648;&#33267;&#25968;&#25454;&#24211;&#65292;&#23601;&#20351;&#29992;`` objects.create()`` &#26041;&#27861;&#12290; &#19979;&#38754;&#30340;&#20363;&#23376;&#19982;&#20043;&#21069;&#30340;&#20363;&#23376;&#31561;&#20215;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn164&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p1 = Publisher.objects.create(name=&apos;Apress&apos;,
...     address=&apos;2855 Telegraph Avenue&apos;,
...     city=&apos;Berkeley&apos;, state_province=&apos;CA&apos;, country=&apos;U.S.A.&apos;,
...     website=&apos;http://www.apress.com/&apos;)
&amp;gt;&amp;gt;&amp;gt; p2 = Publisher.objects.create(name=&quot;O&apos;Reilly&quot;,
...     address=&apos;10 Fawcett St.&apos;, city=&apos;Cambridge&apos;,
...     state_province=&apos;MA&apos;, country=&apos;U.S.A.&apos;,
...     website=&apos;http://www.oreilly.com/&apos;)
&amp;gt;&amp;gt;&amp;gt; publisher_list = Publisher.objects.all()
&amp;gt;&amp;gt;&amp;gt; publisher_list
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&#24403;&#28982;&#65292;&#20320;&#32943;&#23450;&#24819;&#25191;&#34892;&#26356;&#22810;&#30340;Django&#25968;&#25454;&#24211;API&#35797;&#35797;&#30475;&#65292;&#19981;&#36807;&#65292;&#36824;&#26159;&#35753;&#25105;&#20204;&#20808;&#35299;&#20915;&#19968;&#28857;&#28902;&#20154;&#30340;&#23567;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn166&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn166&quot;&gt;&#28155;&#21152;&#27169;&#22359;&#30340;&#23383;&#31526;&#20018;&#34920;&#29616;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn167&quot;&gt;&#24403;&#25105;&#20204;&#25171;&#21360;&#25972;&#20010;publisher&#21015;&#34920;&#26102;&#65292;&#25105;&#20204;&#27809;&#26377;&#24471;&#21040;&#24819;&#35201;&#30340;&#26377;&#29992;&#20449;&#24687;&#65292;&#26080;&#27861;&#25226;&lt;a href=&quot;#id9&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id10&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;#id11&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id12&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&#23545;&#35937;&#21306;&#20998;&#24320;&#26469;&#65306;&lt;/p&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id9&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 872); &lt;em&gt;&lt;a href=&quot;#id10&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn167&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id11&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 872); &lt;em&gt;&lt;a href=&quot;#id12&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn167&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn169&quot;&gt;[&amp;lt;Publisher: Publisher object&amp;gt;, &amp;lt;Publisher: Publisher object&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn170&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#31616;&#21333;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#65292;&#21482;&#38656;&#35201;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#28155;&#21152;&#19968;&#20010;&#26041;&#27861; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt; &#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#21578;&#35785;Python&#22914;&#20309;&#23558;&#23545;&#35937;&#20197;unicode&#30340;&#26041;&#24335;&#26174;&#31034;&#20986;&#26469;&#12290; &#20026;&#20197;&#19978;&#19977;&#20010;&#27169;&#22411;&#28155;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#21518;&#65292;&#23601;&#21487;&#20197;&#30475;&#21040;&#25928;&#26524;&#20102;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn172&quot;&gt;from django.db import models

class Publisher(models.Model):
    name = models.CharField(max_length=30)
    address = models.CharField(max_length=50)
    city = models.CharField(max_length=60)
    state_province = models.CharField(max_length=30)
    country = models.CharField(max_length=50)
    website = models.URLField()

    **def __unicode__(self):**
        **return self.name**

class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField()

    **def __unicode__(self):**
        **return u&apos;%s %s&apos; % (self.first_name, self.last_name)**

class Book(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publication_date = models.DateField()

    **def __unicode__(self):**
        **return self.title**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn173&quot;&gt;&#23601;&#35937;&#20320;&#30475;&#21040;&#30340;&#19968;&#26679;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#21487;&#20197;&#36827;&#34892;&#20219;&#20309;&#22788;&#29702;&#26469;&#36820;&#22238;&#23545;&#19968;&#20010;&#23545;&#35937;&#30340;&#23383;&#31526;&#20018;&#34920;&#31034;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#31616;&#21333;&#22320;&#36820;&#22238;&#21508;&#33258;&#30340;&#21517;&#31216;&#21644;&#26631;&#39064;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#21017;&#31245;&#24494;&#22797;&#26434;&#19968;&#20123;&#65292;&#23427;&#23558;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;first_name&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;last_name&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#20540;&#20197;&#31354;&#26684;&#36830;&#25509;&#21518;&#20877;&#36820;&#22238;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#23545;__unicode__()&#30340;&#21807;&#19968;&#35201;&#27714;&#23601;&#26159;&#23427;&#35201;&#36820;&#22238;&#19968;&#20010;unicode&#23545;&#35937; &#22914;&#26524;`` __unicode__()`` &#26041;&#27861;&#26410;&#36820;&#22238;&#19968;&#20010;Unicode&#23545;&#35937;&#65292;&#32780;&#36820;&#22238;&#27604;&#22914;&#35828;&#19968;&#20010;&#25972;&#22411;&#25968;&#23383;&#65292;&#37027;&#20040;Python&#23558;&#25243;&#20986;&#19968;&#20010;`` TypeError`` &#38169;&#35823;&#65292;&#24182;&#25552;&#31034;&#65306;&#8221;coercing to Unicode: need string or buffer, int found&#8221; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn175&quot;&gt;Unicode&#23545;&#35937;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn176&quot;&gt;&#20160;&#20040;&#26159;Unicode&#23545;&#35937;&#21602;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn177&quot;&gt;&#20320;&#21487;&#20197;&#35748;&#20026;unicode&#23545;&#35937;&#23601;&#26159;&#19968;&#20010;Python&#23383;&#31526;&#20018;&#65292;&#23427;&#21487;&#20197;&#22788;&#29702;&#19978;&#30334;&#19975;&#19981;&#21516;&#31867;&#21035;&#30340;&#23383;&#31526;&#8212;&#8212;&#20174;&#21476;&#32769;&#29256;&#26412;&#30340;Latin&#23383;&#31526;&#21040;&#38750;Latin&#23383;&#31526;&#65292;&#20877;&#21040;&#26354;&#25240;&#30340;&#24341;&#29992;&#21644;&#33392;&#28073;&#30340;&#31526;&#21495;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn178&quot;&gt;&#26222;&#36890;&#30340;python&#23383;&#31526;&#20018;&#26159;&#32463;&#36807;&lt;em&gt;&#32534;&#30721;&lt;/em&gt;&#30340;&#65292;&#24847;&#24605;&#23601;&#26159;&#23427;&#20204;&#20351;&#29992;&#20102;&#26576;&#31181;&#32534;&#30721;&#26041;&#24335;&#65288;&#22914;ASCII&#65292;ISO-8859-1&#25110;&#32773;UTF-8&#65289;&#26469;&#32534;&#30721;&#12290; &#22914;&#26524;&#20320;&#25226;&#22855;&#29305;&#30340;&#23383;&#31526;&#65288;&#20854;&#23427;&#20219;&#20309;&#36229;&#20986;&#26631;&#20934;128&#20010;&#22914;0-9&#21644;A-Z&#20043;&#31867;&#30340;ASCII&#23383;&#31526;&#65289;&#20445;&#23384;&#22312;&#19968;&#20010;&#26222;&#36890;&#30340;Python&#23383;&#31526;&#20018;&#37324;&#65292;&#20320;&#19968;&#23450;&#35201;&#36319;&#36394;&#20320;&#30340;&#23383;&#31526;&#20018;&#26159;&#29992;&#20160;&#20040;&#32534;&#30721;&#30340;&#65292;&#21542;&#21017;&#36825;&#20123;&#22855;&#29305;&#30340;&#23383;&#31526;&#21487;&#33021;&#20250;&#22312;&#26174;&#31034;&#25110;&#32773;&#25171;&#21360;&#30340;&#26102;&#20505;&#20986;&#29616;&#20081;&#30721;&#12290; &#24403;&#20320;&#23581;&#35797;&#35201;&#23558;&#29992;&#26576;&#31181;&#32534;&#30721;&#20445;&#23384;&#30340;&#25968;&#25454;&#32467;&#21512;&#21040;&#21478;&#22806;&#19968;&#31181;&#32534;&#30721;&#30340;&#25968;&#25454;&#20013;&#65292;&#25110;&#32773;&#20320;&#24819;&#35201;&#25226;&#23427;&#26174;&#31034;&#22312;&#24050;&#32463;&#20551;&#23450;&#20102;&#26576;&#31181;&#32534;&#30721;&#30340;&#31243;&#24207;&#20013;&#30340;&#26102;&#20505;&#65292;&#38382;&#39064;&#23601;&#20250;&#21457;&#29983;&#12290; &#25105;&#20204;&#37117;&#24050;&#32463;&#35265;&#21040;&#36807;&#32593;&#39029;&#21644;&#37038;&#20214;&#34987;???&#24324;&#24471;&#20081;&#19971;&#20843;&#31967;&#12290; ?????? &#25110;&#32773;&#20854;&#23427;&#20986;&#29616;&#22312;&#22855;&#24618;&#20301;&#32622;&#30340;&#23383;&#31526;&#65306;&#36825;&#19968;&#33324;&#26469;&#35828;&#23601;&#26159;&#23384;&#22312;&#32534;&#30721;&#38382;&#39064;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn179&quot;&gt;&#20294;&#26159;Unicode&#23545;&#35937;&#24182;&#27809;&#26377;&#32534;&#30721;&#12290;&#23427;&#20204;&#20351;&#29992;Unicode&#65292;&#19968;&#20010;&#19968;&#33268;&#30340;&#65292;&#36890;&#29992;&#30340;&#23383;&#31526;&#32534;&#30721;&#38598;&#12290; &#24403;&#20320;&#22312;Python&#20013;&#22788;&#29702;Unicode&#23545;&#35937;&#30340;&#26102;&#20505;&#65292;&#20320;&#21487;&#20197;&#30452;&#25509;&#23558;&#23427;&#20204;&#28151;&#21512;&#20351;&#29992;&#21644;&#20114;&#30456;&#21305;&#37197;&#32780;&#19981;&#24517;&#21435;&#32771;&#34385;&#32534;&#30721;&#32454;&#33410;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;Django &#22312;&#20854;&#20869;&#37096;&#30340;&#21508;&#20010;&#26041;&#38754;&#37117;&#20351;&#29992;&#21040;&#20102; Unicode &#23545;&#35937;&#12290; &#27169;&#22411; &#23545;&#35937;&#20013;&#65292;&#26816;&#32034;&#21305;&#37197;&#26041;&#38754;&#30340;&#25805;&#20316;&#20351;&#29992;&#30340;&#26159; Unicode &#23545;&#35937;&#65292;&#35270;&#22270; &#20989;&#25968;&#20043;&#38388;&#30340;&#20132;&#20114;&#20351;&#29992;&#30340;&#26159; Unicode &#23545;&#35937;&#65292;&#27169;&#26495;&#30340;&#28210;&#26579;&#20063;&#26159;&#29992;&#30340; Unicode &#23545;&#35937;&#12290; &#36890;&#24120;&#65292;&#25105;&#20204;&#19981;&#24517;&#25285;&#24515;&#32534;&#30721;&#26159;&#21542;&#27491;&#30830;&#65292;&#21518;&#21488;&#20250;&#22788;&#29702;&#30340;&#24456;&#22909;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn181&quot;&gt;&#27880;&#24847;&#65292;&#25105;&#20204;&#36825;&#37324;&#21482;&#26159;&#23545;Unicode&#23545;&#35937;&#36827;&#34892;&#38750;&#24120;&#27973;&#26174;&#30340;&#27010;&#36848;&#65292;&#33509;&#35201;&#28145;&#20837;&#20102;&#35299;&#20320;&#21487;&#33021;&#38656;&#35201;&#26597;&#38405;&#30456;&#20851;&#30340;&#36164;&#26009;&#12290; &#36825;&#26159;&#19968;&#20010;&#24456;&#22909;&#30340;&#36215;&#28857;&#65306;http://www.joelonsoftware.com/articles/Unicode.html&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn182&quot;&gt;&#20026;&#20102;&#35753;&#25105;&#20204;&#30340;&#20462;&#25913;&#29983;&#25928;&#65292;&#20808;&#36864;&#20986;Python Shell&#65292;&#28982;&#21518;&#20877;&#27425;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;shell&lt;/span&gt;&lt;/tt&gt; &#36827;&#20837;&#12290;&#65288;&#36825;&#26159;&#20445;&#35777;&#20195;&#30721;&#20462;&#25913;&#29983;&#25928;&#30340;&#26368;&#31616;&#21333;&#26041;&#27861;&#12290;&#65289;&#29616;&#22312;`` Publisher``&#23545;&#35937;&#21015;&#34920;&#23481;&#26131;&#29702;&#35299;&#22810;&#20102;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn184&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from books.models import Publisher
&amp;gt;&amp;gt;&amp;gt; publisher_list = Publisher.objects.all()
&amp;gt;&amp;gt;&amp;gt; publisher_list
[&amp;lt;Publisher: Apress&amp;gt;, &amp;lt;Publisher: O&apos;Reilly&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#35831;&#30830;&#20445;&#20320;&#30340;&#27599;&#19968;&#20010;&#27169;&#22411;&#37324;&#37117;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#65292;&#36825;&#19981;&#21482;&#26159;&#20026;&#20102;&#20132;&#20114;&#26102;&#26041;&#20415;&#65292;&#20063;&#26159;&#22240;&#20026; Django&#20250;&#22312;&#20854;&#20182;&#19968;&#20123;&#22320;&#26041;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt; &#26469;&#26174;&#31034;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#26368;&#21518;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt; &#20063;&#26159;&#19968;&#20010;&#24456;&#22909;&#30340;&#20363;&#23376;&#26469;&#28436;&#31034;&#25105;&#20204;&#24590;&#20040;&#28155;&#21152; &lt;em&gt;&#34892;&#20026;&lt;/em&gt; &#21040;&#27169;&#22411;&#37324;&#12290; Django&#30340;&#27169;&#22411;&#19981;&#21482;&#26159;&#20026;&#23545;&#35937;&#23450;&#20041;&#20102;&#25968;&#25454;&#24211;&#34920;&#30340;&#32467;&#26500;&#65292;&#36824;&#23450;&#20041;&#20102;&#23545;&#35937;&#30340;&#34892;&#20026;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt; &#23601;&#26159;&#19968;&#20010;&#20363;&#23376;&#26469;&#28436;&#31034;&#27169;&#22411;&#30693;&#36947;&#24590;&#20040;&#26174;&#31034;&#23427;&#20204;&#33258;&#24049;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn187&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn187&quot;&gt;&#25554;&#20837;&#21644;&#26356;&#26032;&#25968;&#25454;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn188&quot;&gt;&#20320;&#24050;&#32463;&#30693;&#36947;&#24590;&#20040;&#20570;&#20102;&#65306; &#20808;&#20351;&#29992;&#19968;&#20123;&#20851;&#38190;&#21442;&#25968;&#21019;&#24314;&#23545;&#35937;&#23454;&#20363;&#65292;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn190&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p = Publisher(name=&apos;Apress&apos;,
...         address=&apos;2855 Telegraph Ave.&apos;,
...         city=&apos;Berkeley&apos;,
...         state_province=&apos;CA&apos;,
...         country=&apos;U.S.A.&apos;,
...         website=&apos;http://www.apress.com/&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn191&quot;&gt;&#36825;&#20010;&#23545;&#35937;&#23454;&#20363;&#24182; &lt;em&gt;&#27809;&#26377;&lt;/em&gt; &#23545;&#25968;&#25454;&#24211;&#20570;&#20462;&#25913;&#12290; &#22312;&#35843;&#29992;`` save()`` &#26041;&#27861;&#20043;&#21069;&#65292;&#35760;&#24405;&#24182;&#27809;&#26377;&#20445;&#23384;&#33267;&#25968;&#25454;&#24211;&#65292;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn193&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p.save()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn194&quot;&gt;&#22312;SQL&#37324;&#65292;&#36825;&#22823;&#33268;&#21487;&#20197;&#36716;&#25442;&#25104;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn196&quot;&gt;INSERT INTO books_publisher
    (name, address, city, state_province, country, website)
VALUES
    (&apos;Apress&apos;, &apos;2855 Telegraph Ave.&apos;, &apos;Berkeley&apos;, &apos;CA&apos;,
     &apos;U.S.A.&apos;, &apos;http://www.apress.com/&apos;);
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&#22240;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt; &#27169;&#22411;&#26377;&#19968;&#20010;&#33258;&#21160;&#22686;&#21152;&#30340;&#20027;&#38190; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;id&lt;/span&gt;&lt;/tt&gt; &#65292;&#25152;&#20197;&#31532;&#19968;&#27425;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;save()&lt;/span&gt;&lt;/tt&gt; &#36824;&#22810;&#20570;&#20102;&#19968;&#20214;&#20107;&#65306; &#35745;&#31639;&#36825;&#20010;&#20027;&#38190;&#30340;&#20540;&#24182;&#25226;&#23427;&#36171;&#20540;&#32473;&#36825;&#20010;&#23545;&#35937;&#23454;&#20363;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn199&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p.id
52    # this will differ based on your own data
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&#25509;&#19979;&#26469;&#20877;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;save()&lt;/span&gt;&lt;/tt&gt; &#23558;&#19981;&#20250;&#21019;&#24314;&#26032;&#30340;&#35760;&#24405;&#65292;&#32780;&#21482;&#26159;&#20462;&#25913;&#35760;&#24405;&#20869;&#23481;&#65288;&#20063;&#23601;&#26159; &#25191;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;UPDATE&lt;/span&gt;&lt;/tt&gt; SQL&#35821;&#21477;&#65292;&#32780;&#19981;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSERT&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#65289;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn202&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p.name = &apos;Apress Publishing&apos;
&amp;gt;&amp;gt;&amp;gt; p.save()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn203&quot;&gt;&#21069;&#38754;&#25191;&#34892;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;save()&lt;/span&gt;&lt;/tt&gt; &#30456;&#24403;&#20110;&#19979;&#38754;&#30340;SQL&#35821;&#21477;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn205&quot;&gt;UPDATE books_publisher SET
    name = &apos;Apress Publishing&apos;,
    address = &apos;2855 Telegraph Ave.&apos;,
    city = &apos;Berkeley&apos;,
    state_province = &apos;CA&apos;,
    country = &apos;U.S.A.&apos;,
    website = &apos;http://www.apress.com&apos;
WHERE id = 52;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn206&quot;&gt;&#27880;&#24847;&#65292;&#24182;&#19981;&#26159;&#21482;&#26356;&#26032;&#20462;&#25913;&#36807;&#30340;&#37027;&#20010;&#23383;&#27573;&#65292;&#25152;&#26377;&#30340;&#23383;&#27573;&#37117;&#20250;&#34987;&#26356;&#26032;&#12290;
&#36825;&#20010;&#25805;&#20316;&#26377;&#21487;&#33021;&#24341;&#36215;&#31454;&#24577;&#26465;&#20214;&#65292;&#36825;&#21462;&#20915;&#20110;&#20320;&#30340;&#24212;&#29992;&#31243;&#24207;&#12290; &#35831;&#21442;&#38405;&#21518;&#38754;&#30340;&#8220;&#26356;&#26032;&#22810;&#20010;&#23545;&#35937;&#8221;&#23567;&#33410;&#20197;&#20102;&#35299;&#22914;&#20309;&#23454;&#29616;&#36825;&#31181;&#36731;&#37327;&#30340;&#20462;&#25913;&#65288;&#21482;&#20462;&#25913;&#23545;&#35937;&#30340;&#37096;&#20998;&#23383;&#27573;&#65289;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn208&quot;&gt;UPDATE books_publisher SET
    name = &apos;Apress Publishing&apos;
WHERE id=52;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn209&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&#36873;&#25321;&#23545;&#35937;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&#24403;&#28982;&#65292;&#21019;&#24314;&#26032;&#30340;&#25968;&#25454;&#24211;&#65292;&#24182;&#26356;&#26032;&#20043;&#20013;&#30340;&#25968;&#25454;&#26159;&#24517;&#35201;&#30340;&#65292;&#20294;&#26159;&#65292;&#23545;&#20110; Web &#24212;&#29992;&#31243;&#24207;&#26469;&#35828;&#65292;&#26356;&#22810;&#30340;&#26102;&#20505;&#26159;&#22312;&#26816;&#32034;&#26597;&#35810;&#25968;&#25454;&#24211;&#12290;
&#25105;&#20204;&#24050;&#32463;&#30693;&#36947;&#22914;&#20309;&#20174;&#19968;&#20010;&#32473;&#23450;&#30340;&#27169;&#22411;&#20013;&#21462;&#20986;&#25152;&#26377;&#35760;&#24405;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn212&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.all()
[&amp;lt;Publisher: Apress&amp;gt;, &amp;lt;Publisher: O&apos;Reilly&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn213&quot;&gt;&#36825;&#30456;&#24403;&#20110;&#36825;&#20010;SQL&#35821;&#21477;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn215&quot;&gt;SELECT id, name, address, city, state_province, country, website
FROM books_publisher;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn216&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&#27880;&#24847;&#21040;Django&#22312;&#36873;&#25321;&#25152;&#26377;&#25968;&#25454;&#26102;&#24182;&#27809;&#26377;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SELECT*&lt;/span&gt;&lt;/tt&gt; &#65292;&#32780;&#26159;&#26174;&#24335;&#21015;&#20986;&#20102;&#25152;&#26377;&#23383;&#27573;&#12290; &#35774;&#35745;&#30340;&#26102;&#20505;&#23601;&#26159;&#36825;&#26679;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SELECT*&lt;/span&gt;&lt;/tt&gt; &#20250;&#26356;&#24930;&#65292;&#32780;&#19988;&#26368;&#37325;&#35201;&#30340;&#26159;&#21015;&#20986;&#25152;&#26377;&#23383;&#27573;&#36981;&#24490;&#20102;Python &#30028;&#30340;&#19968;&#20010;&#20449;&#26465;&#65306; &#26126;&#35328;&#32988;&#20110;&#26263;&#31034;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn218&quot;&gt;&#26377;&#20851;Python&#20043;&#31109;(&#25106;&#24459;) :-&#65289;&#65292;&#22312;Python&#25552;&#31034;&#34892;&#36755;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;this&lt;/span&gt;&lt;/tt&gt; &#35797;&#35797;&#30475;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn219&quot;&gt;&#35753;&#25105;&#20204;&#26469;&#20180;&#32454;&#30475;&#30475; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher.objects.all()&lt;/span&gt;&lt;/tt&gt; &#36825;&#34892;&#30340;&#27599;&#20010;&#37096;&#20998;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn220&quot;&gt;&#39318;&#20808;&#65292;&#25105;&#20204;&#26377;&#19968;&#20010;&#24050;&#23450;&#20041;&#30340;&#27169;&#22411; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt; &#12290;&#27809;&#20160;&#20040;&#22909;&#22855;&#24618;&#30340;&#65306; &#20320;&#24819;&#35201;&#26597;&#25214;&#25968;&#25454;&#65292; &#20320;&#23601;&#29992;&#27169;&#22411;&#26469;&#33719;&#24471;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn221&quot;&gt;&#28982;&#21518;&#65292;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;objects&lt;/span&gt;&lt;/tt&gt;&#23646;&#24615;&#12290; &#23427;&#34987;&#31216;&#20026;&#31649;&#29702;&#22120;&#65292;&#25105;&#20204;&#23558;&#22312;&#31532;10&#31456;&#20013;&#35814;&#32454;&#35752;&#35770;&#23427;&#12290; &#30446;&#21069;&#65292;&#25105;&#20204;&#21482;&#38656;&#20102;&#35299;&#31649;&#29702;&#22120;&#31649;&#29702;&#30528;&#25152;&#26377;&#38024;&#23545;&#25968;&#25454;&#21253;&#21547;&#12289;&#36824;&#26377;&#26368;&#37325;&#35201;&#30340;&#25968;&#25454;&#26597;&#35810;&#30340;&#34920;&#26684;&#32423;&#25805;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn222&quot;&gt;&#25152;&#26377;&#30340;&#27169;&#22411;&#37117;&#33258;&#21160;&#25317;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;objects&lt;/span&gt;&lt;/tt&gt; &#31649;&#29702;&#22120;&#65307;&#20320;&#21487;&#20197;&#22312;&#24819;&#35201;&#26597;&#25214;&#25968;&#25454;&#26102;&#20351;&#29992;&#23427;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn223&quot;&gt;&#26368;&#21518;&#65292;&#36824;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;all()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290;&#36825;&#20010;&#26041;&#27861;&#36820;&#22238;&#36820;&#22238;&#25968;&#25454;&#24211;&#20013;&#25152;&#26377;&#30340;&#35760;&#24405;&#12290; &#23613;&#31649;&#36825;&#20010;&#23545;&#35937; &#30475;&#36215;&#26469; &#35937;&#19968;&#20010;&#21015;&#34920;&#65288;list&#65289;&#65292;&#23427;&#23454;&#38469;&#26159;&#19968;&#20010; QuerySet &#23545;&#35937;&#65292; &#36825;&#20010;&#23545;&#35937;&#26159;&#25968;&#25454;&#24211;&#20013;&#19968;&#20123;&#35760;&#24405;&#30340;&#38598;&#21512;&#12290; &#38468;&#24405;C&#23558;&#35814;&#32454;&#25551;&#36848;QuerySet&#12290;
&#29616;&#22312;&#65292;&#25105;&#20204;&#23601;&#20808;&#24403;&#23427;&#26159;&#19968;&#20010;&#20223;&#30495;&#21015;&#34920;&#23545;&#35937;&#22909;&#20102;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn224&quot;&gt;&#25152;&#26377;&#30340;&#25968;&#25454;&#24211;&#26597;&#25214;&#37117;&#36981;&#24490;&#19968;&#20010;&#36890;&#29992;&#27169;&#24335;&#65306;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id15&quot;&gt;
&lt;span id=&quot;cn225&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn225&quot;&gt;&#25968;&#25454;&#36807;&#28388;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn226&quot;&gt;&#25105;&#20204;&#24456;&#23569;&#20250;&#19968;&#27425;&#24615;&#20174;&#25968;&#25454;&#24211;&#20013;&#21462;&#20986;&#25152;&#26377;&#30340;&#25968;&#25454;&#65307;&#36890;&#24120;&#37117;&#21482;&#38024;&#23545;&#19968;&#37096;&#20998;&#25968;&#25454;&#36827;&#34892;&#25805;&#20316;&#12290; &#22312;Django API&#20013;&#65292;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992;`` filter()`` &#26041;&#27861;&#23545;&#25968;&#25454;&#36827;&#34892;&#36807;&#28388;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn228&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.filter(name=&apos;Apress&apos;)
[&amp;lt;Publisher: Apress&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn229&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;filter()&lt;/span&gt;&lt;/tt&gt; &#26681;&#25454;&#20851;&#38190;&#23383;&#21442;&#25968;&#26469;&#36716;&#25442;&#25104; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;WHERE&lt;/span&gt;&lt;/tt&gt; SQL&#35821;&#21477;&#12290;
&#21069;&#38754;&#36825;&#20010;&#20363;&#23376; &#30456;&#24403;&#20110;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn231&quot;&gt;SELECT id, name, address, city, state_province, country, website
FROM books_publisher
WHERE name = &apos;Apress&apos;;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn232&quot;&gt;&#20320;&#21487;&#20197;&#20256;&#36882;&#22810;&#20010;&#21442;&#25968;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;filter()&lt;/span&gt;&lt;/tt&gt; &#26469;&#32553;&#23567;&#36873;&#21462;&#33539;&#22260;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn234&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.filter(country=&quot;U.S.A.&quot;, state_province=&quot;CA&quot;)
[&amp;lt;Publisher: Apress&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn235&quot;&gt;&#22810;&#20010;&#21442;&#25968;&#20250;&#34987;&#36716;&#25442;&#25104; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;AND&lt;/span&gt;&lt;/tt&gt; SQL&#20174;&#21477;&#65292; &#22240;&#27492;&#19978;&#38754;&#30340;&#20195;&#30721;&#21487;&#20197;&#36716;&#21270;&#25104;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn237&quot;&gt;SELECT id, name, address, city, state_province, country, website
FROM books_publisher
WHERE country = &apos;U.S.A.&apos;
AND state_province = &apos;CA&apos;;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn238&quot;&gt;&#27880;&#24847;&#65292;SQL&#32570;&#30465;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;=&lt;/span&gt;&lt;/tt&gt; &#25805;&#20316;&#31526;&#26159;&#31934;&#30830;&#21305;&#37197;&#30340;&#65292; &#20854;&#20182;&#31867;&#22411;&#30340;&#26597;&#25214;&#20063;&#21487;&#20197;&#20351;&#29992;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn240&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.filter(name__contains=&quot;press&quot;)
[&amp;lt;Publisher: Apress&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn241&quot;&gt;&#22312; &lt;em&gt;name&lt;/em&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;contains&lt;/span&gt;&lt;/tt&gt; &#20043;&#38388;&#26377;&#21452;&#19979;&#21010;&#32447;&#12290;&#21644;Python&#19968;&#26679;&#65292;Django&#20063;&#20351;&#29992;&#21452;&#19979;&#21010;&#32447;&#26469;&#34920;&#26126;&#20250;&#36827;&#34892;&#19968;&#20123;&#39764;&#26415;&#33324;&#30340;&#25805;&#20316;&#12290;&#36825;&#37324;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;contains&lt;/span&gt;&lt;/tt&gt;&#37096;&#20998;&#20250;&#34987;Django&#32763;&#35793;&#25104;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LIKE&lt;/span&gt;&lt;/tt&gt;&#35821;&#21477;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn243&quot;&gt;SELECT id, name, address, city, state_province, country, website
FROM books_publisher
WHERE name LIKE &apos;%press%&apos;;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn244&quot;&gt;&#20854;&#20182;&#30340;&#19968;&#20123;&#26597;&#25214;&#31867;&#22411;&#26377;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;icontains&lt;/span&gt;&lt;/tt&gt;(&#22823;&#23567;&#20889;&#26080;&#20851;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LIKE&lt;/span&gt;&lt;/tt&gt;),&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;startswith&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;endswith&lt;/span&gt;&lt;/tt&gt;, &#36824;&#26377;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;range&lt;/span&gt;&lt;/tt&gt;(SQL&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BETWEEN&lt;/span&gt;&lt;/tt&gt;&#26597;&#35810;&#65289;&#12290; &#38468;&#24405;C&#35814;&#32454;&#25551;&#36848;&#20102;&#25152;&#26377;&#30340;&#26597;&#25214;&#31867;&#22411;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id16&quot;&gt;
&lt;span id=&quot;cn245&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn245&quot;&gt;&#33719;&#21462;&#21333;&#20010;&#23545;&#35937;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn246&quot;&gt;&#19978;&#38754;&#30340;&#20363;&#23376;&#20013;`` filter()`` &#20989;&#25968;&#36820;&#22238;&#19968;&#20010;&#35760;&#24405;&#38598;&#65292;&#36825;&#20010;&#35760;&#24405;&#38598;&#26159;&#19968;&#20010;&#21015;&#34920;&#12290;
&#30456;&#23545;&#21015;&#34920;&#26469;&#35828;&#65292;&#26377;&#20123;&#26102;&#20505;&#25105;&#20204;&#26356;&#38656;&#35201;&#33719;&#21462;&#21333;&#20010;&#30340;&#23545;&#35937;&#65292; `` get()`` &#26041;&#27861;&#23601;&#26159;&#22312;&#27492;&#26102;&#20351;&#29992;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn248&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.get(name=&quot;Apress&quot;)
&amp;lt;Publisher: Apress&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn249&quot;&gt;&#36825;&#26679;&#65292;&#23601;&#36820;&#22238;&#20102;&#21333;&#20010;&#23545;&#35937;&#65292;&#32780;&#19981;&#26159;&#21015;&#34920;&#65288;&#26356;&#20934;&#30830;&#30340;&#35828;&#65292;QuerySet)&#12290; &#25152;&#20197;&#65292;&#22914;&#26524;&#32467;&#26524;&#26159;&#22810;&#20010;&#23545;&#35937;&#65292;&#20250;&#23548;&#33268;&#25243;&#20986;&#24322;&#24120;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn251&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.get(country=&quot;U.S.A.&quot;)
Traceback (most recent call last):
    ...
MultipleObjectsReturned: get() returned more than one Publisher --
    it returned 2! Lookup parameters were {&apos;country&apos;: &apos;U.S.A.&apos;}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn252&quot;&gt;&#22914;&#26524;&#26597;&#35810;&#27809;&#26377;&#36820;&#22238;&#32467;&#26524;&#20063;&#20250;&#25243;&#20986;&#24322;&#24120;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn254&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.get(name=&quot;Penguin&quot;)
Traceback (most recent call last):
    ...
DoesNotExist: Publisher matching query does not exist.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn255&quot;&gt;&#36825;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DoesNotExist&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120; &#26159; Publisher &#36825;&#20010; model &#31867;&#30340;&#19968;&#20010;&#23646;&#24615;&#65292;&#21363; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher.DoesNotExist&lt;/span&gt;&lt;/tt&gt;&#12290;&#22312;&#20320;&#30340;&#24212;&#29992;&#20013;&#65292;&#20320;&#21487;&#20197;&#25429;&#33719;&#24182;&#22788;&#29702;&#36825;&#20010;&#24322;&#24120;&#65292;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn257&quot;&gt;try:
    p = Publisher.objects.get(name=&apos;Apress&apos;)
except Publisher.DoesNotExist:
    print &quot;Apress isn&apos;t in the database yet.&quot;
else:
    print &quot;Apress is in the database.&quot;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id17&quot;&gt;
&lt;span id=&quot;cn258&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn258&quot;&gt;&#25968;&#25454;&#25490;&#24207;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn259&quot;&gt;&#22312;&#36816;&#34892;&#21069;&#38754;&#30340;&#20363;&#23376;&#20013;&#65292;&#20320;&#21487;&#33021;&#24050;&#32463;&#27880;&#24847;&#21040;&#36820;&#22238;&#30340;&#32467;&#26524;&#26159;&#26080;&#24207;&#30340;&#12290; &#25105;&#20204;&#36824;&#27809;&#26377;&#21578;&#35785;&#25968;&#25454;&#24211; &#24590;&#26679;&#23545;&#32467;&#26524;&#36827;&#34892;&#25490;&#24207;&#65292;&#25152;&#20197;&#25105;&#20204;&#36820;&#22238;&#30340;&#32467;&#26524;&#26159;&#26080;&#24207;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn260&quot;&gt;&#22312;&#20320;&#30340; Django &#24212;&#29992;&#20013;&#65292;&#20320;&#25110;&#35768;&#24076;&#26395;&#26681;&#25454;&#26576;&#23383;&#27573;&#30340;&#20540;&#23545;&#26816;&#32034;&#32467;&#26524;&#25490;&#24207;&#65292;&#27604;&#22914;&#35828;&#65292;&#25353;&#23383;&#27597;&#39034;&#24207;&#12290; &#37027;&#20040;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;order_by()&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#26041;&#27861;&#23601;&#21487;&#20197;&#25630;&#23450;&#20102;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn262&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.order_by(&quot;name&quot;)
[&amp;lt;Publisher: Apress&amp;gt;, &amp;lt;Publisher: O&apos;Reilly&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn263&quot;&gt;&#36319;&#20197;&#21069;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;all()&lt;/span&gt;&lt;/tt&gt; &#20363;&#23376;&#24046;&#19981;&#22810;&#65292;SQL&#35821;&#21477;&#37324;&#22810;&#20102;&#25351;&#23450;&#25490;&#24207;&#30340;&#37096;&#20998;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn265&quot;&gt;SELECT id, name, address, city, state_province, country, website
FROM books_publisher
ORDER BY name;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn266&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#23545;&#20219;&#24847;&#23383;&#27573;&#36827;&#34892;&#25490;&#24207;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn268&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.order_by(&quot;address&quot;)
[&amp;lt;Publisher: O&apos;Reilly&amp;gt;, &amp;lt;Publisher: Apress&amp;gt;]

&amp;gt;&amp;gt;&amp;gt; Publisher.objects.order_by(&quot;state_province&quot;)
[&amp;lt;Publisher: Apress&amp;gt;, &amp;lt;Publisher: O&apos;Reilly&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn269&quot;&gt;&#22914;&#26524;&#38656;&#35201;&#20197;&#22810;&#20010;&#23383;&#27573;&#20026;&#26631;&#20934;&#36827;&#34892;&#25490;&#24207;&#65288;&#31532;&#20108;&#20010;&#23383;&#27573;&#20250;&#22312;&#31532;&#19968;&#20010;&#23383;&#27573;&#30340;&#20540;&#30456;&#21516;&#30340;&#24773;&#20917;&#19979;&#34987;&#20351;&#29992;&#21040;&#65289;&#65292;&#20351;&#29992;&#22810;&#20010;&#21442;&#25968;&#23601;&#21487;&#20197;&#20102;&#65292;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn271&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.order_by(&quot;state_province&quot;, &quot;address&quot;)
 [&amp;lt;Publisher: Apress&amp;gt;, &amp;lt;Publisher: O&apos;Reilly&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn272&quot;&gt;&#25105;&#20204;&#36824;&#21487;&#20197;&#25351;&#23450;&#36870;&#21521;&#25490;&#24207;&#65292;&#22312;&#21069;&#38754;&#21152;&#19968;&#20010;&#20943;&#21495; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;-&lt;/span&gt;&lt;/tt&gt; &#21069;&#32512;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn274&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.order_by(&quot;-name&quot;)
[&amp;lt;Publisher: O&apos;Reilly&amp;gt;, &amp;lt;Publisher: Apress&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn275&quot;&gt;&#23613;&#31649;&#24456;&#28789;&#27963;&#65292;&#20294;&#26159;&#27599;&#27425;&#37117;&#35201;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;order_by()&lt;/span&gt;&lt;/tt&gt; &#26174;&#24471;&#26377;&#28857;&#21872;&#21990;&#12290; &#22823;&#22810;&#25968;&#26102;&#38388;&#20320;&#36890;&#24120;&#21482;&#20250;&#23545;&#26576;&#20123; &#23383;&#27573;&#36827;&#34892;&#25490;&#24207;&#12290; &#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;Django&#35753;&#20320;&#21487;&#20197;&#25351;&#23450;&#27169;&#22411;&#30340;&#32570;&#30465;&#25490;&#24207;&#26041;&#24335;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn277&quot;&gt;class Publisher(models.Model):
    name = models.CharField(max_length=30)
    address = models.CharField(max_length=50)
    city = models.CharField(max_length=60)
    state_province = models.CharField(max_length=30)
    country = models.CharField(max_length=50)
    website = models.URLField()

    def __unicode__(self):
        return self.name

    **class Meta:**
        **ordering = [&apos;name&apos;]**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn278&quot;&gt;&#29616;&#22312;&#65292;&#35753;&#25105;&#20204;&#26469;&#25509;&#35302;&#19968;&#20010;&#26032;&#30340;&#27010;&#24565;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Meta&lt;/span&gt;&lt;/tt&gt;&#65292;&#20869;&#23884;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#31867;&#30340;&#23450;&#20041;&#20013;&#65288;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt; &#26159;&#39030;&#26684;&#30340;&#65292;&#37027;&#20040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Meta&lt;/span&gt;&lt;/tt&gt; &#22312;&#23427;&#20043;&#19979;&#35201;&#32553;&#36827;4&#20010;&#31354;&#26684;&#65293;&#65293;&#25353; Python &#30340;&#20256;&#32479; &#65289;&#12290;&#20320;&#21487;&#20197;&#22312;&#20219;&#24847;&#19968;&#20010; &#27169;&#22411; &#31867;&#20013;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Meta&lt;/span&gt;&lt;/tt&gt; &#31867;&#65292;&#26469;&#35774;&#32622;&#19968;&#20123;&#19982;&#29305;&#23450;&#27169;&#22411;&#30456;&#20851;&#30340;&#36873;&#39033;&#12290; &#22312; &#38468;&#24405;B &#20013;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Meta&lt;/span&gt;&lt;/tt&gt; &#20013;&#25152;&#26377;&#21487;&#36873;&#39033;&#30340;&#23436;&#25972;&#21442;&#32771;&#65292;&#29616;&#22312;&#65292;&#25105;&#20204;&#20851;&#27880; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ordering&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#36873;&#39033;&#23601;&#22815;&#20102;&#12290; &#22914;&#26524;&#20320;&#35774;&#32622;&#20102;&#36825;&#20010;&#36873;&#39033;&#65292;&#37027;&#20040;&#38500;&#38750;&#20320;&#26816;&#32034;&#26102;&#29305;&#24847;&#39069;&#22806;&#22320;&#20351;&#29992;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;order_by()&lt;/span&gt;&lt;/tt&gt;&#65292;&#21542;&#21017;&#65292;&#24403;&#20320;&#20351;&#29992; Django &#30340;&#25968;&#25454;&#24211; API &#21435;&#26816;&#32034;&#26102;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#30340;&#30456;&#20851;&#36820;&#22238;&#20540;&#40664;&#35748;&#22320;&#37117;&#20250;&#25353; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt; &#23383;&#27573;&#25490;&#24207;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id18&quot;&gt;
&lt;span id=&quot;cn279&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn279&quot;&gt;&#36830;&#38145;&#26597;&#35810;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn280&quot;&gt;&#25105;&#20204;&#24050;&#32463;&#30693;&#36947;&#22914;&#20309;&#23545;&#25968;&#25454;&#36827;&#34892;&#36807;&#28388;&#21644;&#25490;&#24207;&#12290; &#24403;&#28982;&#65292;&#36890;&#24120;&#25105;&#20204;&#38656;&#35201;&#21516;&#26102;&#36827;&#34892;&#36807;&#28388;&#21644;&#25490;&#24207;&#26597;&#35810;&#30340;&#25805;&#20316;&#12290; &#22240;&#27492;&#65292;&#20320;&#21487;&#20197;&#31616;&#21333;&#22320;&#20889;&#25104;&#36825;&#31181;&#8220;&#38142;&#24335;&#8221;&#30340;&#24418;&#24335;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn282&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.filter(country=&quot;U.S.A.&quot;).order_by(&quot;-name&quot;)
[&amp;lt;Publisher: O&apos;Reilly&amp;gt;, &amp;lt;Publisher: Apress&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn283&quot;&gt;&#20320;&#24212;&#35813;&#27809;&#29468;&#38169;&#65292;&#36716;&#25442;&#25104;SQL&#26597;&#35810;&#23601;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;WHERE&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;BY&lt;/span&gt;&lt;/tt&gt; &#30340;&#32452;&#21512;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn285&quot;&gt;SELECT id, name, address, city, state_province, country, website
FROM books_publisher
WHERE country = &apos;U.S.A&apos;
ORDER BY name DESC;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id19&quot;&gt;
&lt;span id=&quot;cn286&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn286&quot;&gt;&#38480;&#21046;&#36820;&#22238;&#30340;&#25968;&#25454;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn287&quot;&gt;&#21478;&#19968;&#20010;&#24120;&#29992;&#30340;&#38656;&#27714;&#23601;&#26159;&#21462;&#20986;&#22266;&#23450;&#25968;&#30446;&#30340;&#35760;&#24405;&#12290; &#24819;&#35937;&#19968;&#19979;&#20320;&#26377;&#25104;&#21315;&#19978;&#19975;&#30340;&#20986;&#29256;&#21830;&#22312;&#20320;&#30340;&#25968;&#25454;&#24211;&#37324;&#65292; &#20294;&#26159;&#20320;&#21482;&#24819;&#26174;&#31034;&#31532;&#19968;&#20010;&#12290; &#20320;&#21487;&#20197;&#20351;&#29992;&#26631;&#20934;&#30340;Python&#21015;&#34920;&#35009;&#21098;&#35821;&#21477;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn289&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.order_by(&apos;name&apos;)[0]
&amp;lt;Publisher: Apress&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn290&quot;&gt;&#36825;&#30456;&#24403;&#20110;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn292&quot;&gt;SELECT id, name, address, city, state_province, country, website
FROM books_publisher
ORDER BY name
LIMIT 1;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn293&quot;&gt;&#31867;&#20284;&#30340;&#65292;&#20320;&#21487;&#20197;&#29992;Python&#30340;range-slicing&#35821;&#27861;&#26469;&#21462;&#20986;&#25968;&#25454;&#30340;&#29305;&#23450;&#23376;&#38598;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn295&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.order_by(&apos;name&apos;)[0:2]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn296&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#36820;&#22238;&#20004;&#20010;&#23545;&#35937;&#65292;&#31561;&#21516;&#20110;&#20197;&#19979;&#30340;SQL&#35821;&#21477;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn298&quot;&gt;SELECT id, name, address, city, state_province, country, website
FROM books_publisher
ORDER BY name
OFFSET 0 LIMIT 2;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn299&quot;&gt;&#27880;&#24847;&#65292;&#19981;&#25903;&#25345;Python&#30340;&#36127;&#32034;&#24341;(negative slicing)&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn301&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.order_by(&apos;name&apos;)[-1]
Traceback (most recent call last):
  ...
AssertionError: Negative indexing is not supported.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn302&quot;&gt;&#34429;&#28982;&#19981;&#25903;&#25345;&#36127;&#32034;&#24341;&#65292;&#20294;&#26159;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992;&#20854;&#20182;&#30340;&#26041;&#27861;&#12290; &#27604;&#22914;&#65292;&#31245;&#24494;&#20462;&#25913; order_by() &#35821;&#21477;&#26469;&#23454;&#29616;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn304&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.order_by(&apos;-name&apos;)[0]
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id20&quot;&gt;
&lt;span id=&quot;cn305&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn305&quot;&gt;&#26356;&#26032;&#22810;&#20010;&#23545;&#35937;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn306&quot;&gt;&#22312;&#8220;&#25554;&#20837;&#21644;&#26356;&#26032;&#25968;&#25454;&#8221;&#23567;&#33410;&#20013;&#65292;&#25105;&#20204;&#26377;&#25552;&#21040;&#27169;&#22411;&#30340;save()&#26041;&#27861;&#65292;&#36825;&#20010;&#26041;&#27861;&#20250;&#26356;&#26032;&#19968;&#34892;&#37324;&#30340;&#25152;&#26377;&#21015;&#12290; &#32780;&#26576;&#20123;&#24773;&#20917;&#19979;&#65292;&#25105;&#20204;&#21482;&#38656;&#35201;&#26356;&#26032;&#34892;&#37324;&#30340;&#26576;&#20960;&#21015;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn307&quot;&gt;&#20363;&#22914;&#35828;&#25105;&#20204;&#29616;&#22312;&#24819;&#35201;&#23558;Apress Publisher&#30340;&#21517;&#31216;&#30001;&#21407;&#26469;&#30340;&#8221;Apress&#8221;&#26356;&#25913;&#20026;&#8221;Apress Publishing&#8221;&#12290;&#33509;&#20351;&#29992;save()&#26041;&#27861;&#65292;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn309&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p = Publisher.objects.get(name=&apos;Apress&apos;)
&amp;gt;&amp;gt;&amp;gt; p.name = &apos;Apress Publishing&apos;
&amp;gt;&amp;gt;&amp;gt; p.save()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn310&quot;&gt;&#36825;&#31561;&#21516;&#20110;&#22914;&#19979;SQL&#35821;&#21477;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn312&quot;&gt;SELECT id, name, address, city, state_province, country, website
FROM books_publisher
WHERE name = &apos;Apress&apos;;

UPDATE books_publisher SET
    name = &apos;Apress Publishing&apos;,
    address = &apos;2855 Telegraph Ave.&apos;,
    city = &apos;Berkeley&apos;,
    state_province = &apos;CA&apos;,
    country = &apos;U.S.A.&apos;,
    website = &apos;http://www.apress.com&apos;
WHERE id = 52;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn313&quot;&gt;&#65288;&#27880;&#24847;&#22312;&#36825;&#37324;&#25105;&#20204;&#20551;&#35774;Apress&#30340;ID&#20026;52&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn314&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#37324;&#25105;&#20204;&#21487;&#20197;&#30475;&#21040;Django&#30340;save()&#26041;&#27861;&#26356;&#26032;&#20102;&#19981;&#20165;&#20165;&#26159;name&#21015;&#30340;&#20540;&#65292;&#36824;&#26377;&#26356;&#26032;&#20102;&#25152;&#26377;&#30340;&#21015;&#12290; &#33509;name&#20197;&#22806;&#30340;&#21015;&#26377;&#21487;&#33021;&#20250;&#34987;&#20854;&#20182;&#30340;&#36827;&#31243;&#25152;&#25913;&#21160;&#30340;&#24773;&#20917;&#19979;&#65292;&#21482;&#26356;&#25913;name&#21015;&#26174;&#28982;&#26159;&#26356;&#21152;&#26126;&#26234;&#30340;&#12290; &#26356;&#25913;&#26576;&#19968;&#25351;&#23450;&#30340;&#21015;&#65292;&#25105;&#20204;&#21487;&#20197;&#35843;&#29992;&#32467;&#26524;&#38598;&#65288;QuerySet&#65289;&#23545;&#35937;&#30340;update()&#26041;&#27861;&#65306; &#31034;&#20363;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn316&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.filter(id=52).update(name=&apos;Apress Publishing&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn317&quot;&gt;&#19982;&#20043;&#31561;&#21516;&#30340;SQL&#35821;&#21477;&#21464;&#24471;&#26356;&#39640;&#25928;&#65292;&#24182;&#19988;&#19981;&#20250;&#24341;&#36215;&#31454;&#24577;&#26465;&#20214;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn319&quot;&gt;UPDATE books_publisher
SET name = &apos;Apress Publishing&apos;
WHERE id = 52;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn320&quot;&gt;update()&#26041;&#27861;&#23545;&#20110;&#20219;&#20309;&#32467;&#26524;&#38598;&#65288;QuerySet&#65289;&#22343;&#26377;&#25928;&#65292;&#36825;&#24847;&#21619;&#30528;&#20320;&#21487;&#20197;&#21516;&#26102;&#26356;&#26032;&#22810;&#26465;&#35760;&#24405;&#12290;
&#20197;&#19979;&#31034;&#20363;&#28436;&#31034;&#22914;&#20309;&#23558;&#25152;&#26377;Publisher&#30340;country&#23383;&#27573;&#20540;&#30001;&#8217;U.S.A&#8217;&#26356;&#25913;&#20026;&#8217;USA&#8217;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn322&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.all().update(country=&apos;USA&apos;)
2
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn323&quot;&gt;update()&#26041;&#27861;&#20250;&#36820;&#22238;&#19968;&#20010;&#25972;&#22411;&#25968;&#20540;&#65292;&#34920;&#31034;&#21463;&#24433;&#21709;&#30340;&#35760;&#24405;&#26465;&#25968;&#12290; &#22312;&#19978;&#38754;&#30340;&#20363;&#23376;&#20013;&#65292;&#36825;&#20010;&#20540;&#26159;2&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id21&quot;&gt;
&lt;span id=&quot;cn324&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn324&quot;&gt;&#21024;&#38500;&#23545;&#35937;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn325&quot;&gt;&#21024;&#38500;&#25968;&#25454;&#24211;&#20013;&#30340;&#23545;&#35937;&#21482;&#38656;&#35843;&#29992;&#35813;&#23545;&#35937;&#30340;delete()&#26041;&#27861;&#21363;&#21487;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn327&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p = Publisher.objects.get(name=&quot;O&apos;Reilly&quot;)
&amp;gt;&amp;gt;&amp;gt; p.delete()
&amp;gt;&amp;gt;&amp;gt; Publisher.objects.all()
[&amp;lt;Publisher: Apress Publishing&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn328&quot;&gt;&#21516;&#26679;&#25105;&#20204;&#21487;&#20197;&#22312;&#32467;&#26524;&#38598;&#19978;&#35843;&#29992;delete()&#26041;&#27861;&#21516;&#26102;&#21024;&#38500;&#22810;&#26465;&#35760;&#24405;&#12290;&#36825;&#19968;&#28857;&#19982;&#25105;&#20204;&#19978;&#19968;&#23567;&#33410;&#25552;&#21040;&#30340;update()&#26041;&#27861;&#30456;&#20284;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn330&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.filter(country=&apos;USA&apos;).delete()
&amp;gt;&amp;gt;&amp;gt; Publisher.objects.all().delete()
&amp;gt;&amp;gt;&amp;gt; Publisher.objects.all()
[]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn331&quot;&gt;&#21024;&#38500;&#25968;&#25454;&#26102;&#35201;&#35880;&#24910;&#65281; &#20026;&#20102;&#39044;&#38450;&#35823;&#21024;&#38500;&#25481;&#26576;&#19968;&#20010;&#34920;&#20869;&#30340;&#25152;&#26377;&#25968;&#25454;&#65292;Django&#35201;&#27714;&#22312;&#21024;&#38500;&#34920;&#20869;&#25152;&#26377;&#25968;&#25454;&#26102;&#26174;&#31034;&#20351;&#29992;all()&#12290; &#27604;&#22914;&#65292;&#19979;&#38754;&#30340;&#25805;&#20316;&#23558;&#20250;&#20986;&#38169;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn333&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.delete()
Traceback (most recent call last):
  File &quot;&amp;lt;console&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
AttributeError: &apos;Manager&apos; object has no attribute &apos;delete&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn334&quot;&gt;&#32780;&#19968;&#26086;&#20351;&#29992;all()&#26041;&#27861;&#65292;&#25152;&#26377;&#25968;&#25454;&#23558;&#20250;&#34987;&#21024;&#38500;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn336&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.all().delete()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn337&quot;&gt;&#22914;&#26524;&#21482;&#38656;&#35201;&#21024;&#38500;&#37096;&#20998;&#30340;&#25968;&#25454;&#65292;&#23601;&#19981;&#38656;&#35201;&#35843;&#29992;all()&#26041;&#27861;&#12290;&#20877;&#30475;&#19968;&#19979;&#20043;&#21069;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn339&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Publisher.objects.filter(country=&apos;USA&apos;).delete()
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id22&quot;&gt;
&lt;span id=&quot;cn340&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn340&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn341&quot;&gt;&#36890;&#36807;&#26412;&#31456;&#30340;&#23398;&#20064;&#65292;&#20320;&#24212;&#35813;&#21487;&#20197;&#29087;&#32451;&#22320;&#20351;&#29992;Django&#27169;&#22411;&#26469;&#32534;&#20889;&#19968;&#20123;&#31616;&#21333;&#30340;&#25968;&#25454;&#24211;&#24212;&#29992;&#31243;&#24207;&#12290; &#22312;&#31532;&#21313;&#31456;&#25105;&#20204;&#23558;&#35752;&#35770;Django&#25968;&#25454;&#24211;&#23618;&#30340;&#39640;&#32423;&#24212;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn342&quot;&gt;&#19968;&#26086;&#20320;&#23450;&#20041;&#20102;&#20320;&#30340;&#27169;&#22411;&#65292;&#25509;&#19979;&#26469;&#23601;&#26159;&#35201;&#25226;&#25968;&#25454;&#23548;&#20837;&#25968;&#25454;&#24211;&#37324;&#20102;&#12290; &#20320;&#21487;&#33021;&#24050;&#32463;&#26377;&#29616;&#25104;&#30340;&#25968;&#25454;&#20102;&#65292;&#35831;&#30475;&#31532;&#21313;&#20843;&#31456;&#20197;&#33719;&#24471;&#26377;&#20851;&#22914;&#20309;&#38598;&#25104;&#29616;&#26377;&#25968;&#25454;&#24211;&#30340;&#24314;&#35758;&#12290;
&#20063;&#21487;&#33021;&#25968;&#25454;&#26159;&#29992;&#25143;&#25552;&#20379;&#30340;&#65292;&#31532;&#19971;&#31456;&#20013;&#36824;&#20250;&#25945;&#20320;&#24590;&#20040;&#22788;&#29702;&#29992;&#25143;&#25552;&#20132;&#30340;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn343&quot;&gt;&#26377;&#26102;&#20505;&#65292;&#20320;&#21644;&#20320;&#30340;&#22242;&#38431;&#25104;&#21592;&#20063;&#38656;&#35201;&#25163;&#24037;&#36755;&#20837;&#25968;&#25454;&#65292;&#36825;&#26102;&#20505;&#22914;&#26524;&#26377;&#19968;&#20010;&#22522;&#20110;Web&#30340;&#25968;&#25454;&#36755;&#20837;&#21644;&#31649;&#29702;&#30340;&#30028;&#38754;&#23601;&#20250;&#24456;&#26377;&#24110;&#21161;&#12290; &#19979;&#19968;&#31456;&#23558;&#20171;&#32461;&#35299;&#20915;&#25163;&#24037;&#24405;&#20837;&#38382;&#39064;&#30340;&#26041;&#27861;&#8212;&#8212;Django&#31649;&#29702;&#30028;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn344&quot;&gt;the GNU Free Document License Hosting graciously provided by&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</summary>
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;5&#31456; &#27169;&#22411;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#22312;&#31532;&#19977;&#31456;&#65292;&#25105;&#20204;&#35762;&#36848;&#20102;&#29992; Django &#24314;&#36896;&#32593;&#31449;&#30340;&#22522;&#26412;&#36884;&#24452;&#65306; &#24314;&#31435;&#35270;&#22270;&#21644; URLConf &#12290; &#27491;&#22914;&#25105;&#20204;&#25152;&#38416;&#36848;&#30340;&#65292;&#35270;&#22270;&#36127;&#36131;&#22788;&#29702;&lt;em&gt;&#19968;&#20123;&#20027;&#35266;&#36923;&#36753;&lt;/em&gt;&#65292;&#28982;&#21518;&#36820;&#22238;&#21709;&#24212;&#32467;&#26524;&#12290; &#20316;&#20026;&#20363;&#23376;&#20043;&#19968;&#65292;&#25105;&#20204;&#30340;&#20027;&#35266;&#36923;&#36753;&#26159;&#35201;&#35745;&#31639;&#24403;&#21069;&#30340;&#26085;&#26399;&#21644;&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#22312;&#24403;&#20195; Web &#24212;&#29992;&#20013;&#65292;&#20027;&#35266;&#36923;&#36753;&#32463;&#24120;&#29301;&#28041;&#21040;&#19982;&#25968;&#25454;&#24211;&#30340;&#20132;&#20114;&#12290; &lt;em&gt;&#25968;&#25454;&#24211;&#39537;&#21160;&#32593;&#31449;&lt;/em&gt; &#22312;&#21518;&#21488;&#36830;&#25509;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#65292;&#20174;&#20013;&#21462;&#20986;&#19968;&#20123;&#25968;&#25454;&#65292;&#28982;&#21518;&#22312; Web &#39029;&#38754;&#29992;&#28418;&#20142;&#30340;&#26684;&#24335;&#23637;&#31034;&#36825;&#20123;&#25968;&#25454;&#12290; &#36825;&#20010;&#32593;&#31449;&#20063;&#21487;&#33021;&#20250;&#21521;&#35775;&#38382;&#32773;&#25552;&#20379;&#20462;&#25913;&#25968;&#25454;&#24211;&#25968;&#25454;&#30340;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#35768;&#22810;&#22797;&#26434;&#30340;&#32593;&#31449;&#37117;&#25552;&#20379;&#20102;&#20197;&#19978;&#20004;&#20010;&#21151;&#33021;&#30340;&#26576;&#31181;&#32467;&#21512;&#12290; &#20363;&#22914; Amazon.com &#23601;&#26159;&#19968;&#20010;&#25968;&#25454;&#24211;&#39537;&#21160;&#31449;&#28857;&#30340;&#33391;&#22909;&#33539;&#20363;&#12290; &#26412;&#36136;&#19978;&#65292;&#27599;&#20010;&#20135;&#21697;&#39029;&#38754;&#37117;&#26159;&#25968;&#25454;&#24211;&#20013;&#25968;&#25454;&#20197; HTML&#26684;&#24335;&#36827;&#34892;&#30340;&#23637;&#29616;&#65292;&#32780;&#24403;&#20320;&#21457;&#34920;&#23458;&#25143;&#35780;&#35770;&#26102;&#65292;&#35813;&#35780;&#35770;&#34987;&#25554;&#20837;&#35780;&#35770;&#25968;&#25454;&#24211;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#30001;&#20110;&#20808;&#22825;&#20855;&#22791; Python &#31616;&#21333;&#32780;&#24378;&#22823;&#30340;&#25968;&#25454;&#24211;&#26597;&#35810;&#25191;&#34892;&#26041;&#27861;&#65292;Django &#38750;&#24120;&#36866;&#21512;&#24320;&#21457;&#25968;&#25454;&#24211;&#39537;&#21160;&#32593;&#31449;&#12290; &#26412;&#31456;&#28145;&#20837;&#20171;&#32461;&#20102;&#35813;&#21151;&#33021;&#65306; Django &#25968;&#25454;&#24211;&#23618;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&#65288;&#27880;&#24847;&#65306; &#23613;&#31649;&#23545; Django &#25968;&#25454;&#24211;&#23618;&#30340;&#20351;&#29992;&#20013;&#24182;&#19981;&#29305;&#21035;&#24378;&#35843;&#36825;&#28857;&#65292;&#20294;&#26159;&#25105;&#20204;&#36824;&#26159;&#24378;&#28872;&#24314;&#35758;&#24744;&#25484;&#25569;&#19968;&#20123;&#25968;&#25454;&#24211;&#21644; SQL &#21407;&#29702;&#12290; &#23545;&#36825;&#20123;&#27010;&#24565;&#30340;&#20171;&#32461;&#36229;&#36234;&#20102;&#26412;&#20070;&#30340;&#33539;&#22260;&#65292;&#20294;&#23601;&#31639;&#20320;&#26159;&#25968;&#25454;&#24211;&#26041;&#38754;&#30340;&#33756;&#40479;&#65292;&#25105;&#20204;&#20063;&#24314;&#35758;&#20320;&#32487;&#32493;&#38405;&#35835;&#12290; &#20320;&#20063;&#35768;&#33021;&#22815;&#36319;&#19978;&#36827;&#24230;&#65292;&#24182;&#22312;&#19978;&#19979;&#25991;&#23398;&#20064;&#36807;&#31243;&#20013;&#25484;&#25569;&#19968;&#20123;&#27010;&#24565;&#12290;&#65289;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn6&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&#22312;&#35270;&#22270;&#20013;&#36827;&#34892;&#25968;&#25454;&#24211;&#26597;&#35810;&#30340;&#31528;&#26041;&#27861;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#27491;&#22914;&#31532;&#19977;&#31456;&#35814;&#32454;&#20171;&#32461;&#30340;&#37027;&#20010;&#22312;&#35270;&#22270;&#20013;&#36755;&#20986; HTML &#30340;&#31528;&#26041;&#27861;&#65288;&#36890;&#36807;&#22312;&#35270;&#22270;&#37324;&#23545;&#25991;&#26412;&#30452;&#25509;&#30828;&#32534;&#30721;HTML&#65289;&#65292;&#22312;&#35270;&#22270;&#20013;&#20063;&#26377;&#31528;&#26041;&#27861;&#21487;&#20197;&#20174;&#25968;&#25454;&#24211;&#20013;&#33719;&#21462;&#25968;&#25454;&#12290; &#24456;&#31616;&#21333;&#65306;
&#29992;&#29616;&#26377;&#30340;&#20219;&#20309; Python &#31867;&#24211;&#25191;&#34892;&#19968;&#26465; SQL &#26597;&#35810;&#24182;&#23545;&#32467;&#26524;&#36827;&#34892;&#19968;&#20123;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#22312;&#26412;&#20363;&#30340;&#35270;&#22270;&#20013;&#65292;&#25105;&#20204;&#20351;&#29992;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MySQLdb&lt;/span&gt;&lt;/tt&gt; &#31867;&#24211;&#65288;&#21487;&#20197;&#20174; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-mysql/&quot;&gt;http://www.djangoproject.com/r/python-mysql/&lt;/a&gt; &#33719;&#24471;&#65289;&#26469;&#36830;&#25509; MySQL &#25968;&#25454;&#24211;&#65292;&#21462;&#22238;&#19968;&#20123;&#35760;&#24405;&#65292;&#23558;&#23427;&#20204;&#25552;&#20379;&#32473;&#27169;&#26495;&#20197;&#26174;&#31034;&#19968;&#20010;&#32593;&#39029;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn10&quot;&gt;from django.shortcuts import render_to_response
import MySQLdb

def book_list(request):
    db = MySQLdb.connect(user=&apos;me&apos;, db=&apos;mydb&apos;, passwd=&apos;secret&apos;, host=&apos;localhost&apos;)
    cursor = db.cursor()
    cursor.execute(&apos;SELECT name FROM books ORDER BY name&apos;)
    names = [row[0] for row in cursor.fetchall()]
    db.close()
    return render_to_response(&apos;book_list.html&apos;, {&apos;names&apos;: names})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#36825;&#20010;&#26041;&#27861;&#21487;&#29992;&#65292;&#20294;&#24456;&#24555;&#19968;&#20123;&#38382;&#39064;&#23558;&#20986;&#29616;&#22312;&#20320;&#38754;&#21069;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn12&quot;&gt;&#25105;&#20204;&#23558;&#25968;&#25454;&#24211;&#36830;&#25509;&#21442;&#25968;&#30828;&#34892;&#32534;&#30721;&#20110;&#20195;&#30721;&#20043;&#20013;&#12290; &#29702;&#24819;&#24773;&#20917;&#19979;&#65292;&#36825;&#20123;&#21442;&#25968;&#24212;&#24403;&#20445;&#23384;&#22312; Django &#37197;&#32622;&#20013;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn13&quot;&gt;&#25105;&#20204;&#19981;&#24471;&#19981;&#37325;&#22797;&#21516;&#26679;&#30340;&#20195;&#30721;&#65306; &#21019;&#24314;&#25968;&#25454;&#24211;&#36830;&#25509;&#12289;&#21019;&#24314;&#25968;&#25454;&#24211;&#28216;&#26631;&#12289;&#25191;&#34892;&#26576;&#20010;&#35821;&#21477;&#12289;&#28982;&#21518;&#20851;&#38381;&#25968;&#25454;&#24211;&#12290; &#29702;&#24819;&#24773;&#20917;&#19979;&#65292;&#25105;&#20204;&#25152;&#38656;&#35201;&#24212;&#35813;&#21482;&#26159;&#25351;&#23450;&#25152;&#38656;&#30340;&#32467;&#26524;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn14&quot;&gt;&#23427;&#25226;&#25105;&#20204;&#26643;&#27515;&#22312; MySQL &#20043;&#19978;&#12290; &#22914;&#26524;&#36807;&#27573;&#26102;&#38388;&#65292;&#25105;&#20204;&#35201;&#20174; MySQL &#25442;&#21040; PostgreSQL&#65292;&#23601;&#19981;&#24471;&#19981;&#20351;&#29992;&#19981;&#21516;&#30340;&#25968;&#25454;&#24211;&#36866;&#37197;&#22120;&#65288;&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;psycopg&lt;/span&gt;&lt;/tt&gt; &#32780;&#19981;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MySQLdb&lt;/span&gt;&lt;/tt&gt; &#65289;&#65292;&#25913;&#21464;&#36830;&#25509;&#21442;&#25968;&#65292;&#26681;&#25454; SQL &#35821;&#21477;&#30340;&#31867;&#22411;&#21487;&#33021;&#36824;&#35201;&#20462;&#25913;SQL &#12290; &#29702;&#24819;&#24773;&#20917;&#19979;&#65292;&#24212;&#23545;&#25152;&#20351;&#29992;&#30340;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#36827;&#34892;&#25277;&#35937;&#65292;&#36825;&#26679;&#19968;&#26469;&#21482;&#22312;&#19968;&#22788;&#20462;&#25913;&#21363;&#21487;&#21464;&#25442;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#12290; &#65288;&#22914;&#26524;&#20320;&#27491;&#22312;&#24314;&#31435;&#19968;&#20010;&#24320;&#28304;&#30340;Django&#24212;&#29992;&#31243;&#24207;&#26469;&#23613;&#21487;&#33021;&#35753;&#26356;&#22810;&#20154;&#20351;&#29992;&#30340;&#35805;&#65292;&#36825;&#20010;&#29305;&#24615;&#26159;&#38750;&#24120;&#36866;&#24403;&#30340;&#12290;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#27491;&#22914;&#20320;&#25152;&#26399;&#24453;&#30340;&#65292;Django&#25968;&#25454;&#24211;&#23618;&#27491;&#26159;&#33268;&#21147;&#20110;&#35299;&#20915;&#36825;&#20123;&#38382;&#39064;&#12290; &#20197;&#19979;&#25552;&#21069;&#25581;&#31034;&#20102;&#22914;&#20309;&#20351;&#29992; Django &#25968;&#25454;&#24211; API &#37325;&#20889;&#20043;&#21069;&#37027;&#20010;&#35270;&#22270;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn17&quot;&gt;from django.shortcuts import render_to_response
from mysite.books.models import Book

def book_list(request):
    books = Book.objects.order_by(&apos;name&apos;)
    return render_to_response(&apos;book_list.html&apos;, {&apos;books&apos;: books})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#25105;&#20204;&#23558;&#22312;&#26412;&#31456;&#31245;&#21518;&#30340;&#22320;&#26041;&#35299;&#37322;&#36825;&#27573;&#20195;&#30721;&#12290; &#30446;&#21069;&#32780;&#35328;&#65292;&#20165;&#38656;&#23545;&#23427;&#26377;&#20010;&#22823;&#33268;&#30340;&#35748;&#35782;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;mtv&quot;&gt;
&lt;span id=&quot;cn19&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn19&quot;&gt;MTV &#24320;&#21457;&#27169;&#24335;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#22312;&#38075;&#30740;&#26356;&#22810;&#20195;&#30721;&#20043;&#21069;&#65292;&#35753;&#25105;&#20204;&#20808;&#33457;&#28857;&#26102;&#38388;&#32771;&#34385;&#19979; Django &#25968;&#25454;&#39537;&#21160; Web &#24212;&#29992;&#30340;&#24635;&#20307;&#35774;&#35745;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#25105;&#20204;&#22312;&#21069;&#38754;&#31456;&#33410;&#25552;&#21040;&#36807;&#65292;Django &#30340;&#35774;&#35745;&#40723;&#21169;&#26494;&#32806;&#21512;&#21450;&#23545;&#24212;&#29992;&#31243;&#24207;&#20013;&#19981;&#21516;&#37096;&#20998;&#30340;&#20005;&#26684;&#20998;&#21106;&#12290; &#36981;&#24490;&#36825;&#20010;&#29702;&#24565;&#30340;&#35805;&#65292;&#35201;&#24819;&#20462;&#25913;&#24212;&#29992;&#30340;&#26576;&#37096;&#20998;&#32780;&#19981;&#24433;&#21709;&#20854;&#23427;&#37096;&#20998;&#23601;&#27604;&#36739;&#23481;&#26131;&#20102;&#12290; &#22312;&#35270;&#22270;&#20989;&#25968;&#20013;&#65292;&#25105;&#20204;&#24050;&#32463;&#35752;&#35770;&#20102;&#36890;&#36807;&#27169;&#26495;&#31995;&#32479;&#25226;&#19994;&#21153;&#36923;&#36753;&#21644;&#34920;&#29616;&#36923;&#36753;&#20998;&#38548;&#24320;&#30340;&#37325;&#35201;&#24615;&#12290; &#22312;&#25968;&#25454;&#24211;&#23618;&#20013;&#65292;&#25105;&#20204;&#23545;&#25968;&#25454;&#35775;&#38382;&#36923;&#36753;&#20063;&#24212;&#29992;&#20102;&#21516;&#26679;&#30340;&#29702;&#24565;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&#25226;&#25968;&#25454;&#23384;&#21462;&#36923;&#36753;&#12289;&#19994;&#21153;&#36923;&#36753;&#21644;&#34920;&#29616;&#36923;&#36753;&#32452;&#21512;&#22312;&#19968;&#36215;&#30340;&#27010;&#24565;&#26377;&#26102;&#34987;&#31216;&#20026;&#36719;&#20214;&#26550;&#26500;&#30340; &lt;em&gt;Model-View-Controller&lt;/em&gt; (MVC)&#27169;&#24335;&#12290; &#22312;&#36825;&#20010;&#27169;&#24335;&#20013;&#65292; Model &#20195;&#34920;&#25968;&#25454;&#23384;&#21462;&#23618;&#65292;View &#20195;&#34920;&#30340;&#26159;&#31995;&#32479;&#20013;&#36873;&#25321;&#26174;&#31034;&#20160;&#20040;&#21644;&#24590;&#20040;&#26174;&#31034;&#30340;&#37096;&#20998;&#65292;Controller &#25351;&#30340;&#26159;&#31995;&#32479;&#20013;&#26681;&#25454;&#29992;&#25143;&#36755;&#20837;&#24182;&#35270;&#38656;&#35201;&#35775;&#38382;&#27169;&#22411;&#65292;&#20197;&#20915;&#23450;&#20351;&#29992;&#21738;&#20010;&#35270;&#22270;&#30340;&#37027;&#37096;&#20998;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#20026;&#20160;&#20040;&#29992;&#32553;&#20889;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#20687; MVC &#36825;&#26679;&#30340;&#26126;&#30830;&#23450;&#20041;&#27169;&#24335;&#30340;&#20027;&#35201;&#29992;&#20110;&#25913;&#21892;&#24320;&#21457;&#20154;&#21592;&#20043;&#38388;&#30340;&#27807;&#36890;&#12290; &#27604;&#36215;&#21578;&#35785;&#21516;&#20107;&#65292;&#8220;&#35753;&#25105;&#20204;&#37319;&#29992;&#25277;&#35937;&#30340;&#25968;&#25454;&#23384;&#21462;&#26041;&#24335;&#65292;&#28982;&#21518;&#21333;&#29420;&#21010;&#20998;&#19968;&#23618;&#26469;&#26174;&#31034;&#25968;&#25454;&#65292;&#24182;&#19988;&#22312;&#20013;&#38388;&#21152;&#19978;&#19968;&#20010;&#25511;&#21046;&#23427;&#30340;&#23618;&#8221;&#65292;&#19968;&#20010;&#36890;&#29992;&#30340;&#35828;&#27861;&#20250;&#35753;&#20320;&#25910;&#30410;&#65292;&#20320;&#21482;&#38656;&#35201;&#35828;&#65306;&#8220;&#25105;&#20204;&#22312;&#36825;&#37324;&#20351;&#29992;MVC&#27169;&#24335;&#21543;&#12290;&#8221;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;Django &#32039;&#32039;&#22320;&#36981;&#24490;&#36825;&#31181; MVC &#27169;&#24335;&#65292;&#21487;&#20197;&#31216;&#24471;&#19978;&#26159;&#19968;&#31181; MVC &#26694;&#26550;&#12290; &#20197;&#19979;&#26159; Django &#20013; M&#12289;V &#21644; C &#21508;&#33258;&#30340;&#21547;&#20041;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn26&quot;&gt;&lt;em&gt;M&lt;/em&gt; &#65292;&#25968;&#25454;&#23384;&#21462;&#37096;&#20998;&#65292;&#30001;django&#25968;&#25454;&#24211;&#23618;&#22788;&#29702;&#65292;&#26412;&#31456;&#35201;&#35762;&#36848;&#30340;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn27&quot;&gt;&lt;em&gt;V&lt;/em&gt; &#65292;&#36873;&#25321;&#26174;&#31034;&#21738;&#20123;&#25968;&#25454;&#35201;&#26174;&#31034;&#20197;&#21450;&#24590;&#26679;&#26174;&#31034;&#30340;&#37096;&#20998;&#65292;&#30001;&#35270;&#22270;&#21644;&#27169;&#26495;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn28&quot;&gt;&lt;em&gt;C&lt;/em&gt; &#65292;&#26681;&#25454;&#29992;&#25143;&#36755;&#20837;&#22996;&#27966;&#35270;&#22270;&#30340;&#37096;&#20998;&#65292;&#30001; Django &#26694;&#26550;&#26681;&#25454; URLconf &#35774;&#32622;&#65292;&#23545;&#32473;&#23450; URL &#35843;&#29992;&#36866;&#24403;&#30340; Python &#20989;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#30001;&#20110; C &#30001;&#26694;&#26550;&#33258;&#34892;&#22788;&#29702;&#65292;&#32780; Django &#37324;&#26356;&#20851;&#27880;&#30340;&#26159;&#27169;&#22411;&#65288;Model&#65289;&#12289;&#27169;&#26495;(Template)&#21644;&#35270;&#22270;&#65288;Views&#65289;&#65292;Django &#20063;&#34987;&#31216;&#20026; &lt;em&gt;MTV &#26694;&#26550;&lt;/em&gt; &#12290;&#22312; MTV &#24320;&#21457;&#27169;&#24335;&#20013;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn30&quot;&gt;&lt;em&gt;M&lt;/em&gt; &#20195;&#34920;&#27169;&#22411;&#65288;Model&#65289;&#65292;&#21363;&#25968;&#25454;&#23384;&#21462;&#23618;&#12290; &#35813;&#23618;&#22788;&#29702;&#19982;&#25968;&#25454;&#30456;&#20851;&#30340;&#25152;&#26377;&#20107;&#21153;&#65306; &#22914;&#20309;&#23384;&#21462;&#12289;&#22914;&#20309;&#39564;&#35777;&#26377;&#25928;&#24615;&#12289;&#21253;&#21547;&#21738;&#20123;&#34892;&#20026;&#20197;&#21450;&#25968;&#25454;&#20043;&#38388;&#30340;&#20851;&#31995;&#31561;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn31&quot;&gt;&lt;em&gt;T&lt;/em&gt; &#20195;&#34920;&#27169;&#26495;(Template)&#65292;&#21363;&#34920;&#29616;&#23618;&#12290; &#35813;&#23618;&#22788;&#29702;&#19982;&#34920;&#29616;&#30456;&#20851;&#30340;&#20915;&#23450;&#65306; &#22914;&#20309;&#22312;&#39029;&#38754;&#25110;&#20854;&#20182;&#31867;&#22411;&#25991;&#26723;&#20013;&#36827;&#34892;&#26174;&#31034;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn32&quot;&gt;&lt;em&gt;V&lt;/em&gt; &#20195;&#34920;&#35270;&#22270;&#65288;View&#65289;&#65292;&#21363;&#19994;&#21153;&#36923;&#36753;&#23618;&#12290; &#35813;&#23618;&#21253;&#21547;&#23384;&#21462;&#27169;&#22411;&#21450;&#35843;&#21462;&#24688;&#24403;&#27169;&#26495;&#30340;&#30456;&#20851;&#36923;&#36753;&#12290; &#20320;&#21487;&#20197;&#25226;&#23427;&#30475;&#20316;&#27169;&#22411;&#19982;&#27169;&#26495;&#20043;&#38388;&#30340;&#26725;&#26753;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#22914;&#26524;&#20320;&#29087;&#24713;&#20854;&#23427;&#30340; MVC Web&#24320;&#21457;&#26694;&#26550;&#65292;&#27604;&#26041;&#35828; Ruby on Rails&#65292;&#20320;&#21487;&#33021;&#20250;&#35748;&#20026; Django &#35270;&#22270;&#26159;&#25511;&#21046;&#22120;&#65292;&#32780; Django &#27169;&#26495;&#26159;&#35270;&#22270;&#12290; &#24456;&#19981;&#24184;&#65292;&#36825;&#26159;&#23545; MVC &#19981;&#21516;&#35808;&#37322;&#25152;&#24341;&#36215;&#30340;&#38169;&#35823;&#35748;&#35782;&#12290; &#22312; Django &#23545; MVC &#30340;&#35808;&#37322;&#20013;&#65292;&#35270;&#22270;&#29992;&#26469;&#25551;&#36848;&#35201;&#23637;&#29616;&#32473;&#29992;&#25143;&#30340;&#25968;&#25454;&#65307;&#19981;&#26159;&#25968;&#25454; &lt;em&gt;&#22914;&#20309;&lt;/em&gt;&#23637;&#29616; ,&#32780;&#19988;&#23637;&#29616; &lt;em&gt;&#21738;&#20123;&lt;/em&gt; &#25968;&#25454;&#12290; &#30456;&#27604;&#20043;&#19979;&#65292;Ruby on Rails &#21450;&#19968;&#20123;&#21516;&#31867;&#26694;&#26550;&#25552;&#20513;&#25511;&#21046;&#22120;&#36127;&#36131;&#20915;&#23450;&#21521;&#29992;&#25143;&#23637;&#29616;&#21738;&#20123;&#25968;&#25454;&#65292;&#32780;&#35270;&#22270;&#21017;&#20165;&#20915;&#23450; &lt;em&gt;&#22914;&#20309;&lt;/em&gt; &#23637;&#29616;&#25968;&#25454;&#65292;&#32780;&#19981;&#26159;&#23637;&#29616; &lt;em&gt;&#21738;&#20123;&lt;/em&gt; &#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#20004;&#31181;&#35808;&#37322;&#20013;&#27809;&#26377;&#21738;&#20010;&#26356;&#21152;&#27491;&#30830;&#19968;&#20123;&#12290; &#37325;&#35201;&#30340;&#26159;&#35201;&#29702;&#35299;&#24213;&#23618;&#27010;&#24565;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn35&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#25968;&#25454;&#24211;&#37197;&#32622;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&#35760;&#20303;&#36825;&#20123;&#29702;&#24565;&#20043;&#21518;&#65292;&#35753;&#25105;&#20204;&#26469;&#24320;&#22987; Django &#25968;&#25454;&#24211;&#23618;&#30340;&#25506;&#32034;&#12290; &#39318;&#20808;&#65292;&#25105;&#20204;&#38656;&#35201;&#20570;&#20123;&#21021;&#22987;&#37197;&#32622;&#65307;&#25105;&#20204;&#38656;&#35201;&#21578;&#35785;Django&#20351;&#29992;&#20160;&#20040;&#25968;&#25454;&#24211;&#20197;&#21450;&#22914;&#20309;&#36830;&#25509;&#25968;&#25454;&#24211;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#25105;&#20204;&#20551;&#23450;&#20320;&#24050;&#32463;&#23436;&#25104;&#20102;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#30340;&#23433;&#35013;&#21644;&#28608;&#27963;&#65292;&#24182;&#19988;&#24050;&#32463;&#22312;&#20854;&#20013;&#21019;&#24314;&#20102;&#25968;&#25454;&#24211;&#65288;&#20363;&#22914;&#65292;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;DATABASE&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#65289;&#12290; &#22914;&#26524;&#20320;&#20351;&#29992;SQLite&#65292;&#19981;&#38656;&#35201;&#36825;&#27493;&#23433;&#35013;&#65292;&#22240;&#20026;SQLite&#20351;&#29992;&#25991;&#20214;&#31995;&#32479;&#19978;&#30340;&#29420;&#31435;&#25991;&#20214;&#26469;&#23384;&#20648;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#35937;&#21069;&#38754;&#31456;&#33410;&#25552;&#21040;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#19968;&#26679;&#65292;&#25968;&#25454;&#24211;&#37197;&#32622;&#20063;&#26159;&#22312;Django&#30340;&#37197;&#32622;&#25991;&#20214;&#37324;&#65292;&#32570;&#30465; &#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;settings.py&lt;/span&gt;&lt;/tt&gt; &#12290; &#25171;&#24320;&#36825;&#20010;&#25991;&#20214;&#24182;&#26597;&#25214;&#25968;&#25454;&#24211;&#37197;&#32622;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn40&quot;&gt;DATABASE_ENGINE = &apos;&apos;
DATABASE_NAME = &apos;&apos;
DATABASE_USER = &apos;&apos;
DATABASE_PASSWORD = &apos;&apos;
DATABASE_HOST = &apos;&apos;
DATABASE_PORT = &apos;&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#37197;&#32622;&#32434;&#35201;&#22914;&#19979;&#12290;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_ENGINE&lt;/span&gt;&lt;/tt&gt; &#21578;&#35785;Django&#20351;&#29992;&#21738;&#20010;&#25968;&#25454;&#24211;&#24341;&#25806;&#12290; &#22914;&#26524;&#20320;&#22312; Django &#20013;&#20351;&#29992;&#25968;&#25454;&#24211;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_ENGINE&lt;/span&gt;&lt;/tt&gt; &#24517;&#39035;&#26159; Table 5-1 &#20013;&#25152;&#21015;&#20986;&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;table class=&quot;cn docutils&quot; id=&quot;cn43&quot;&gt;
&lt;caption&gt;&#34920; 5-1.  &#25968;&#25454;&#24211;&#24341;&#25806;&#35774;&#32622;&lt;/caption&gt;
&lt;colgroup&gt;
&lt;col width=&quot;28%&quot;&gt;
&lt;col width=&quot;14%&quot;&gt;
&lt;col width=&quot;58%&quot;&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&#35774;&#32622;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#25968;&#25454;&#24211;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#25152;&#38656;&#36866;&#37197;&#22120;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;`` postgresql``&lt;/td&gt;
&lt;td&gt;PostgreSQL&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;psycopg&lt;/span&gt;&lt;/tt&gt; 1.x&#29256;&#65292;
&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-pgsql/1/&quot;&gt;http://www.djangoproject.com/r/python-pgsql/1/&lt;/a&gt;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;postgresql_psycopg2&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;PostgreSQL&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;psycopg&lt;/span&gt;&lt;/tt&gt; 2.x&#29256;&#65292;
&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-pgsql/&quot;&gt;http://www.djangoproject.com/r/python-pgsql/&lt;/a&gt;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysql&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;MySQL&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MySQLdb&lt;/span&gt;&lt;/tt&gt; ,
&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-mysql/&quot;&gt;http://www.djangoproject.com/r/python-mysql/&lt;/a&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sqlite3&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;SQLite&lt;/td&gt;
&lt;td&gt;&#22914;&#26524;&#20351;&#29992;Python 2.5+&#21017;&#19981;&#38656;&#35201;&#36866;&#37197;&#22120;&#12290; &#21542;&#21017;&#23601;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pysqlite&lt;/span&gt;&lt;/tt&gt; &#65292;
&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-sqlite/&quot;&gt;http://www.djangoproject.com/r/python-sqlite/&lt;/a&gt;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;oracle&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Oracle&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cx_Oracle&lt;/span&gt;&lt;/tt&gt; ,
&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/python-oracle/&quot;&gt;http://www.djangoproject.com/r/python-oracle/&lt;/a&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#35201;&#27880;&#24847;&#30340;&#26159;&#26080;&#35770;&#36873;&#25321;&#20351;&#29992;&#21738;&#20010;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#65292;&#37117;&#24517;&#39035;&#19979;&#36733;&#21644;&#23433;&#35013;&#23545;&#24212;&#30340;&#25968;&#25454;&#24211;&#36866;&#37197;&#22120;&#12290; &#35775;&#38382;&#34920; 5-1 &#20013;&#8220;&#25152;&#38656;&#36866;&#37197;&#22120;&#8221;&#19968;&#26639;&#20013;&#30340;&#38142;&#25509;&#65292;&#21487;&#36890;&#36807;&#20114;&#32852;&#32593;&#20813;&#36153;&#33719;&#21462;&#36825;&#20123;&#36866;&#37197;&#22120;&#12290; &#22914;&#26524;&#20320;&#20351;&#29992;Linux&#65292;&#20320;&#30340;&#21457;&#24067;&#21253;&#31649;&#29702;&#31995;&#32479;&#20250;&#25552;&#20379;&#21512;&#36866;&#30340;&#21253;&#12290; &#27604;&#22914;&#35828;&#26597;&#25214;`` python-postgresql`` &#25110;&#32773;`` python-psycopg`` &#30340;&#36719;&#20214;&#21253;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#37197;&#32622;&#31034;&#20363;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn48&quot;&gt;DATABASE_ENGINE = &apos;postgresql_psycopg2&apos;
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_NAME&lt;/span&gt;&lt;/tt&gt; &#23558;&#25968;&#25454;&#24211;&#21517;&#31216;&#21578;&#30693; Django &#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn51&quot;&gt;DATABASE_NAME = &apos;mydb&apos;
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#22914;&#26524;&#20351;&#29992; SQLite&#65292;&#35831;&#23545;&#25968;&#25454;&#24211;&#25991;&#20214;&#25351;&#23450;&#23436;&#25972;&#30340;&#25991;&#20214;&#31995;&#32479;&#36335;&#24452;&#12290;
&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn54&quot;&gt;DATABASE_NAME = &apos;/home/django/mydata.db&apos;
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#23558;SQLite&#25968;&#25454;&#24211;&#25918;&#22312;/home/django&#30446;&#24405;&#19979;&#65292;&#20320;&#21487;&#20197;&#20219;&#24847;&#36873;&#29992;&#26368;&#21512;&#36866;&#20320;&#30340;&#30446;&#24405;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_USER&lt;/span&gt;&lt;/tt&gt; &#21578;&#35785; Django &#29992;&#21738;&#20010;&#29992;&#25143;&#36830;&#25509;&#25968;&#25454;&#24211;&#12290; &#20363;&#22914;&#65306; &#22914;&#26524;&#29992;SQLite&#65292;&#31354;&#30333;&#21363;&#21487;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_PASSWORD&lt;/span&gt;&lt;/tt&gt; &#21578;&#35785;Django&#36830;&#25509;&#29992;&#25143;&#30340;&#23494;&#30721;&#12290; SQLite &#29992;&#31354;&#23494;&#30721;&#21363;&#21487;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_HOST&lt;/span&gt;&lt;/tt&gt; &#21578;&#35785; Django &#36830;&#25509;&#21738;&#19968;&#21488;&#20027;&#26426;&#30340;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#12290; &#22914;&#26524;&#25968;&#25454;&#24211;&#19982; Django &#23433;&#35013;&#20110;&#21516;&#19968;&#21488;&#35745;&#31639;&#26426;&#65288;&#21363;&#26412;&#26426;&#65289;&#65292;&#21487;&#23558;&#27492;&#39033;&#20445;&#30041;&#31354;&#30333;&#12290;
&#22914;&#26524;&#20320;&#20351;&#29992;SQLite&#65292;&#27492;&#39033;&#30041;&#31354;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#27492;&#22788;&#30340; MySQL &#26159;&#19968;&#20010;&#29305;&#20363;&#12290; &#22914;&#26524;&#20351;&#29992;&#30340;&#26159; MySQL &#19988;&#35813;&#39033;&#35774;&#32622;&#20540;&#30001;&#26012;&#26464;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;/&apos;&lt;/span&gt;&lt;/tt&gt; &#65289;&#24320;&#22836;&#65292;MySQL &#23558;&#36890;&#36807; Unix socket &#26469;&#36830;&#25509;&#25351;&#23450;&#30340;&#22871;&#25509;&#23383;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn61&quot;&gt;DATABASE_HOST = &apos;/var/run/mysql&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#19968;&#26086;&#22312;&#36755;&#20837;&#20102;&#37027;&#20123;&#35774;&#32622;&#24182;&#20445;&#23384;&#20043;&#21518;&#24212;&#24403;&#27979;&#35797;&#19968;&#19979;&#20320;&#30340;&#37197;&#32622;&#12290; &#25105;&#20204;&#21487;&#20197;&#22312;`` mysite`` &#39033;&#30446;&#30446;&#24405;&#19979;&#25191;&#34892;&#19978;&#31456;&#25152;&#25552;&#21040;&#30340;`` python manage.py shell`` &#26469;&#36827;&#34892;&#27979;&#35797;&#12290; &#65288;&#25105;&#20204;&#19978;&#19968;&#31456;&#25552;&#21040;&#36807;&#22312;&#65292;`` manager.py shell`` &#21629;&#20196;&#26159;&#20197;&#27491;&#30830;Django&#37197;&#32622;&#21551;&#29992;Python&#20132;&#20114;&#35299;&#37322;&#22120;&#30340;&#19968;&#31181;&#26041;&#27861;&#12290; &#36825;&#20010;&#26041;&#27861;&#22312;&#36825;&#37324;&#26159;&#24456;&#26377;&#24517;&#35201;&#30340;&#65292;&#22240;&#20026;Django&#38656;&#35201;&#30693;&#36947;&#21152;&#36733;&#21738;&#20010;&#37197;&#32622;&#25991;&#20214;&#26469;&#33719;&#21462;&#25968;&#25454;&#24211;&#36830;&#25509;&#20449;&#24687;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#36755;&#20837;&#19979;&#38754;&#36825;&#20123;&#21629;&#20196;&#26469;&#27979;&#35797;&#20320;&#30340;&#25968;&#25454;&#24211;&#37197;&#32622;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn65&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.db import connection
&amp;gt;&amp;gt;&amp;gt; cursor = connection.cursor()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn66&quot;&gt;&#22914;&#26524;&#27809;&#26377;&#26174;&#31034;&#20160;&#20040;&#38169;&#35823;&#20449;&#24687;&#65292;&#37027;&#20040;&#20320;&#30340;&#25968;&#25454;&#24211;&#37197;&#32622;&#26159;&#27491;&#30830;&#30340;&#12290; &#21542;&#21017;&#65292;&#20320;&#23601;&#24471; &#26597;&#30475;&#38169;&#35823;&#20449;&#24687;&#26469;&#32416;&#27491;&#38169;&#35823;&#12290; &#34920; 5-2 &#26159;&#19968;&#20123;&#24120;&#35265;&#38169;&#35823;&#12290;&lt;/p&gt;
&lt;table class=&quot;cn docutils&quot; id=&quot;cn67&quot;&gt;
&lt;caption&gt;&#34920; 5-2. &#25968;&#25454;&#24211;&#37197;&#32622;&#38169;&#35823;&#20449;&#24687;&lt;/caption&gt;
&lt;colgroup&gt;
&lt;col width=&quot;22%&quot;&gt;
&lt;col width=&quot;78%&quot;&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&#38169;&#35823;&#20449;&#24687;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#35299;&#20915;&#26041;&#27861;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;You haven&#8217;t set the
DATABASE_ENGINE
setting yet.&lt;/td&gt;
&lt;td&gt;&#19981;&#35201;&#20197;&#31354;&#23383;&#31526;&#20018;&#37197;&#32622;`` DATABASE_ENGINE`` &#30340;&#20540;&#12290;
&#34920;&#26684; 5-1 &#21015;&#20986;&#21487;&#29992;&#30340;&#20540;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Environment variable
DJANGO_SETTINGS_MODULE
is undefined.&lt;/td&gt;
&lt;td&gt;&#20351;&#29992;`` python manager.py shell`` &#21629;&#20196;&#21551;&#21160;&#20132;&#20114;&#35299;&#37322;&#22120;&#65292;&#19981;&#35201;&#20197;`` python`` &#21629;&#20196;&#30452;&#25509;&#21551;&#21160;&#20132;&#20114;&#35299;&#37322;&#22120;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Error loading _____
module: No module
named _____.&lt;/td&gt;
&lt;td&gt;&#26410;&#23433;&#35013;&#21512;&#36866;&#30340;&#25968;&#25454;&#24211;&#36866;&#37197;&#22120; (&#20363;&#22914;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;psycopg&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MySQLdb&lt;/span&gt;&lt;/tt&gt; )&#12290;Django&#24182;&#19981;&#33258;&#24102;&#36866;&#37197;&#22120;&#65292;&#25152;&#20197;&#20320;&#24471;&#33258;&#24049;&#19979;&#36733;&#23433;&#35013;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;_____ isn&#8217;t an
available database
backend.&lt;/td&gt;
&lt;td&gt;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_ENGINE&lt;/span&gt;&lt;/tt&gt; &#37197;&#32622;&#25104;&#21069;&#38754;&#25552;&#21040;&#30340;&#21512;&#27861;&#30340;&#25968;&#25454;&#24211;&#24341;&#25806;&#12290; &#20063;&#35768;&#26159;&#25340;&#20889;&#38169;&#35823;&#65311;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;database _____ does
not exist&lt;/td&gt;
&lt;td&gt;&#35774;&#32622;`` DATABASE_NAME`` &#25351;&#21521;&#23384;&#22312;&#30340;&#25968;&#25454;&#24211;&#65292;&#25110;&#32773;&#20808;&#22312;&#25968;&#25454;&#24211;&#23458;&#25143;&#31471;&#20013;&#25191;&#34892;&#21512;&#36866;&#30340;`` CREATE DATABASE`` &#35821;&#21477;&#21019;&#24314;&#25968;&#25454;&#24211;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;role _____ does not
exist&lt;/td&gt;
&lt;td&gt;&#35774;&#32622;`` DATABASE_USER`` &#25351;&#21521;&#23384;&#22312;&#30340;&#29992;&#25143;&#65292;&#25110;&#32773;&#20808;&#22312;&#25968;&#25454;&#24211;&#23458;&#25143;&#31471;&#20013;&#25191;&#21019;&#24314;&#29992;&#25143;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;could not connect to
server&lt;/td&gt;
&lt;td&gt;&#26597;&#30475;DATABASE_HOST&#21644;DATABASE_PORT&#26159;&#21542;&#24050;&#27491;&#30830;&#37197;&#32622;&#65292;&#24182;&#30830;&#35748;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#26159;&#21542;&#24050;&#27491;&#24120;&#36816;&#34892;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn68&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#31532;&#19968;&#20010;&#24212;&#29992;&#31243;&#24207;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#20320;&#29616;&#22312;&#24050;&#32463;&#30830;&#35748;&#25968;&#25454;&#24211;&#36830;&#25509;&#27491;&#24120;&#24037;&#20316;&#20102;&#65292;&#35753;&#25105;&#20204;&#26469;&#21019;&#24314;&#19968;&#20010; &lt;em&gt;Django app&lt;/em&gt;-&#19968;&#20010;&#21253;&#21547;&#27169;&#22411;&#65292;&#35270;&#22270;&#21644;Django&#20195;&#30721;&#65292;&#24182;&#19988;&#24418;&#24335;&#20026;&#29420;&#31435;Python&#21253;&#30340;&#23436;&#25972;Django&#24212;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#22312;&#36825;&#37324;&#35201;&#20808;&#35299;&#37322;&#19968;&#20123;&#26415;&#35821;&#65292;&#21021;&#23398;&#32773;&#21487;&#33021;&#20250;&#28151;&#28102;&#23427;&#20204;&#12290; &#22312;&#31532;&#20108;&#31456;&#25105;&#20204;&#24050;&#32463;&#21019;&#24314;&#20102; &lt;em&gt;project&lt;/em&gt; , &#37027;&#20040; &lt;em&gt;project&lt;/em&gt; &#21644; &lt;em&gt;app&lt;/em&gt; &#20043;&#38388;&#21040;&#24213;&#26377;&#20160;&#20040;&#19981;&#21516;&#21602;&#65311;&#23427;&#20204;&#30340;&#21306;&#21035;&#23601;&#26159;&#19968;&#20010;&#26159;&#37197;&#32622;&#21478;&#19968;&#20010;&#26159; &#20195;&#30721;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#19968;&#20010;project&#21253;&#21547;&#24456;&#22810;&#20010;Django app&#20197;&#21450;&#23545;&#23427;&#20204;&#30340;&#37197;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&#25216;&#26415;&#19978;&#65292;project&#30340;&#20316;&#29992;&#26159;&#25552;&#20379;&#37197;&#32622;&#25991;&#20214;&#65292;&#27604;&#26041;&#35828;&#21738;&#37324;&#23450;&#20041;&#25968;&#25454;&#24211;&#36830;&#25509;&#20449;&#24687;, &#23433;&#35013;&#30340;app&#21015;&#34920;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#65292;&#31561;&#31561;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&#19968;&#20010;app&#26159;&#19968;&#22871;Django&#21151;&#33021;&#30340;&#38598;&#21512;&#65292;&#36890;&#24120;&#21253;&#25324;&#27169;&#22411;&#21644;&#35270;&#22270;&#65292;&#25353;Python&#30340;&#21253;&#32467;&#26500;&#30340;&#26041;&#24335;&#23384;&#22312;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#20363;&#22914;&#65292;Django&#26412;&#36523;&#20869;&#24314;&#26377;&#19968;&#20123;app&#65292;&#20363;&#22914;&#27880;&#37322;&#31995;&#32479;&#21644;&#33258;&#21160;&#31649;&#29702;&#30028;&#38754;&#12290; app&#30340;&#19968;&#20010;&#20851;&#38190;&#28857;&#26159;&#23427;&#20204;&#26159;&#24456;&#23481;&#26131;&#31227;&#26893;&#21040;&#20854;&#20182;project&#21644;&#34987;&#22810;&#20010;project&#22797;&#29992;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#23545;&#20110;&#22914;&#20309;&#26550;&#26500;Django&#20195;&#30721;&#24182;&#27809;&#26377;&#24555;&#36895;&#25104;&#22871;&#30340;&#35268;&#21017;&#12290; &#22914;&#26524;&#20320;&#21482;&#26159;&#24314;&#36896;&#19968;&#20010;&#31616;&#21333;&#30340;Web&#31449;&#28857;&#65292;&#37027;&#20040;&#21487;&#33021;&#20320;&#21482;&#38656;&#35201;&#19968;&#20010;app&#23601;&#21487;&#20197;&#20102;&#65307; &#20294;&#22914;&#26524;&#26159;&#19968;&#20010;&#21253;&#21547;&#35768;&#22810;&#19981;&#30456;&#20851;&#30340;&#27169;&#22359;&#30340;&#22797;&#26434;&#30340;&#32593;&#31449;&#65292;&#20363;&#22914;&#30005;&#23376;&#21830;&#21153;&#21644;&#31038;&#21306;&#20043;&#31867;&#30340;&#31449;&#28857;&#65292;&#37027;&#20040;&#20320;&#21487;&#33021;&#38656;&#35201;&#25226;&#36825;&#20123;&#27169;&#22359;&#21010;&#20998;&#25104;&#19981;&#21516;&#30340;app&#65292;&#20197;&#20415;&#20197;&#21518;&#22797;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#19981;&#38169;&#65292;&#20320;&#21487;&#20197;&#19981;&#29992;&#21019;&#24314;app&#65292;&#36825;&#19968;&#28857;&#24212;&#32463;&#34987;&#25105;&#20204;&#20043;&#21069;&#32534;&#20889;&#30340;&#35270;&#22270;&#20989;&#25968;&#30340;&#20363;&#23376;&#35777;&#26126;&#20102; &#12290; &#22312;&#37027;&#20123;&#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#21482;&#26159;&#31616;&#21333;&#30340;&#21019;&#24314;&#20102;&#19968;&#20010;&#31216;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;views.py&lt;/span&gt;&lt;/tt&gt;&#30340;&#25991;&#20214;&#65292;&#32534;&#20889;&#20102;&#19968;&#20123;&#20989;&#25968;&#24182;&#22312;URLconf&#20013;&#35774;&#32622;&#20102;&#21508;&#20010;&#20989;&#25968;&#30340;&#26144;&#23556;&#12290; &#36825;&#20123;&#24773;&#20917;&#37117;&#19981;&#38656;&#35201;&#20351;&#29992;apps&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#20294;&#26159;&#65292;&#31995;&#32479;&#23545;app&#26377;&#19968;&#20010;&#32422;&#23450;&#65306; &#22914;&#26524;&#20320;&#20351;&#29992;&#20102;Django&#30340;&#25968;&#25454;&#24211;&#23618;&#65288;&#27169;&#22411;&#65289;&#65292;&#20320; &#24517;&#39035;&#21019;&#24314;&#19968;&#20010;Django app&#12290; &#27169;&#22411;&#24517;&#39035;&#23384;&#25918;&#22312;apps&#20013;&#12290; &#22240;&#27492;&#65292;&#20026;&#20102;&#24320;&#22987;&#24314;&#36896; &#25105;&#20204;&#30340;&#27169;&#22411;&#65292;&#25105;&#20204;&#24517;&#39035;&#21019;&#24314;&#19968;&#20010;&#26032;&#30340;app&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#22312;`` mysite`` &#39033;&#30446;&#25991;&#20214;&#19979;&#36755;&#20837;&#19979;&#38754;&#30340;&#21629;&#20196;&#26469;&#21019;&#24314;`` books``  app&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn80&quot;&gt;python manage.py startapp books
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#36825;&#20010;&#21629;&#20196;&#24182;&#27809;&#26377;&#36755;&#20986;&#20160;&#20040;&#65292;&#23427;&#21482;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite&lt;/span&gt;&lt;/tt&gt; &#30340;&#30446;&#24405;&#37324;&#21019;&#24314;&#20102;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;books&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#12290; &#35753;&#25105;&#20204;&#26469;&#30475;&#30475;&#36825;&#20010;&#30446;&#24405;&#30340;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn83&quot;&gt;books/
    __init__.py
    models.py
    tests.py
    views.py
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#36825;&#20010;&#30446;&#24405;&#21253;&#21547;&#20102;&#36825;&#20010;app&#30340;&#27169;&#22411;&#21644;&#35270;&#22270;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&#20351;&#29992;&#20320;&#26368;&#21916;&#27426;&#30340;&#25991;&#26412;&#32534;&#36753;&#22120;&#26597;&#30475;&#19968;&#19979; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;models.py&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;views.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#30340;&#20869;&#23481;&#12290; &#23427;&#20204;&#37117;&#26159;&#31354;&#30340;&#65292;&#38500;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;models.py&lt;/span&gt;&lt;/tt&gt; &#37324;&#26377;&#19968;&#20010; import&#12290;&#36825;&#23601;&#26159;&#20320;Django app&#30340;&#22522;&#30784;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;python&quot;&gt;
&lt;span id=&quot;cn86&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#22312;Python&#20195;&#30721;&#37324;&#23450;&#20041;&#27169;&#22411;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#25105;&#20204;&#26089;&#20123;&#26102;&#20505;&#35848;&#21040;&#12290;MTV&#37324;&#30340;M&#20195;&#34920;&#27169;&#22411;&#12290; Django&#27169;&#22411;&#26159;&#29992;Python&#20195;&#30721;&#24418;&#24335;&#34920;&#36848;&#30340;&#25968;&#25454;&#22312;&#25968;&#25454;&#24211;&#20013;&#30340;&#23450;&#20041;&#12290; &#23545;&#25968;&#25454;&#23618;&#26469;&#35828;&#23427;&#31561;&#21516;&#20110; CREATE TABLE &#35821;&#21477;&#65292;&#21482;&#19981;&#36807;&#25191;&#34892;&#30340;&#26159;Python&#20195;&#30721;&#32780;&#19981;&#26159; SQL&#65292;&#32780;&#19988;&#36824;&#21253;&#21547;&#20102;&#27604;&#25968;&#25454;&#24211;&#23383;&#27573;&#23450;&#20041;&#26356;&#22810;&#30340;&#21547;&#20041;&#12290; Django&#29992;&#27169;&#22411;&#22312;&#21518;&#21488;&#25191;&#34892;SQL&#20195;&#30721;&#24182;&#25226;&#32467;&#26524;&#29992;Python&#30340;&#25968;&#25454;&#32467;&#26500;&#26469;&#25551;&#36848;&#12290;
Django&#20063;&#20351;&#29992;&#27169;&#22411;&#26469;&#21576;&#29616;SQL&#26080;&#27861;&#22788;&#29702;&#30340;&#39640;&#32423;&#27010;&#24565;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#22914;&#26524;&#20320;&#23545;&#25968;&#25454;&#24211;&#24456;&#29087;&#24713;&#65292;&#20320;&#21487;&#33021;&#39532;&#19978;&#23601;&#20250;&#24819;&#21040;&#65292;&#29992;Python &lt;em&gt;&#21644;&lt;/em&gt; SQL&#26469;&#23450;&#20041;&#25968;&#25454;&#27169;&#22411;&#26159;&#19981;&#26159;&#26377;&#28857;&#22810;&#20313;&#65311; Django&#36825;&#26679;&#20570;&#26159;&#26377;&#19979;&#38754;&#20960;&#20010;&#21407;&#22240;&#30340;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#33258;&#30465;&#65288;&#36816;&#34892;&#26102;&#33258;&#21160;&#35782;&#21035;&#25968;&#25454;&#24211;&#65289;&#20250;&#23548;&#33268;&#36807;&#36733;&#21644;&#26377;&#25968;&#25454;&#23436;&#25972;&#24615;&#38382;&#39064;&#12290; &#20026;&#20102;&#25552;&#20379;&#26041;&#20415;&#30340;&#25968;&#25454;&#35775;&#38382;API&#65292; Django&#38656;&#35201;&#20197; &lt;em&gt;&#26576;&#31181;&#26041;&#24335;&lt;/em&gt; &#30693;&#36947;&#25968;&#25454;&#24211;&#23618;&#20869;&#37096;&#20449;&#24687;&#65292;&#26377;&#20004;&#31181;&#23454;&#29616;&#26041;&#24335;&#12290;
&#31532;&#19968;&#31181;&#26041;&#24335;&#26159;&#29992;Python&#26126;&#30830;&#22320;&#23450;&#20041;&#25968;&#25454;&#27169;&#22411;&#65292;&#31532;&#20108;&#31181;&#26041;&#24335;&#26159;&#36890;&#36807;&#33258;&#30465;&#26469;&#33258;&#21160;&#20390;&#27979;&#35782;&#21035;&#25968;&#25454;&#27169;&#22411;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn90&quot;&gt;&#31532;&#20108;&#31181;&#26041;&#24335;&#30475;&#36215;&#26469;&#26356;&#28165;&#26224;&#65292;&#22240;&#20026;&#25968;&#25454;&#34920;&#20449;&#24687;&#21482;&#23384;&#25918;&#22312;&#19968;&#20010;&#22320;&#26041;-&#25968;&#25454;&#24211;&#37324;&#65292;&#20294;&#26159;&#20250;&#24102;&#26469;&#19968;&#20123;&#38382;&#39064;&#12290; &#39318;&#20808;&#65292;&#36816;&#34892;&#26102;&#25195;&#25551;&#25968;&#25454;&#24211;&#20250;&#24102;&#26469;&#20005;&#37325;&#30340;&#31995;&#32479;&#36807;&#36733;&#12290; &#22914;&#26524;&#27599;&#20010;&#35831;&#27714;&#37117;&#35201;&#25195;&#25551;&#25968;&#25454;&#24211;&#30340;&#34920;&#32467;&#26500;&#65292;&#25110;&#32773;&#21363;&#20415;&#26159; &#26381;&#21153;&#21551;&#21160;&#26102;&#20570;&#19968;&#27425;&#37117;&#26159;&#20250;&#24102;&#26469;&#19981;&#33021;&#25509;&#21463;&#30340;&#31995;&#32479;&#36807;&#36733;&#12290;
&#65288;&#26377;&#20154;&#35748;&#20026;&#36825;&#20010;&#31243;&#24230;&#30340;&#31995;&#32479;&#36807;&#36733;&#26159;&#21487;&#20197;&#25509;&#21463;&#30340;&#65292;&#32780;Django&#24320;&#21457;&#32773;&#30340;&#30446;&#26631;&#26159;&#23613;&#21487;&#33021;&#22320;&#38477;&#20302;&#26694;&#26550;&#30340;&#31995;&#32479;&#36807;&#36733;&#65289;&#12290;&#31532;&#20108;&#65292;&#26576;&#20123;&#25968;&#25454;&#24211;&#65292;&#23588;&#20854;&#26159;&#32769;&#29256;&#26412;&#30340;MySQL,&#24182;&#26410;&#23436;&#25972;&#23384;&#20648;&#37027;&#20123;&#31934;&#30830;&#30340;&#33258;&#30465;&#20803;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#32534;&#20889;Python&#20195;&#30721;&#26159;&#38750;&#24120;&#26377;&#36259;&#30340;&#65292;&#20445;&#25345;&#29992;Python&#30340;&#26041;&#24335;&#24605;&#32771;&#20250;&#36991;&#20813;&#20320;&#30340;&#22823;&#33041;&#22312;&#19981;&#21516;&#39046;&#22495;&#26469;&#22238;&#20999;&#25442;&#12290; &#23613;&#21487;&#33021;&#30340;&#20445;&#25345;&#22312;&#21333;&#19968;&#30340;&#32534;&#31243;&#29615;&#22659;/&#24605;&#24819;&#29366;&#24577;&#19979;&#21487;&#20197;&#24110;&#21161;&#20320;&#25552;&#39640;&#29983;&#20135;&#29575;&#12290; &#19981;&#24471;&#19981;&#21435;&#37325;&#22797;&#20889;SQL&#65292;&#20877;&#20889;Python&#20195;&#30721;&#65292;&#20877;&#20889;SQL&#65292;&#8230;&#65292;&#20250;&#35753;&#20320;&#22836;&#37117;&#35201;&#35010;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#25226;&#25968;&#25454;&#27169;&#22411;&#29992;&#20195;&#30721;&#30340;&#26041;&#24335;&#34920;&#36848;&#26469;&#35753;&#20320;&#21487;&#20197;&#23481;&#26131;&#23545;&#23427;&#20204;&#36827;&#34892;&#29256;&#26412;&#25511;&#21046;&#12290; &#36825;&#26679;&#65292;&#20320;&#21487;&#20197;&#24456;&#23481;&#26131;&#20102;&#35299;&#25968;&#25454;&#23618; &#30340;&#21464;&#21160;&#24773;&#20917;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;SQL&#21482;&#33021;&#25551;&#36848;&#29305;&#23450;&#31867;&#22411;&#30340;&#25968;&#25454;&#23383;&#27573;&#12290; &#20363;&#22914;&#65292;&#22823;&#22810;&#25968;&#25968;&#25454;&#24211;&#37117;&#27809;&#26377;&#19987;&#29992;&#30340;&#23383;&#27573;&#31867;&#22411;&#26469;&#25551;&#36848;Email&#22320;&#22336;&#12289;URL&#12290; &#32780;&#29992;Django&#30340;&#27169;&#22411;&#21487;&#20197;&#20570;&#21040;&#36825;&#19968;&#28857;&#12290; &#22909;&#22788;&#23601;&#26159;&#39640;&#32423;&#30340;&#25968;&#25454;&#31867;&#22411;&#24102;&#26469;&#26356;&#39640;&#30340;&#25928;&#29575;&#21644;&#26356;&#22909;&#30340;&#20195;&#30721;&#22797;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;SQL&#36824;&#26377;&#22312;&#19981;&#21516;&#25968;&#25454;&#24211;&#24179;&#21488;&#30340;&#20860;&#23481;&#24615;&#38382;&#39064;&#12290; &#21457;&#24067;Web&#24212;&#29992;&#30340;&#26102;&#20505;&#65292;&#20351;&#29992;Python&#27169;&#22359;&#25551;&#36848;&#25968;&#25454;&#24211;&#32467;&#26500;&#20449;&#24687;&#21487;&#20197;&#36991;&#20813;&#20026;MySQL, PostgreSQL, and SQLite&#32534;&#20889;&#19981;&#21516;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#24403;&#28982;&#65292;&#36825;&#20010;&#26041;&#27861;&#20063;&#26377;&#19968;&#20010;&#32570;&#28857;&#65292;&#23601;&#26159;Python&#20195;&#30721;&#21644;&#25968;&#25454;&#24211;&#34920;&#30340;&#21516;&#27493;&#38382;&#39064;&#12290; &#22914;&#26524;&#20320;&#20462;&#25913;&#20102;&#19968;&#20010;Django&#27169;&#22411;&#65292; &#20320;&#35201;&#33258;&#24049;&#26469;&#20462;&#25913;&#25968;&#25454;&#24211;&#26469;&#20445;&#35777;&#21644;&#27169;&#22411;&#21516;&#27493;&#12290; &#25105;&#20204;&#23558;&#22312;&#31245;&#21518;&#35762;&#35299;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#30340;&#20960;&#31181;&#31574;&#30053;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#26368;&#21518;,&#25105;&#20204;&#35201;&#25552;&#37266;&#20320;Django&#25552;&#20379;&#20102;&#23454;&#29992;&#24037;&#20855;&#26469;&#20174;&#29616;&#26377;&#30340;&#25968;&#25454;&#24211;&#34920;&#20013;&#33258;&#21160;&#25195;&#25551;&#29983;&#25104;&#27169;&#22411;&#12290; &#36825;&#23545;&#24050;&#26377;&#30340;&#25968;&#25454;&#24211;&#26469;&#35828;&#26159;&#38750;&#24120;&#24555;&#25463;&#26377;&#29992;&#30340;&#12290; &#25105;&#20204;&#23558;&#22312;&#31532;18&#31456;&#20013;&#23545;&#27492;&#36827;&#34892;&#35752;&#35770;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn97&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#31532;&#19968;&#20010;&#27169;&#22411;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#22312;&#26412;&#31456;&#21644;&#21518;&#32493;&#31456;&#33410;&#37324;&#65292;&#25105;&#20204;&#25226;&#27880;&#24847;&#21147;&#25918;&#22312;&#19968;&#20010;&#22522;&#26412;&#30340; &#20070;&#31821;/&#20316;&#32773;/&#20986;&#29256;&#21830; &#25968;&#25454;&#24211;&#32467;&#26500;&#19978;&#12290; &#25105;&#20204;&#36825;&#26679;&#20570;&#26159;&#22240;&#20026; &#36825;&#26159;&#19968;&#20010;&#20247;&#25152;&#21608;&#30693;&#30340;&#20363;&#23376;&#65292;&#24456;&#22810;SQL&#26377;&#20851;&#30340;&#20070;&#31821;&#20063;&#24120;&#29992;&#36825;&#20010;&#20030;&#20363;&#12290; &#20320;&#29616;&#22312;&#30475;&#30340;&#36825;&#26412;&#20070;&#20063;&#26159;&#30001;&#20316;&#32773; &#21019;&#20316;&#20877;&#30001;&#20986;&#29256;&#21830;&#20986;&#29256;&#30340;&#21734;&#65281;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#25105;&#20204;&#26469;&#20551;&#23450;&#19979;&#38754;&#30340;&#36825;&#20123;&#27010;&#24565;&#12289;&#23383;&#27573;&#21644;&#20851;&#31995;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn100&quot;&gt;&#19968;&#20010;&#20316;&#32773;&#26377;&#22995;&#65292;&#26377;&#21517;&#21450;email&#22320;&#22336;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn101&quot;&gt;&#20986;&#29256;&#21830;&#26377;&#21517;&#31216;&#65292;&#22320;&#22336;&#65292;&#25152;&#22312;&#22478;&#24066;&#12289;&#30465;&#65292;&#22269;&#23478;&#65292;&#32593;&#31449;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn102&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn102&quot;&gt;&#20070;&#31821;&#26377;&#20070;&#21517;&#21644;&#20986;&#29256;&#26085;&#26399;&#12290; &#23427;&#26377;&#19968;&#20010;&#25110;&#22810;&#20010;&#20316;&#32773;&#65288;&#21644;&#20316;&#32773;&#26159;&#22810;&#23545;&#22810;&#30340;&#20851;&#32852;&#20851;&#31995;[many-to-many]&#65289;&#65292; &#21482;&#26377;&#19968;&#20010;&#20986;&#29256;&#21830;&#65288;&#21644;&#20986;&#29256;&#21830;&#26159;&#19968;&#23545;&#22810;&#30340;&#20851;&#32852;&#20851;&#31995;[one-to-many]&#65292;&#20063;&#34987;&#31216;&#20316;&#22806;&#38190;[foreign key]&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#31532;&#19968;&#27493;&#26159;&#29992;Python&#20195;&#30721;&#26469;&#25551;&#36848;&#23427;&#20204;&#12290; &#25171;&#24320;&#30001;`` startapp`` &#21629;&#20196;&#21019;&#24314;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;models.py&lt;/span&gt;&lt;/tt&gt; &#24182;&#36755;&#20837;&#19979;&#38754;&#30340;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn105&quot;&gt;from django.db import models

class Publisher(models.Model):
    name = models.CharField(max_length=30)
    address = models.CharField(max_length=50)
    city = models.CharField(max_length=60)
    state_province = models.CharField(max_length=30)
    country = models.CharField(max_length=50)
    website = models.URLField()

class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField()

class Book(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publication_date = models.DateField()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#35753;&#25105;&#20204;&#26469;&#24555;&#36895;&#35762;&#35299;&#19968;&#19979;&#36825;&#20123;&#20195;&#30721;&#30340;&#21547;&#20041;&#12290; &#39318;&#20808;&#35201;&#27880;&#24847;&#30340;&#20107;&#26159;&#27599;&#20010;&#25968;&#25454;&#27169;&#22411;&#37117;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.db.models.Model&lt;/span&gt;&lt;/tt&gt; &#30340;&#23376;&#31867;&#12290;&#23427;&#30340;&#29238;&#31867; Model &#21253;&#21547;&#20102;&#25152;&#26377;&#24517;&#35201;&#30340;&#21644;&#25968;&#25454;&#24211;&#20132;&#20114;&#30340;&#26041;&#27861;&#65292;&#24182;&#25552;&#20379;&#20102;&#19968;&#20010;&#31616;&#27905;&#28418;&#20142;&#30340;&#23450;&#20041;&#25968;&#25454;&#24211;&#23383;&#27573;&#30340;&#35821;&#27861;&#12290; &#20449;&#19981;&#20449;&#30001;&#20320;&#65292;&#36825;&#20123;&#23601;&#26159;&#25105;&#20204;&#38656;&#35201;&#32534;&#20889;&#30340;&#36890;&#36807;Django&#23384;&#21462;&#22522;&#26412;&#25968;&#25454;&#30340;&#25152;&#26377;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#27599;&#20010;&#27169;&#22411;&#30456;&#24403;&#20110;&#21333;&#20010;&#25968;&#25454;&#24211;&#34920;&#65292;&#27599;&#20010;&#23646;&#24615;&#20063;&#26159;&#36825;&#20010;&#34920;&#20013;&#30340;&#19968;&#20010;&#23383;&#27573;&#12290; &#23646;&#24615;&#21517;&#23601;&#26159;&#23383;&#27573;&#21517;&#65292;&#23427;&#30340;&#31867;&#22411;&#65288;&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CharField&lt;/span&gt;&lt;/tt&gt; &#65289;&#30456;&#24403;&#20110;&#25968;&#25454;&#24211;&#30340;&#23383;&#27573;&#31867;&#22411; &#65288;&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;varchar&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290;&#20363;&#22914;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#31561;&#21516;&#20110;&#19979;&#38754;&#36825;&#24352;&#34920;&#65288;&#29992;PostgreSQL&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt; &#35821;&#27861;&#25551;&#36848;&#65289;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn109&quot;&gt;CREATE TABLE &quot;books_publisher&quot; (
    &quot;id&quot; serial NOT NULL PRIMARY KEY,
    &quot;name&quot; varchar(30) NOT NULL,
    &quot;address&quot; varchar(50) NOT NULL,
    &quot;city&quot; varchar(60) NOT NULL,
    &quot;state_province&quot; varchar(30) NOT NULL,
    &quot;country&quot; varchar(50) NOT NULL,
    &quot;website&quot; varchar(200) NOT NULL
);
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&#20107;&#23454;&#19978;&#65292;&#27491;&#22914;&#36807;&#19968;&#20250;&#20799;&#25105;&#20204;&#25152;&#35201;&#23637;&#31034;&#30340;&#65292;Django &#21487;&#20197;&#33258;&#21160;&#29983;&#25104;&#36825;&#20123; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&#8220;&#27599;&#20010;&#25968;&#25454;&#24211;&#34920;&#23545;&#24212;&#19968;&#20010;&#31867;&#8221;&#36825;&#26465;&#35268;&#21017;&#30340;&#20363;&#22806;&#24773;&#20917;&#26159;&#22810;&#23545;&#22810;&#20851;&#31995;&#12290; &#22312;&#25105;&#20204;&#30340;&#33539;&#20363;&#27169;&#22411;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book&lt;/span&gt;&lt;/tt&gt; &#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#22810;&#23545;&#22810;&#23383;&#27573;&lt;/span&gt;&lt;/tt&gt; &#21483;&#20570; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authors&lt;/span&gt;&lt;/tt&gt; &#12290; &#35813;&#23383;&#27573;&#34920;&#26126;&#19968;&#26412;&#20070;&#31821;&#26377;&#19968;&#20010;&#25110;&#22810;&#20010;&#20316;&#32773;&#65292;&#20294; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book&lt;/span&gt;&lt;/tt&gt; &#25968;&#25454;&#24211;&#34920;&#21364;&#24182;&#27809;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authors&lt;/span&gt;&lt;/tt&gt; &#23383;&#27573;&#12290;
&#30456;&#21453;&#65292;Django&#21019;&#24314;&#20102;&#19968;&#20010;&#39069;&#22806;&#30340;&#34920;&#65288;&#22810;&#23545;&#22810;&#36830;&#25509;&#34920;&#65289;&#26469;&#22788;&#29702;&#20070;&#31821;&#21644;&#20316;&#32773;&#20043;&#38388;&#30340;&#26144;&#23556;&#20851;&#31995;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&#35831;&#26597;&#30475;&#38468;&#24405; B &#20102;&#35299;&#25152;&#26377;&#30340;&#23383;&#27573;&#31867;&#22411;&#21644;&#27169;&#22411;&#35821;&#27861;&#36873;&#39033;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#26368;&#21518;&#38656;&#35201;&#27880;&#24847;&#30340;&#26159;&#65292;&#25105;&#20204;&#24182;&#27809;&#26377;&#26174;&#24335;&#22320;&#20026;&#36825;&#20123;&#27169;&#22411;&#23450;&#20041;&#20219;&#20309;&#20027;&#38190;&#12290; &#38500;&#38750;&#20320;&#21333;&#29420;&#25351;&#26126;&#65292;&#21542;&#21017;Django&#20250;&#33258;&#21160;&#20026;&#27599;&#20010;&#27169;&#22411;&#29983;&#25104;&#19968;&#20010;&#33258;&#22686;&#38271;&#30340;&#25972;&#25968;&#20027;&#38190;&#23383;&#27573;&#27599;&#20010;Django&#27169;&#22411;&#37117;&#35201;&#27714;&#26377;&#21333;&#29420;&#30340;&#20027;&#38190;&#12290;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;id&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn114&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#27169;&#22411;&#23433;&#35013;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#23436;&#25104;&#36825;&#20123;&#20195;&#30721;&#20043;&#21518;&#65292;&#29616;&#22312;&#35753;&#25105;&#20204;&#26469;&#22312;&#25968;&#25454;&#24211;&#20013;&#21019;&#24314;&#36825;&#20123;&#34920;&#12290; &#35201;&#23436;&#25104;&#35813;&#39033;&#24037;&#20316;&#65292;&#31532;&#19968;&#27493;&#26159;&#22312; Django &#39033;&#30446;&#20013; &lt;em&gt;&#28608;&#27963;&lt;/em&gt; &#36825;&#20123;&#27169;&#22411;&#12290; &#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;books&lt;/span&gt;&lt;/tt&gt; app &#28155;&#21152;&#21040;&#37197;&#32622;&#25991;&#20214;&#30340;&#24050;&#23433;&#35013;&#24212;&#29992;&#21015;&#34920;&#20013;&#21363;&#21487;&#23436;&#25104;&#27492;&#27493;&#39588;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn116&quot;&gt;&#20877;&#27425;&#32534;&#36753; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;settings.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#65292; &#25214;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#21578;&#35785; Django &#39033;&#30446;&#21738;&#20123; app &#22788;&#20110;&#28608;&#27963;&#29366;&#24577;&#12290; &#32570;&#30465;&#24773;&#20917;&#19979;&#22914;&#19979;&#25152;&#31034;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn118&quot;&gt;INSTALLED_APPS = (
    &apos;django.contrib.auth&apos;,
    &apos;django.contrib.contenttypes&apos;,
    &apos;django.contrib.sessions&apos;,
    &apos;django.contrib.sites&apos;,
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#25226;&#36825;&#22235;&#20010;&#35774;&#32622;&#21069;&#38754;&#21152;#&#20020;&#26102;&#27880;&#37322;&#36215;&#26469;&#12290; &#65288;&#36825;&#22235;&#20010;app&#26159;&#32463;&#24120;&#20351;&#29992;&#21040;&#30340;&#65292;&#25105;&#20204;&#23558;&#22312;&#21518;&#32493;&#31456;&#33410;&#37324;&#35752;&#35770;&#22914;&#20309;&#20351;&#29992;&#23427;&#20204;&#65289;&#12290;&#21516;&#26102;&#65292;&#27880;&#37322;&#25481;MIDDLEWARE_CLASSES&#30340;&#40664;&#35748;&#35774;&#32622;&#26465;&#30446;&#65292;&#22240;&#20026;&#36825;&#20123;&#26465;&#30446;&#26159;&#20381;&#36182;&#20110;&#21018;&#25165;&#25105;&#20204;&#21018;&#22312;INSTALLED_APPS&#27880;&#37322;&#25481;&#30340;apps&#12290;
&#28982;&#21518;&#65292;&#28155;&#21152;`` &#8216;mysite.books&#8217;`` &#21040;`` INSTALLED_APPS`` &#30340;&#26411;&#23614;&#65292;&#27492;&#26102;&#35774;&#32622;&#30340;&#20869;&#23481;&#30475;&#36215;&#26469;&#24212;&#35813;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn121&quot;&gt;MIDDLEWARE_CLASSES = (
    # &apos;django.middleware.common.CommonMiddleware&apos;,
    # &apos;django.contrib.sessions.middleware.SessionMiddleware&apos;,
    # &apos;django.contrib.auth.middleware.AuthenticationMiddleware&apos;,
)

INSTALLED_APPS = (
    # &apos;django.contrib.auth&apos;,
    # &apos;django.contrib.contenttypes&apos;,
    # &apos;django.contrib.sessions&apos;,
    # &apos;django.contrib.sites&apos;,
    &apos;mysite.books&apos;,
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn122&quot;&gt;(&#23601;&#20687;&#25105;&#20204;&#22312;&#19978;&#19968;&#31456;&#35774;&#32622;TEMPLATE_DIRS&#25152;&#25552;&#21040;&#30340;&#36887;&#21495;&#65292;&#21516;&#26679;&#22312;INSTALLED_APPS&#30340;&#26411;&#23614;&#20063;&#38656;&#28155;&#21152;&#19968;&#20010;&#36887;&#21495;&#65292;&#22240;&#20026;&#36825;&#26159;&#20010;&#21333;&#20803;&#32032;&#30340;&#20803;&#32452;&#12290; &#21478;&#22806;&#65292;&#26412;&#20070;&#30340;&#20316;&#32773;&#21916;&#27426;&#22312; &lt;em&gt;&#27599;&#19968;&#20010;&lt;/em&gt; tuple&#20803;&#32032;&#21518;&#38754;&#21152;&#19968;&#20010;&#36887;&#21495;&#65292;&#19981;&#31649;&#23427;&#26159;&#19981;&#26159; &#21482;&#26377;&#19968;&#20010;&#20803;&#32032;&#12290; &#36825;&#26159;&#20026;&#20102;&#36991;&#20813;&#24536;&#20102;&#21152;&#36887;&#21495;&#65292;&#32780;&#19988;&#20063;&#27809;&#20160;&#20040;&#22351;&#22788;&#12290;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;mysite.books&apos;&lt;/span&gt;&lt;/tt&gt;&#25351;&#31034;&#25105;&#20204;&#27491;&#22312;&#32534;&#20889;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;books&lt;/span&gt;&lt;/tt&gt; app&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#27599;&#20010;app&#37117;&#20351;&#29992; Python&#30340;&#36335;&#24452;&#25551;&#36848;&#65292;&#21253;&#30340;&#36335;&#24452;&#65292;&#29992;&#23567;&#25968;&#28857;&#8220;.&#8221;&#38388;&#38548;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#29616;&#22312;&#25105;&#20204;&#21487;&#20197;&#21019;&#24314;&#25968;&#25454;&#24211;&#34920;&#20102;&#12290; &#39318;&#20808;&#65292;&#29992;&#19979;&#38754;&#30340;&#21629;&#20196;&#39564;&#35777;&#27169;&#22411;&#30340;&#26377;&#25928;&#24615;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn126&quot;&gt;python manage.py validate
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;validate&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#26816;&#26597;&#20320;&#30340;&#27169;&#22411;&#30340;&#35821;&#27861;&#21644;&#36923;&#36753;&#26159;&#21542;&#27491;&#30830;&#12290; &#22914;&#26524;&#19968;&#20999;&#27491;&#24120;&#65292;&#20320;&#20250;&#30475;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;errors&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;found&lt;/span&gt;&lt;/tt&gt; &#28040;&#24687;&#12290;&#22914;&#26524;&#20986;&#38169;&#65292;&#35831;&#26816;&#26597;&#20320;&#36755;&#20837;&#30340;&#27169;&#22411;&#20195;&#30721;&#12290; &#38169;&#35823;&#36755;&#20986;&#20250;&#32473;&#20986;&#38750;&#24120;&#26377;&#29992;&#30340;&#38169;&#35823;&#20449;&#24687;&#26469;&#24110;&#21161;&#20320;&#20462;&#27491;&#20320;&#30340;&#27169;&#22411;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#19968;&#26086;&#20320;&#35273;&#24471;&#20320;&#30340;&#27169;&#22411;&#21487;&#33021;&#26377;&#38382;&#39064;&#65292;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;validate&lt;/span&gt;&lt;/tt&gt; &#12290; &#23427;&#21487;&#20197;&#24110;&#21161;&#20320;&#25429;&#33719;&#19968;&#20123;&#24120;&#35265;&#30340;&#27169;&#22411;&#23450;&#20041;&#38169;&#35823;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#27169;&#22411;&#30830;&#35748;&#27809;&#38382;&#39064;&#20102;&#65292;&#36816;&#34892;&#19979;&#38754;&#30340;&#21629;&#20196;&#26469;&#29983;&#25104; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#65288;&#22914;&#26524;&#20320;&#20351;&#29992;&#30340;&#26159;Unix&#65292;&#37027;&#20040;&#21487;&#20197;&#21551;&#29992;&#35821;&#27861;&#39640;&#20142;&#65289;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn131&quot;&gt;python manage.py sqlall books
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&#22312;&#36825;&#20010;&#21629;&#20196;&#34892;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;books&lt;/span&gt;&lt;/tt&gt; &#26159;app&#30340;&#21517;&#31216;&#12290; &#21644;&#20320;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startapp&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#19968;&#26679;&#12290;&#25191;&#34892;&#20043;&#21518;&#65292;&#36755;&#20986;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn134&quot;&gt;BEGIN;
CREATE TABLE &quot;books_publisher&quot; (
    &quot;id&quot; serial NOT NULL PRIMARY KEY,
    &quot;name&quot; varchar(30) NOT NULL,
    &quot;address&quot; varchar(50) NOT NULL,
    &quot;city&quot; varchar(60) NOT NULL,
    &quot;state_province&quot; varchar(30) NOT NULL,
    &quot;country&quot; varchar(50) NOT NULL,
    &quot;website&quot; varchar(200) NOT NULL
)
;
CREATE TABLE &quot;books_author&quot; (
    &quot;id&quot; serial NOT NULL PRIMARY KEY,
    &quot;first_name&quot; varchar(30) NOT NULL,
    &quot;last_name&quot; varchar(40) NOT NULL,
    &quot;email&quot; varchar(75) NOT NULL
)
;
CREATE TABLE &quot;books_book&quot; (
    &quot;id&quot; serial NOT NULL PRIMARY KEY,
    &quot;title&quot; varchar(100) NOT NULL,
    &quot;publisher_id&quot; integer NOT NULL REFERENCES &quot;books_publisher&quot; (&quot;id&quot;) DEFERRABLE INITIALLY DEFERRED,
    &quot;publication_date&quot; date NOT NULL
)
;
CREATE TABLE &quot;books_book_authors&quot; (
    &quot;id&quot; serial NOT NULL PRIMARY KEY,
    &quot;book_id&quot; integer NOT NULL REFERENCES &quot;books_book&quot; (&quot;id&quot;) DEFERRABLE INITIALLY DEFERRED,
    &quot;author_id&quot; integer NOT NULL REFERENCES &quot;books_author&quot; (&quot;id&quot;) DEFERRABLE INITIALLY DEFERRED,
    UNIQUE (&quot;book_id&quot;, &quot;author_id&quot;)
)
;
CREATE INDEX &quot;books_book_publisher_id&quot; ON &quot;books_book&quot; (&quot;publisher_id&quot;);
COMMIT;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#27880;&#24847;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn136&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn136&quot;&gt;&#33258;&#21160;&#29983;&#25104;&#30340;&#34920;&#21517;&#26159;app&#21517;&#31216;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;books&lt;/span&gt;&lt;/tt&gt; &#65289;&#21644;&#27169;&#22411;&#30340;&#23567;&#20889;&#21517;&#31216; &#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;publisher&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;book&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;author&lt;/span&gt;&lt;/tt&gt; )&#30340;&#32452;&#21512;&#12290;&#20320;&#21487;&#20197;&#21442;&#32771;&#38468;&#24405;B&#37325;&#20889;&#36825;&#20010;&#35268;&#21017;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn137&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn137&quot;&gt;&#25105;&#20204;&#21069;&#38754;&#24050;&#32463;&#25552;&#21040;&#65292;Django&#20026;&#27599;&#20010;&#34920;&#26684;&#33258;&#21160;&#28155;&#21152;&#21152;&#20102;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;id&lt;/span&gt;&lt;/tt&gt; &#20027;&#38190;&#65292;
&#20320;&#21487;&#20197;&#37325;&#26032;&#35774;&#32622;&#23427;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn138&quot;&gt;&#25353;&#32422;&#23450;&#65292;Django&#28155;&#21152; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;_id&quot;&lt;/span&gt;&lt;/tt&gt; &#21518;&#32512;&#21040;&#22806;&#38190;&#23383;&#27573;&#21517;&#12290; &#20320;&#29468;&#23545;&#20102;&#65292;&#36825;&#20010;&#21516;&#26679;&#26159;&#21487;&#20197;&#33258;&#23450;&#20041;&#30340;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn139&quot;&gt;&#22806;&#38190;&#26159;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;REFERENCES&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#26126;&#30830;&#23450;&#20041;&#30340;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn140&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn140&quot;&gt;&#36825;&#20123; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#20250;&#26681;&#25454;&#20320;&#30340;&#25968;&#25454;&#24211;&#32780;&#20316;&#35843;&#25972;&#65292;&#36825;&#26679;&#35937;&#25968;&#25454;&#24211;&#29305;&#23450;&#30340;&#19968;&#20123;&#23383;&#27573;&#20363;&#22914;&#65306;&#65288;MySQL&#65289;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;auto_increment&lt;/span&gt;&lt;/tt&gt;&#65288;PostgreSQL&#65289;,&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;serial&lt;/span&gt;&lt;/tt&gt;&#65288;SQLite&#65289;&#65292;&#37117;&#20250;&#33258;&#21160;&#29983;&#25104;&#12290;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;integer&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;primary&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;key&lt;/span&gt;&lt;/tt&gt; &#21516;&#26679;&#30340;&#65292;&#23383;&#27573;&#21517;&#31216;&#20063;&#26159;&#33258;&#21160;&#22788;&#29702;&#65288;&#20363;&#22914;&#21333;&#24341;&#21495;&#36824;&#22909;&#26159;&#21452;&#24341;&#21495;&#65289;&#12290; &#20363;&#23376;&#20013;&#30340;&#36755;&#20986;&#26159;&#22522;&#20110;PostgreSQL&#35821;&#27861;&#30340;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter06</id>
        <title type="html">chapter06</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter06"/>
        <published>2015-02-26T23:27:33+08:00</published>
        <updated>2015-02-26T23:27:33+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;django&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#20845;&#31456; Django&#31449;&#28857;&#31649;&#29702;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#23545;&#20110;&#26576;&#19968;&#31867;&#32593;&#31449;&#65292; &lt;em&gt;&#31649;&#29702;&#30028;&#38754;&lt;/em&gt; &#26159;&#22522;&#30784;&#35774;&#26045;&#20013;&#38750;&#24120;&#37325;&#35201;&#30340;&#19968;&#37096;&#20998;&#12290; &#36825;&#26159;&#20197;&#32593;&#39029;&#21644;&#26377;&#38480;&#30340;&#21487;&#20449;&#20219;&#31649;&#29702;&#32773;&#20026;&#22522;&#30784;&#30340;&#30028;&#38754;&#65292;&#23427;&#21487;&#20197;&#35753;&#20320;&#28155;&#21152;&#65292;&#32534;&#36753;&#21644;&#21024;&#38500;&#32593;&#31449;&#20869;&#23481;&#12290;
&#19968;&#20123;&#24120;&#35265;&#30340;&#20363;&#23376;&#65306; &#20320;&#21487;&#20197;&#29992;&#36825;&#20010;&#30028;&#38754;&#21457;&#24067;&#21338;&#23458;&#65292;&#21518;&#21488;&#30340;&#32593;&#31449;&#31649;&#29702;&#32773;&#29992;&#23427;&#26469;&#28070;&#33394;&#35835;&#32773;&#25552;&#20132;&#30340;&#20869;&#23481;&#65292;&#20320;&#30340;&#23458;&#25143;&#29992;&#20320;&#32473;&#20182;&#20204;&#24314;&#31435;&#30340;&#30028;&#38754;&#24037;&#20855;&#26356;&#26032;&#26032;&#38395;&#24182;&#21457;&#24067;&#22312;&#32593;&#31449;&#19978;&#65292;&#36825;&#20123;&#37117;&#26159;&#20351;&#29992;&#31649;&#29702;&#30028;&#38754;&#30340;&#20363;&#23376;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#20294;&#26159;&#31649;&#29702;&#30028;&#38754;&#26377;&#19968;&#38382;&#39064;&#65306; &#21019;&#24314;&#23427;&#22826;&#32321;&#29712;&#12290; &#24403;&#20320;&#24320;&#21457;&#23545;&#20844;&#20247;&#30340;&#21151;&#33021;&#26102;&#65292;&#32593;&#39029;&#24320;&#21457;&#26159;&#26377;&#36259;&#30340;&#65292;&#20294;&#26159;&#21019;&#24314;&#31649;&#29702;&#30028;&#38754;&#36890;&#24120;&#26159;&#21315;&#31687;&#19968;&#24459;&#30340;&#12290; &#20320;&#24517;&#39035;&#35748;&#35777;&#29992;&#25143;&#65292;&#26174;&#31034;&#24182;&#31649;&#29702;&#34920;&#26684;&#65292;&#39564;&#35777;&#36755;&#20837;&#30340;&#26377;&#25928;&#24615;&#35832;&#22914;&#27492;&#31867;&#12290; &#36825;&#24456;&#32321;&#29712;&#32780;&#19988;&#26159;&#37325;&#22797;&#21171;&#21160;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;Django &#22312;&#23545;&#36825;&#20123;&#32321;&#29712;&#21644;&#37325;&#22797;&#30340;&#24037;&#20316;&#36827;&#34892;&#20102;&#21738;&#20123;&#25913;&#36827;&#65311; &#23427;&#29992;&#19981;&#33021;&#20877;&#23569;&#30340;&#20195;&#30721;&#20026;&#20320;&#20570;&#20102;&#25152;&#26377;&#30340;&#19968;&#20999;&#12290; Django &#20013;&#21019;&#24314;&#31649;&#29702;&#30028;&#38754;&#24050;&#32463;&#19981;&#26159;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#36825;&#19968;&#31456;&#26159;&#20851;&#20110; Django &#30340;&#33258;&#21160;&#31649;&#29702;&#30028;&#38754;&#12290; &#36825;&#20010;&#29305;&#24615;&#26159;&#36825;&#26679;&#36215;&#20316;&#29992;&#30340;&#65306; &#23427;&#35835;&#21462;&#20320;&#27169;&#24335;&#20013;&#30340;&#20803;&#25968;&#25454;&#65292;&#28982;&#21518;&#25552;&#20379;&#32473;&#20320;&#19968;&#20010;&#24378;&#22823;&#32780;&#19988;&#21487;&#20197;&#20351;&#29992;&#30340;&#30028;&#38754;&#65292;&#32593;&#31449;&#31649;&#29702;&#32773;&#21487;&#20197;&#29992;&#23427;&#31435;&#21363;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&#35831;&#27880;&#24847;&#25105;&#20204;&#24314;&#35758;&#20320;&#35835;&#36825;&#31456;&#65292;&#21363;&#20351;&#20320;&#19981;&#25171;&#31639;&#29992;admin&#12290;&#22240;&#20026;&#25105;&#20204;&#23558;&#20171;&#32461;&#19968;&#20123;&#27010;&#24565;&#65292;&#36825;&#20123;&#27010;&#24565;&#21487;&#20197;&#24212;&#29992;&#21040;Django&#30340;&#25152;&#26377;&#26041;&#38754;&#65292;&#32780;&#19981;&#20165;&#20165;&#26159;admin&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;django-contrib&quot;&gt;
&lt;span id=&quot;cn6&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn6&quot;&gt;django.contrib &#21253;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;Django&#33258;&#21160;&#31649;&#29702;&#24037;&#20855;&#26159;django.contrib&#30340;&#19968;&#37096;&#20998;&#12290;django.contrib&#26159;&#19968;&#22871;&#24222;&#22823;&#30340;&#21151;&#33021;&#38598;&#65292;&#23427;&#26159;Django&#22522;&#26412;&#20195;&#30721;&#30340;&#32452;&#25104;&#37096;&#20998;&#65292;Django&#26694;&#26550;&#23601;&#26159;&#30001;&#20247;&#22810;&#21253;&#21547;&#38468;&#21152;&#32452;&#20214;(add-on)&#30340;&#22522;&#26412;&#20195;&#30721;&#26500;&#25104;&#30340;&#12290; &#20320;&#21487;&#20197;&#25226;django.contrib&#30475;&#20316;&#26159;&#21487;&#36873;&#30340;Python&#26631;&#20934;&#24211;&#25110;&#26222;&#36941;&#27169;&#24335;&#30340;&#23454;&#38469;&#23454;&#29616;&#12290; &#23427;&#20204;&#19982;Django&#25414;&#32465;&#22312;&#19968;&#36215;&#65292;&#36825;&#26679;&#20320;&#22312;&#24320;&#21457;&#20013;&#23601;&#19981;&#29992;&#8220;&#37325;&#22797;&#21457;&#26126;&#36718;&#23376;&#8221;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#31649;&#29702;&#24037;&#20855;&#26159;&#26412;&#20070;&#35762;&#36848;django.contrib&#30340;&#31532;&#19968;&#20010;&#37096;&#20998;&#12290;&#20174;&#25216;&#26415;&#23618;&#38754;&#19978;&#35762;&#65292;&#23427;&#34987;&#31216;&#20316;django.contrib.admin&#12290;django.contrib&#20013;&#20854;&#23427;&#21487;&#29992;&#30340;&#29305;&#24615;&#65292;&#22914;&#29992;&#25143;&#37492;&#21035;&#31995;&#32479;(django.contrib.auth)&#12289;&#25903;&#25345;&#21311;&#21517;&#20250;&#35805;(django.contrib.sessioins)&#20197;&#21450;&#29992;&#25143;&#35780;&#27880;&#31995;&#32479;(django.contrib.comments)&#12290;&#36825;&#20123;&#65292;&#25105;&#20204;&#23558;&#22312;&#31532;&#21313;&#20845;&#31456;&#35814;&#32454;&#35752;&#35770;&#12290;&#22312;&#25104;&#20026;&#19968;&#20010;Django&#19987;&#23478;&#20197;&#21069;&#65292;&#20320;&#23558;&#20250;&#30693;&#36947;&#26356;&#22810;django.contrib&#30340;&#29305;&#24615;&#12290; &#30446;&#21069;&#65292;&#20320;&#21482;&#38656;&#35201;&#30693;&#36947;Django&#33258;&#24102;&#24456;&#22810;&#20248;&#31168;&#30340;&#38468;&#21152;&#32452;&#20214;&#65292;&#23427;&#20204;&#37117;&#23384;&#22312;&#20110;django.contrib&#21253;&#37324;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id1&quot;&gt;
&lt;span id=&quot;cn9&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#28608;&#27963;&#31649;&#29702;&#30028;&#38754;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;Django&#31649;&#29702;&#31449;&#28857;&#23436;&#20840;&#26159;&#21487;&#36873;&#25321;&#30340;&#65292;&#22240;&#20026;&#20165;&#20165;&#26576;&#20123;&#29305;&#27530;&#31867;&#22411;&#30340;&#31449;&#28857;&#25165;&#38656;&#35201;&#36825;&#20123;&#21151;&#33021;&#12290; &#36825;&#24847;&#21619;&#30528;&#20320;&#38656;&#35201;&#22312;&#20320;&#30340;&#39033;&#30446;&#20013;&#33457;&#36153;&#20960;&#20010;&#27493;&#39588;&#21435;&#28608;&#27963;&#23427;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#31532;&#19968;&#27493;&#65292;&#23545;&#20320;&#30340;settings&#25991;&#20214;&#20570;&#22914;&#19979;&#36825;&#20123;&#25913;&#21464;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn12&quot;&gt;&#23558;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.admin&apos;&lt;/span&gt;&lt;/tt&gt;&#21152;&#20837;setting&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt;&#37197;&#32622;&#20013; &#65288;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt;&#20013;&#30340;&#37197;&#32622;&#39034;&#24207;&#26159;&#27809;&#26377;&#20851;&#31995;&#30340;, &#20294;&#26159;&#25105;&#20204;&#21916;&#27426;&#20445;&#25345;&#19968;&#23450;&#39034;&#24207;&#20197;&#26041;&#20415;&#20154;&#26469;&#38405;&#35835;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn13&quot;&gt;&#20445;&#35777;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt;&#20013;&#21253;&#21547;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.auth&apos;&lt;/span&gt;&lt;/tt&gt;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.contenttypes&apos;&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.sessions&apos;&lt;/span&gt;&lt;/tt&gt;&#65292;Django&#30340;&#31649;&#29702;&#24037;&#20855;&#38656;&#35201;&#36825;3&#20010;&#21253;&#12290; (&#22914;&#26524;&#20320;&#36319;&#38543;&#26412;&#25991;&#21046;&#20316;mysite&#39033;&#30446;&#30340;&#35805;&#65292;&#37027;&#20040;&#35831;&#27880;&#24847;&#25105;&#20204;&#22312;&#31532;&#20116;&#31456;&#30340;&#26102;&#20505;&#25226;&#36825;&#19977;&#39033;INSTALLED_APPS&#26465;&#30446;&#27880;&#37322;&#20102;&#12290;&#29616;&#22312;&#65292;&#35831;&#25226;&#27880;&#37322;&#21462;&#28040;&#12290;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn14&quot;&gt;&#30830;&#20445;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#21253;&#21547;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.middleware.common.CommonMiddleware&apos;&lt;/span&gt;&lt;/tt&gt; &#12289;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.sessions.middleware.SessionMiddleware&apos;&lt;/span&gt;&lt;/tt&gt; &#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.auth.middleware.AuthenticationMiddleware&apos;&lt;/span&gt;&lt;/tt&gt; &#12290;(&#20877;&#27425;&#25552;&#37266;&#65292;&#22914;&#26524;&#26377;&#36319;&#30528;&#20570;mysite&#30340;&#35805;&#65292;&#35831;&#25226;&#22312;&#31532;&#20116;&#31456;&#20570;&#30340;&#27880;&#37322;&#21462;&#28040;&#12290;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt; &#12290;&#36825;&#19968;&#27493;&#23558;&#29983;&#25104;&#31649;&#29702;&#30028;&#38754;&#20351;&#29992;&#30340;&#39069;&#22806;&#25968;&#25454;&#24211;&#34920;&#12290; &#24403;&#20320;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.auth&apos;&lt;/span&gt;&lt;/tt&gt;&#21152;&#36827;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt;&#21518;&#65292;&#31532;&#19968;&#27425;&#36816;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt;&#21629;&#20196;&#26102;, &#31995;&#32479;&#20250;&#35831;&#20320;&#21019;&#24314;&#19968;&#20010;&#36229;&#32423;&#29992;&#25143;&#12290; &#22914;&#26524;&#20320;&#19981;&#36825;&#20040;&#20316;&#65292;&#20320;&#38656;&#35201;&#36816;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;createsuperuser&lt;/span&gt;&lt;/tt&gt;&#26469;&#21478;&#22806;&#21019;&#24314;&#19968;&#20010;admin&#30340;&#29992;&#25143;&#24080;&#21495;&#65292;&#21542;&#21017;&#20320;&#23558;&#19981;&#33021;&#30331;&#20837;admin (&#25552;&#37266;&#19968;&#21477;: &#21482;&#26377;&#24403;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt;&#21253;&#21547;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.auth&apos;&lt;/span&gt;&lt;/tt&gt;&#26102;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;createsuperuser&lt;/span&gt;&lt;/tt&gt;&#36825;&#20010;&#21629;&#20196;&#25165;&#21487;&#29992;.)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#31532;&#19977;&#65292;&#23558;admin&#35775;&#38382;&#37197;&#32622;&#22312;URLconf(&#35760;&#20303;&#65292;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urls.py&lt;/span&gt;&lt;/tt&gt;&#20013;). &#40664;&#35748;&#24773;&#20917;&#19979;&#65292;&#21629;&#20196;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt;&lt;/tt&gt;&#29983;&#25104;&#30340;&#25991;&#20214;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urls.py&lt;/span&gt;&lt;/tt&gt;&#26159;&#23558;Django admin&#30340;&#36335;&#24452;&#27880;&#37322;&#25481;&#30340;&#65292;&#20320;&#25152;&#35201;&#20570;&#30340;&#23601;&#26159;&#21462;&#28040;&#27880;&#37322;&#12290; &#35831;&#27880;&#24847;&#65292;&#20197;&#19979;&#20869;&#23481;&#26159;&#24517;&#39035;&#30830;&#20445;&#23384;&#22312;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn18&quot;&gt;# Include these import statements...
from django.contrib import admin
admin.autodiscover()

# And include this URLpattern...
urlpatterns = patterns(&apos;&apos;,
    # ...
    (r&apos;^admin/&apos;, include(admin.site.urls)),
    # ...
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#24403;&#36825;&#19968;&#20999;&#37117;&#37197;&#32622;&#22909;&#21518;&#65292;&#29616;&#22312;&#20320;&#23558;&#21457;&#29616;Django&#31649;&#29702;&#24037;&#20855;&#21487;&#20197;&#36816;&#34892;&#20102;&#12290; &#21551;&#21160;&#24320;&#21457;&#26381;&#21153;&#22120;(&#22914;&#21069;&#65306;`` python manage.py runserver`` )&#65292;&#28982;&#21518;&#22312;&#27983;&#35272;&#22120;&#20013;&#35775;&#38382;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/admin/&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn20&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#65292;&#20351;&#29992;&#31649;&#29702;&#24037;&#20855;&#12290;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#31649;&#29702;&#30028;&#38754;&#30340;&#35774;&#35745;&#26159;&#38024;&#23545;&#38750;&#25216;&#26415;&#20154;&#21592;&#30340;&#65292;&#25152;&#20197;&#23427;&#24212;&#35813;&#26159;&#33258;&#25105;&#35299;&#37322;&#30340;&#12290; &#23613;&#31649;&#22914;&#27492;&#65292;&#36825;&#37324;&#31616;&#21333;&#20171;&#32461;&#19968;&#19979;&#23427;&#30340;&#22522;&#26412;&#29305;&#24615;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&#20320;&#30475;&#21040;&#30340;&#31532;&#19968;&#20214;&#20107;&#26159;&#22914;&#22270;6-1&#25152;&#31034;&#30340;&#30331;&#24405;&#23631;&#24149;&#12290;&lt;/p&gt;
&lt;img alt=&quot;Django &#30331;&#24405;&#39029;&#38754;&#30340;&#25130;&#22270;&#12290;&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter06/login.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#22270; 6-1. Django&#30340;&#30331;&#24405;&#25130;&#22270;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#20320;&#35201;&#20351;&#29992;&#20320;&#21407;&#26469;&#35774;&#32622;&#30340;&#36229;&#32423;&#29992;&#25143;&#30340;&#29992;&#25143;&#21517;&#21644;&#23494;&#30721;&#12290;
&#22914;&#26524;&#26080;&#27861;&#30331;&#24405;&#65292;&#35831;&#36816;&#34892;`` python manage.py createsuperuser`` &#65292;&#30830;&#20445;&#20320;&#24050;&#32463;&#21019;&#24314;&#20102;&#19968;&#20010;&#36229;&#32423;&#29992;&#25143;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&#19968;&#26086;&#30331;&#24405;&#20102;&#65292;&#20320;&#23558;&#30475;&#21040;&#31649;&#29702;&#39029;&#38754;&#12290;
&#36825;&#20010;&#39029;&#38754;&#21015;&#20986;&#20102;&#31649;&#29702;&#24037;&#20855;&#20013;&#21487;&#32534;&#36753;&#30340;&#25152;&#26377;&#25968;&#25454;&#31867;&#22411;&#12290; &#29616;&#22312;&#65292;&#30001;&#20110;&#25105;&#20204;&#36824;&#27809;&#26377;&#21019;&#24314;&#20219;&#20309;&#27169;&#22359;&#65292;&#25152;&#20197;&#36825;&#20010;&#21015;&#34920;&#21482;&#26377;&#23525;&#23525;&#25968;&#26465;&#31867;&#30446;&#65306; &#23427;&#20165;&#26377;&#20004;&#20010;&#40664;&#35748;&#30340;&#31649;&#29702;-&#32534;&#36753;&#27169;&#22359;&#65306;&#29992;&#25143;&#32452;(Groups)&#21644;&#29992;&#25143;(Users)&#12290;&lt;/p&gt;
&lt;img alt=&quot;Django &#20027;&#31649;&#29702;&#32034;&#24341;&#25130;&#22270;&#12290;&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter06/admin_index.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#22270; 6-2&#12290; Django admin&#30340;&#39318;&#39029;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#22312;Django&#31649;&#29702;&#39029;&#38754;&#20013;&#65292;&#27599;&#19968;&#31181;&#25968;&#25454;&#31867;&#22411;&#37117;&#26377;&#19968;&#20010;* change list* &#21644;* edit
form* &#12290;&#21069;&#32773;&#26174;&#31034;&#25968;&#25454;&#24211;&#20013;&#25152;&#26377;&#30340;&#21487;&#29992;&#23545;&#35937;&#65307;&#21518;&#32773;&#21487;&#35753;&#20320;&#28155;&#21152;&#12289;&#26356;&#25913;&#21644;&#21024;&#38500;&#25968;&#25454;&#24211;&#20013;&#30340;&#26576;&#26465;&#35760;&#24405;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#20854;&#23427;&#35821;&#35328;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#22914;&#26524;&#20320;&#30340;&#27597;&#35821;&#19981;&#26159;&#33521;&#35821;&#65292;&#32780;&#20320;&#19981;&#24819;&#29992;&#23427;&#26469;&#37197;&#32622;&#20320;&#30340;&#27983;&#35272;&#22120;&#65292;&#20320;&#21487;&#20197;&#20570;&#19968;&#20010;&#24555;&#36895;&#26356;&#25913;&#26469;&#35266;&#23519;Django&#31649;&#29702;&#24037;&#20855;&#26159;&#21542;&#34987;&#32763;&#35793;&#25104;&#20320;&#24819;&#35201;&#30340;&#35821;&#35328;&#12290; &#20165;&#38656;&#28155;&#21152;`` &#8216;django.middleware.locale.LocaleMiddleware&#8217;`` &#21040;`` MIDDLEWARE_CLASSES`` &#35774;&#32622;&#20013;&#65292;&#24182;&#30830;&#20445;&#23427;&#22312;&#8217;django.contrib.sessions.middleware.SessionMiddleware&#8217;* &#20043;&#21518;* &#12290;
&#65288;&#35265;&#19978;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#23436;&#25104;&#21518;&#65292;&#35831;&#21047;&#26032;&#39029;&#38754;&#12290; &#22914;&#26524;&#20320;&#35774;&#32622;&#30340;&#35821;&#35328;&#21487;&#29992;&#65292;&#19968;&#31995;&#21015;&#30340;&#38142;&#25509;&#25991;&#23383;&#23558;&#34987;&#26174;&#31034;&#25104;&#36825;&#31181;&#35821;&#35328;&#12290;&#36825;&#20123;&#25991;&#23383;&#21253;&#25324;&#39029;&#38754;&#39030;&#31471;&#30340;Change
password&#21644;Log out&#65292;&#39029;&#38754;&#20013;&#37096;&#30340;Groups&#21644;Users&#12290; Django&#33258;&#24102;&#20102;&#22810;&#31181;&#35821;&#35328;&#30340;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#20851;&#20110;Django&#26356;&#22810;&#30340;&#22269;&#38469;&#21270;&#29305;&#24615;&#65292;&#35831;&#21442;&#35265;&#31532;&#21313;&#20061;&#31456;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#28857;&#20987;Uers&#34892;&#20013;&#30340;Change&#38142;&#25509;&#65292;&#24341;&#23548;&#29992;&#25143;&#26356;&#25913;&#21015;&#34920;&#12290;&lt;/p&gt;
&lt;img alt=&quot;&#20462;&#25913;&#36807;&#30340;&#21464;&#26356;&#21015;&#34920;&#39029;&#38754;&#25130;&#22270;&#12290;&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter06/changelist2.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#22270; 6-3. &#20856;&#22411;&#30340;&#25913;&#21464;&#21015;&#34920;&#35270;&#22270; &#65288;&#35265;&#19978;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#36825;&#20010;&#39029;&#38754;&#26174;&#31034;&#20102;&#25968;&#25454;&#24211;&#20013;&#25152;&#26377;&#30340;&#29992;&#25143;&#12290;&#20320;&#21487;&#20197;&#23558;&#23427;&#30475;&#20316;&#26159;&#19968;&#20010;&#28418;&#20142;&#30340;&#32593;&#39029;&#29256;&#26597;&#35810;&#65306;`` SELECT * FROM auth_user;`` &#22914;&#26524;&#20320;&#19968;&#30452;&#36319;&#30528;&#20316;&#32451;&#20064;&#65292;&#24182;&#19988;&#21482;&#28155;&#21152;&#20102;&#19968;&#20010;&#29992;&#25143;&#65292;&#20320;&#20250;&#22312;&#36825;&#20010;&#39029;&#38754;&#20013;&#30475;&#21040;&#19968;&#20010;&#29992;&#25143;&#12290;&#20294;&#26159;&#22914;&#26524;&#20320;&#28155;&#21152;&#20102;&#22810;&#20010;&#29992;&#25143;&#65292;&#20320;&#20250;&#21457;&#29616;&#39029;&#38754;&#20013;&#36824;&#26377;&#36807;&#28388;&#22120;&#12289;&#25490;&#24207;&#21644;&#26597;&#35810;&#26694;&#12290; &#36807;&#28388;&#22120;&#22312;&#21491;&#36793;&#65307;&#25490;&#24207;&#21151;&#33021;&#21487;&#36890;&#36807;&#28857;&#20987;&#21015;&#22836;&#26597;&#30475;&#65307;&#26597;&#35810;&#26694;&#22312;&#39029;&#38754;&#39030;&#37096;&#65292;&#23427;&#20801;&#35768;&#20320;&#36890;&#36807;&#29992;&#25143;&#21517;&#26597;&#35810;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#28857;&#20987;&#20854;&#20013;&#19968;&#20010;&#29992;&#25143;&#21517;&#65292;&#20320;&#20250;&#30475;&#35265;&#20851;&#20110;&#36825;&#20010;&#29992;&#25143;&#30340;&#32534;&#36753;&#31383;&#21475;&#12290;&lt;/p&gt;
&lt;img alt=&quot;&#20856;&#22411;&#30340;&#32534;&#36753;&#34920;&#26684;&#25130;&#22270;&#12290;&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter06/editform.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#22270; 6-4. &#20856;&#22411;&#30340;&#32534;&#36753;&#34920;&#26684; &#65288;&#35265;&#19978;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#36825;&#20010;&#39029;&#38754;&#20801;&#35768;&#20320;&#20462;&#25913;&#29992;&#25143;&#30340;&#23646;&#24615;&#65292;&#22914;&#22995;&#21517;&#21644;&#26435;&#38480;&#12290; &#65288;&#22914;&#26524;&#35201;&#26356;&#25913;&#29992;&#25143;&#23494;&#30721;&#65292;&#20320;&#24517;&#39035;&#28857;&#20987;&#23494;&#30721;&#23383;&#27573;&#19979;&#30340;change password form&#65292;&#32780;&#19981;&#26159;&#30452;&#25509;&#26356;&#25913;&#23383;&#27573;&#20540;&#20013;&#30340;&#21704;&#35199;&#30721;&#12290;&#65289;&#21478;&#22806;&#38656;&#35201;&#27880;&#24847;&#30340;&#26159;&#65292;&#19981;&#21516;&#31867;&#22411;&#30340;&#23383;&#27573;&#20250;&#29992;&#19981;&#21516;&#30340;&#31383;&#21475;&#25511;&#20214;&#26174;&#31034;&#12290;&#20363;&#22914;&#65292;&#26085;&#26399;/&#26102;&#38388;&#22411;&#29992;&#26085;&#21382;&#25511;&#20214;&#65292;&#24067;&#23572;&#22411;&#29992;&#22797;&#36873;&#26694;&#65292;&#23383;&#31526;&#22411;&#29992;&#31616;&#21333;&#25991;&#26412;&#26694;&#26174;&#31034;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#20320;&#21487;&#20197;&#36890;&#36807;&#28857;&#20987;&#32534;&#36753;&#39029;&#38754;&#19979;&#26041;&#30340;&#21024;&#38500;&#25353;&#38062;&#26469;&#21024;&#38500;&#19968;&#26465;&#35760;&#24405;&#12290; &#20320;&#20250;&#35265;&#21040;&#19968;&#20010;&#30830;&#35748;&#39029;&#38754;&#12290;&#26377;&#26102;&#20505;&#65292;&#23427;&#20250;&#26174;&#31034;&#26377;&#21738;&#20123;&#20851;&#32852;&#30340;&#23545;&#35937;&#23558;&#20250;&#19968;&#24182;&#34987;&#21024;&#38500;&#12290; &#65288;&#20363;&#22914;&#65292;&#22914;&#26524;&#20320;&#35201;&#21024;&#38500;&#19968;&#20010;&#20986;&#29256;&#31038;&#65292;&#23427;&#19979;&#38754;&#25152;&#26377;&#30340;&#22270;&#20070;&#20063;&#23558;&#34987;&#21024;&#38500;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&#20320;&#21487;&#20197;&#36890;&#36807;&#28857;&#20987;&#31649;&#29702;&#20027;&#39029;&#38754;&#20013;&#26576;&#20010;&#23545;&#35937;&#30340;Add&#26469;&#28155;&#21152;&#19968;&#26465;&#26032;&#35760;&#24405;&#12290; &#19968;&#20010;&#31354;&#30333;&#35760;&#24405;&#30340;&#39029;&#38754;&#23558;&#34987;&#25171;&#24320;&#65292;&#31561;&#24453;&#20320;&#22635;&#20805;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#20320;&#36824;&#33021;&#30475;&#21040;&#31649;&#29702;&#30028;&#38754;&#20063;&#25511;&#21046;&#30528;&#20320;&#36755;&#20837;&#30340;&#26377;&#25928;&#24615;&#12290; &#20320;&#21487;&#20197;&#35797;&#35797;&#19981;&#22635;&#24517;&#38656;&#30340;&#26639;&#30446;&#25110;&#32773;&#22312;&#26102;&#38388;&#26639;&#37324;&#22635;&#38169;&#35823;&#30340;&#26102;&#38388;&#65292;&#20320;&#20250;&#21457;&#29616;&#24403;&#20320;&#35201;&#20445;&#23384;&#26102;&#20250;&#20986;&#29616;&#38169;&#35823;&#20449;&#24687;&#65292;&#22914;&#22270;6-5&#25152;&#31034;&#12290;&lt;/p&gt;
&lt;img alt=&quot;&#32534;&#36753;&#34920;&#26684;&#26174;&#31034;&#38169;&#35823;&#20449;&#24687;&#30340;&#25130;&#22270;&#12290;&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter06/editform_errors.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#22270;6-5. &#32534;&#36753;&#34920;&#26684;&#26174;&#31034;&#38169;&#35823;&#20449;&#24687; &#65288;&#35265;&#19978;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#24403;&#20320;&#32534;&#36753;&#24050;&#26377;&#30340;&#23545;&#20687;&#26102;&#65292;&#20320;&#22312;&#31383;&#21475;&#30340;&#21491;&#19978;&#35282;&#21487;&#20197;&#30475;&#21040;&#19968;&#20010;&#21382;&#21490;&#25353;&#38062;&#12290; &#36890;&#36807;&#31649;&#29702;&#30028;&#38754;&#20570;&#30340;&#27599;&#19968;&#20010;&#25913;&#21464;&#37117;&#30041;&#26377;&#35760;&#24405;&#65292;&#20320;&#21487;&#20197;&#25353;&#21382;&#21490;&#38190;&#26469;&#26816;&#26597;&#36825;&#20010;&#35760;&#24405;&#65288;&#35265;&#22270;6-6&#65289;&#12290;&lt;/p&gt;
&lt;img alt=&quot;Django &#21382;&#21490;&#39029;&#38754;&#25130;&#22270;&#12290;&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter06/history.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#22270;6-6. Django &#23545;&#20687;&#21382;&#21490;&#39029;&#38754; &#65288;&#35265;&#19978;&#65289;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;models-admin&quot;&gt;
&lt;span id=&quot;cn50&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#23558;&#20320;&#30340;Models&#21152;&#20837;&#21040;Admin&#31649;&#29702;&#20013;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&#26377;&#19968;&#20010;&#20851;&#38190;&#27493;&#39588;&#25105;&#20204;&#36824;&#27809;&#20570;&#12290; &#35753;&#25105;&#20204;&#23558;&#33258;&#24049;&#30340;&#27169;&#22359;&#21152;&#20837;&#31649;&#29702;&#24037;&#20855;&#20013;&#65292;&#36825;&#26679;&#25105;&#20204;&#23601;&#33021;&#22815;&#36890;&#36807;&#36825;&#20010;&#28418;&#20142;&#30340;&#30028;&#38754;&#28155;&#21152;&#12289;&#20462;&#25913;&#21644;&#21024;&#38500;&#25968;&#25454;&#24211;&#20013;&#30340;&#23545;&#35937;&#20102;&#12290; &#25105;&#20204;&#23558;&#32487;&#32493;&#31532;&#20116;&#31456;&#20013;&#30340;`` book`` &#20363;&#23376;&#12290;&#22312;&#20854;&#20013;&#65292;&#25105;&#20204;&#23450;&#20041;&#20102;&#19977;&#20010;&#27169;&#22359;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt; &#21644;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#22312;`` books`` &#30446;&#24405;&#19979;(`` mysite/books`` )&#65292;&#21019;&#24314;&#19968;&#20010;&#25991;&#20214;&#65306;`` admin.py`` &#65292;&#28982;&#21518;&#36755;&#20837;&#20197;&#19979;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn54&quot;&gt;from django.contrib import admin
from mysite.books.models import Publisher, Author, Book

admin.site.register(Publisher)
admin.site.register(Author)
admin.site.register(Book)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#36825;&#20123;&#20195;&#30721;&#36890;&#30693;&#31649;&#29702;&#24037;&#20855;&#20026;&#36825;&#20123;&#27169;&#22359;&#36880;&#19968;&#25552;&#20379;&#30028;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#23436;&#25104;&#21518;&#65292;&#25171;&#24320;&#39029;&#38754;
`` &lt;a class=&quot;reference external&quot; href=&quot;http://127.0.0.1:8000/admin&quot;&gt;http://127.0.0.1:8000/admin&lt;/a&gt;/`` &#65292;&#20320;&#20250;&#30475;&#21040;&#19968;&#20010;Books&#21306;&#22495;&#65292;&#20854;&#20013;&#21253;&#21547;Authors&#12289;Books&#21644;Publishers&#12290;&amp;nbsp; &#65288;&#20320;&#21487;&#33021;&#38656;&#35201;&#20808;&#20572;&#27490;&#65292;&#28982;&#21518;&#20877;&#21551;&#21160;&#26381;&#21153;(`` runserver`` )&#65292;&#25165;&#33021;&#20351;&#20854;&#29983;&#25928;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#29616;&#22312;&#20320;&#25317;&#26377;&#19968;&#20010;&#21151;&#33021;&#23436;&#25972;&#30340;&#31649;&#29702;&#30028;&#38754;&#26469;&#31649;&#29702;&#36825;&#19977;&#20010;&#27169;&#22359;&#20102;&#12290;
&#24456;&#31616;&#21333;&#21543;&#65281;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&#33457;&#28857;&#26102;&#38388;&#28155;&#21152;&#21644;&#20462;&#25913;&#35760;&#24405;&#65292;&#20197;&#22635;&#20805;&#25968;&#25454;&#24211;&#12290; &#22914;&#26524;&#20320;&#36319;&#30528;&#31532;&#20116;&#31456;&#30340;&#20363;&#23376;&#19968;&#36215;&#21019;&#24314;Publisher&#23545;&#35937;&#30340;&#35805;&#65288;&#24182;&#19988;&#27809;&#26377;&#21024;&#38500;&#65289;&#65292;&#20320;&#20250;&#22312;&#21015;&#34920;&#20013;&#30475;&#21040;&#37027;&#20123;&#35760;&#24405;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#36825;&#37324;&#38656;&#35201;&#25552;&#21040;&#30340;&#19968;&#20010;&#29305;&#24615;&#26159;&#65292;&#31649;&#29702;&#24037;&#20855;&#22788;&#29702;&#22806;&#38190;&#21644;&#22810;&#23545;&#22810;&#20851;&#31995;&#65288;&#36825;&#20004;&#31181;&#20851;&#31995;&#21487;&#20197;&#22312;`` Book`` &#27169;&#22359;&#20013;&#25214;&#21040;&#65289;&#30340;&#26041;&#27861;&#12290; &#20316;&#20026;&#25552;&#37266;&#65292;&#36825;&#37324;&#26377;&#20010;`` Book`` &#27169;&#22359;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn61&quot;&gt;class Book(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publication_date = models.DateField()

    def __unicode__(self):
        return self.title
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#22312;Add book&#39029;&#38754;&#20013;&#65288;`` &lt;a class=&quot;reference external&quot; href=&quot;http://127.0.0.1:8000/admin/books/book/add&quot;&gt;http://127.0.0.1:8000/admin/books/book/add&lt;/a&gt;/`` &#65289;&#65292;`` &#22806;&#38190;`` publisher&#29992;&#19968;&#20010;&#36873;&#25321;&#26694;&#26174;&#31034;&#65292;`` &#22810;&#23545;&#22810;`` &#23383;&#27573;author&#29992;&#19968;&#20010;&#22810;&#36873;&#26694;&#26174;&#31034;&#12290; &#28857;&#20987;&#20004;&#20010;&#23383;&#27573;&#21518;&#38754;&#30340;&#32511;&#33394;&#21152;&#21495;&#65292;&#21487;&#20197;&#35753;&#20320;&#28155;&#21152;&#30456;&#20851;&#30340;&#35760;&#24405;&#12290;
&#20030;&#20010;&#20363;&#23376;&#65292;&#22914;&#26524;&#20320;&#28857;&#20987;Publisher&#21518;&#38754;&#30340;&#21152;&#21495;&#65292;&#20320;&#23558;&#20250;&#24471;&#21040;&#19968;&#20010;&#24377;&#20986;&#31383;&#21475;&#26469;&#28155;&#21152;&#19968;&#20010;publisher&#12290; &#24403;&#20320;&#22312;&#37027;&#20010;&#31383;&#21475;&#20013;&#25104;&#21151;&#21019;&#24314;&#20102;&#19968;&#20010;publisher&#21518;&#65292;Add book&#34920;&#21333;&#20250;&#33258;&#21160;&#25226;&#23427;&#26356;&#26032;&#21040;&#23383;&#27573;&#19978;&#21435; &#33457;&#24039;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;admin&quot;&gt;
&lt;span id=&quot;cn63&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn63&quot;&gt;Admin&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#22312;&#24149;&#21518;&#65292;&#31649;&#29702;&#24037;&#20855;&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#21602;&#65311; &#20854;&#23454;&#24456;&#31616;&#21333;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#24403;&#26381;&#21153;&#21551;&#21160;&#26102;&#65292;Django&#20174;`` url.py`` &#24341;&#23548;URLconf&#65292;&#28982;&#21518;&#25191;&#34892;`` admin.autodiscover()`` &#35821;&#21477;&#12290; &#36825;&#20010;&#20989;&#25968;&#36941;&#21382;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt;&#37197;&#32622;&#65292;&#24182;&#19988;&#23547;&#25214;&#30456;&#20851;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;admin.py&lt;/span&gt;&lt;/tt&gt;&#25991;&#20214;&#12290; &#22914;&#26524;&#22312;&#25351;&#23450;&#30340;app&#30446;&#24405;&#19979;&#25214;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;admin.py&lt;/span&gt;&lt;/tt&gt;&#65292;&#23427;&#23601;&#25191;&#34892;&#20854;&#20013;&#30340;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn66&quot;&gt;&#22312;`` books`` &#24212;&#29992;&#31243;&#24207;&#30446;&#24405;&#19979;&#30340;`` admin.py`` &#25991;&#20214;&#20013;&#65292;&#27599;&#27425;&#35843;&#29992;`` admin.site.register()`` &#37117;&#23558;&#37027;&#20010;&#27169;&#22359;&#27880;&#20876;&#21040;&#31649;&#29702;&#24037;&#20855;&#20013;&#12290; &#31649;&#29702;&#24037;&#20855;&#21482;&#20026;&#37027;&#20123;&#26126;&#30830;&#27880;&#20876;&#20102;&#30340;&#27169;&#22359;&#26174;&#31034;&#19968;&#20010;&#32534;&#36753;/&#20462;&#25913;&#30340;&#30028;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&#24212;&#29992;&#31243;&#24207;`` django.contrib.auth`` &#21253;&#21547;&#33258;&#36523;&#30340;`` admin.py`` &#65292;&#25152;&#20197;Users&#21644;Groups&#33021;&#22312;&#31649;&#29702;&#24037;&#20855;&#20013;&#33258;&#21160;&#26174;&#31034;&#12290; &#20854;&#23427;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt;&#24212;&#29992;&#31243;&#24207;&#65292;&#22914;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.redirects&lt;/span&gt;&lt;/tt&gt;&#65292;&#20854;&#23427;&#20174;&#32593;&#19978;&#19979;&#22312;&#30340;&#31532;&#19977;&#26041;Django&#24212;&#29992;&#31243;&#24207;&#19968;&#26679;&#65292;&#37117;&#20250;&#33258;&#34892;&#28155;&#21152;&#21040;&#31649;&#29702;&#24037;&#20855;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#32508;&#19978;&#25152;&#36848;&#65292;&#31649;&#29702;&#24037;&#20855;&#20854;&#23454;&#23601;&#26159;&#19968;&#20010;Django&#24212;&#29992;&#31243;&#24207;&#65292;&#21253;&#21547;&#33258;&#24049;&#30340;&#27169;&#22359;&#12289;&#27169;&#26495;&#12289;&#35270;&#22270;&#21644;URLpatterns&#12290; &#20320;&#35201;&#20687;&#28155;&#21152;&#33258;&#24049;&#30340;&#35270;&#22270;&#19968;&#26679;&#65292;&#25226;&#23427;&#28155;&#21152;&#21040;URLconf&#37324;&#38754;&#12290; &#20320;&#21487;&#20197;&#22312;Django&#22522;&#26412;&#20195;&#30721;&#20013;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django/contrib/admin&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#19979;&#65292;&#26816;&#26597;&#23427;&#30340;&#27169;&#26495;&#12289;&#35270;&#22270;&#21644;URLpatterns&#65292;&#20294;&#20320;&#19981;&#35201;&#23581;&#35797;&#30452;&#25509;&#20462;&#25913;&#20854;&#20013;&#30340;&#20219;&#20309;&#20195;&#30721;&#65292;&#22240;&#20026;&#37324;&#38754;&#26377;&#24456;&#22810;&#22320;&#26041;&#21487;&#20197;&#35753;&#20320;&#33258;&#23450;&#20041;&#31649;&#29702;&#24037;&#20855;&#30340;&#24037;&#20316;&#26041;&#24335;&#12290; &#65288;&#22914;&#26524;&#20320;&#30830;&#23454;&#24819;&#27983;&#35272;Django&#31649;&#29702;&#24037;&#20855;&#30340;&#20195;&#30721;&#65292;&#35831;&#35880;&#35760;&#23427;&#22312;&#35835;&#21462;&#20851;&#20110;&#27169;&#22359;&#30340;&#20803;&#25968;&#25454;&#36807;&#31243;&#20013;&#20570;&#20102;&#20123;&#19981;&#31616;&#21333;&#30340;&#24037;&#20316;&#65292;&#22240;&#27492;&#26368;&#22909;&#33457;&#20123;&#26102;&#38388;&#38405;&#35835;&#21644;&#29702;&#35299;&#37027;&#20123;&#20195;&#30721;&#12290;&#65289;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn69&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#35774;&#32622;&#23383;&#27573;&#21487;&#36873;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#22312;&#25670;&#24324;&#20102;&#19968;&#20250;&#20043;&#21518;&#65292;&#20320;&#25110;&#35768;&#20250;&#21457;&#29616;&#31649;&#29702;&#24037;&#20855;&#26377;&#20010;&#38480;&#21046;&#65306;&#32534;&#36753;&#34920;&#21333;&#38656;&#35201;&#20320;&#22635;&#20889;&#27599;&#19968;&#20010;&#23383;&#27573;&#65292;&#28982;&#32780;&#22312;&#26377;&#20123;&#24773;&#20917;&#19979;&#65292;&#20320;&#24819;&#35201;&#26576;&#20123;&#23383;&#27573;&#26159;&#21487;&#36873;&#30340;&#12290; &#20030;&#20010;&#20363;&#23376;&#65292;&#25105;&#20204;&#24819;&#35201;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt;&#27169;&#22359;&#20013;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;email&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#25104;&#20026;&#21487;&#36873;&#65292;&#21363;&#20801;&#35768;&#19981;&#22635;&#12290; &#22312;&#29616;&#23454;&#19990;&#30028;&#20013;&#65292;&#20320;&#21487;&#33021;&#27809;&#26377;&#20026;&#27599;&#20010;&#20316;&#32773;&#30331;&#35760;&#37038;&#31665;&#22320;&#22336;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#20026;&#20102;&#25351;&#23450;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;email&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#20026;&#21487;&#36873;&#65292;&#20320;&#21482;&#35201;&#32534;&#36753;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book&lt;/span&gt;&lt;/tt&gt;&#27169;&#22359;&#65288;&#22238;&#24819;&#31532;&#20116;&#31456;&#65292;&#23427;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite/books/models.py&lt;/span&gt;&lt;/tt&gt;&#25991;&#20214;&#37324;&#65289;&#65292;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;email&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#19978;&#21152;&#19978;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blank=True&lt;/span&gt;&lt;/tt&gt;&#12290;&#20195;&#30721;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn73&quot;&gt;class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField(**blank=True** )
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#36825;&#20123;&#20195;&#30721;&#21578;&#35785;Django&#65292;&#20316;&#32773;&#30340;&#37038;&#31665;&#22320;&#22336;&#20801;&#35768;&#36755;&#20837;&#19968;&#20010;&#31354;&#20540;&#12290; &#25152;&#26377;&#23383;&#27573;&#37117;&#40664;&#35748;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blank=False&lt;/span&gt;&lt;/tt&gt;&#65292;&#36825;&#20351;&#24471;&#23427;&#20204;&#19981;&#20801;&#35768;&#36755;&#20837;&#31354;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#36825;&#37324;&#20250;&#21457;&#29983;&#19968;&#20123;&#26377;&#36259;&#30340;&#20107;&#24773;&#12290; &#30452;&#21040;&#29616;&#22312;&#65292;&#38500;&#20102;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#65292;&#25105;&#20204;&#30340;&#27169;&#22359;&#20805;&#24403;&#25968;&#25454;&#24211;&#20013;&#34920;&#23450;&#20041;&#30340;&#35282;&#33394;&#65292;&#21363;&#26412;&#36136;&#19978;&#26159;&#29992;Python&#30340;&#35821;&#27861;&#26469;&#20889;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt;&#35821;&#21477;&#12290; &#22312;&#28155;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blank=True&lt;/span&gt;&lt;/tt&gt;&#36807;&#31243;&#20013;&#65292;&#25105;&#20204;&#24050;&#32463;&#24320;&#22987;&#22312;&#31616;&#21333;&#30340;&#23450;&#20041;&#25968;&#25454;&#34920;&#19978;&#25193;&#23637;&#25105;&#20204;&#30340;&#27169;&#22359;&#20102;&#12290; &#29616;&#22312;&#65292;&#25105;&#20204;&#30340;&#27169;&#22359;&#31867;&#24320;&#22987;&#25104;&#20026;&#19968;&#20010;&#23500;&#21547;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#23646;&#24615;&#21644;&#34892;&#20026;&#30340;&#38598;&#21512;&#20102;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;email&lt;/span&gt;&lt;/tt&gt;&#19981;&#20294;&#23637;&#29616;&#20026;&#19968;&#20010;&#25968;&#25454;&#24211;&#20013;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;VARCHAR&lt;/span&gt;&lt;/tt&gt;&#31867;&#22411;&#30340;&#23383;&#27573;&#65292;&#23427;&#36824;&#26159;&#39029;&#38754;&#20013;&#21487;&#36873;&#30340;&#23383;&#27573;&#65292;&#23601;&#20687;&#22312;&#31649;&#29702;&#24037;&#20855;&#20013;&#30475;&#21040;&#30340;&#37027;&#26679;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#24403;&#20320;&#28155;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blank=True&lt;/span&gt;&lt;/tt&gt;&#20197;&#21518;&#65292;&#21047;&#26032;&#39029;&#38754;Add author edit form
(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/admin/books/author/add/&lt;/span&gt;&lt;/tt&gt; )&#65292;&#23558;&#20250;&#21457;&#29616;Email&#30340;&#26631;&#31614;&#19981;&#20877;&#26159;&#31895;&#20307;&#20102;&#12290; &#36825;&#24847;&#21619;&#23427;&#19981;&#26159;&#19968;&#20010;&#24517;&#22635;&#23383;&#27573;&#12290; &#29616;&#22312;&#20320;&#21487;&#20197;&#28155;&#21152;&#19968;&#20010;&#20316;&#32773;&#32780;&#19981;&#24517;&#36755;&#20837;&#37038;&#31665;&#22320;&#22336;&#65292;&#21363;&#20351;&#20320;&#20026;&#36825;&#20010;&#23383;&#27573;&#25552;&#20132;&#20102;&#19968;&#20010;&#31354;&#20540;&#65292;&#20063;&#20877;&#19981;&#20250;&#24471;&#21040;&#37027;&#21050;&#30524;&#30340;&#32418;&#33394;&#20449;&#24687;&#8220;This field is required&#8221;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn77&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#35774;&#32622;&#26085;&#26399;&#22411;&#21644;&#25968;&#23383;&#22411;&#23383;&#27573;&#21487;&#36873;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#34429;&#28982;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blank=True&lt;/span&gt;&lt;/tt&gt;&#21516;&#26679;&#36866;&#29992;&#20110;&#26085;&#26399;&#22411;&#21644;&#25968;&#23383;&#22411;&#23383;&#27573;&#65292;&#20294;&#26159;&#36825;&#37324;&#38656;&#35201;&#35814;&#32454;&#35762;&#35299;&#19968;&#20123;&#32972;&#26223;&#30693;&#35782;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn79&quot;&gt;SQL&#26377;&#25351;&#23450;&#31354;&#20540;&#30340;&#29420;&#29305;&#26041;&#24335;&#65292;&#23427;&#25226;&#31354;&#20540;&#21483;&#20570;NULL&#12290;NULL&#21487;&#20197;&#34920;&#31034;&#20026;&#26410;&#30693;&#30340;&#12289;&#38750;&#27861;&#30340;&#12289;&#25110;&#20854;&#23427;&#31243;&#24207;&#25351;&#23450;&#30340;&#21547;&#20041;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#22312;SQL&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;&#30340;&#20540;&#19981;&#21516;&#20110;&#31354;&#23383;&#31526;&#20018;&#65292;&#23601;&#20687;Python&#20013;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt;&#19981;&#21516;&#20110;&#31354;&#23383;&#31526;&#20018;&#65288;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/tt&gt;&#65289;&#19968;&#26679;&#12290;&#36825;&#24847;&#21619;&#30528;&#26576;&#20010;&#23383;&#31526;&#22411;&#23383;&#27573;&#65288;&#22914;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;VARCHAR&lt;/span&gt;&lt;/tt&gt;&#65289;&#30340;&#20540;&#19981;&#21487;&#33021;&#21516;&#26102;&#21253;&#21547;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;&#21644;&#31354;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#36825;&#20250;&#24341;&#36215;&#19981;&#24517;&#35201;&#30340;&#27495;&#20041;&#25110;&#30097;&#24785;&#12290; &#20026;&#20160;&#20040;&#36825;&#26465;&#35760;&#24405;&#26377;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;&#65292;&#32780;&#37027;&#26465;&#35760;&#24405;&#21364;&#26377;&#20010;&#31354;&#23383;&#31526;&#20018;&#65311; &#23427;&#20204;&#20043;&#38388;&#26377;&#21306;&#21035;&#65292;&#36824;&#26159;&#25968;&#25454;&#36755;&#20837;&#19981;&#19968;&#33268;&#65311; &#36824;&#26377;&#65306; &#25105;&#24590;&#26679;&#25165;&#33021;&#24471;&#21040;&#20840;&#37096;&#25317;&#26377;&#31354;&#20540;&#30340;&#35760;&#24405;&#65292;&#24212;&#35813;&#25353;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;&#21644;&#31354;&#23383;&#31526;&#20018;&#26597;&#25214;&#20040;&#65311;&#36824;&#26159;&#20165;&#25353;&#23383;&#31526;&#20018;&#26597;&#25214;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&#20026;&#20102;&#28040;&#38500;&#27495;&#20041;&#65292;Django&#29983;&#25104;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt;&#35821;&#21477;&#33258;&#21160;&#20026;&#27599;&#20010;&#23383;&#27573;&#26174;&#24335;&#21152;&#19978;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;&#12290; &#36825;&#37324;&#26377;&#20010;&#31532;&#20116;&#31456;&#20013;&#29983;&#25104;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt;&#27169;&#22359;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn84&quot;&gt;CREATE TABLE &quot;books_author&quot; (
    &quot;id&quot; serial NOT NULL PRIMARY KEY,
    &quot;first_name&quot; varchar(30) NOT NULL,
    &quot;last_name&quot; varchar(40) NOT NULL,
    &quot;email&quot; varchar(75) NOT NULL
)
;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&#22312;&#22823;&#22810;&#25968;&#24773;&#20917;&#19979;&#65292;&#36825;&#31181;&#40664;&#35748;&#30340;&#34892;&#20026;&#23545;&#20320;&#30340;&#24212;&#29992;&#31243;&#24207;&#26469;&#35828;&#26159;&#26368;&#20339;&#30340;&#65292;&#22240;&#20026;&#23427;&#21487;&#20197;&#20351;&#20320;&#19981;&#20877;&#22240;&#25968;&#25454;&#19968;&#33268;&#24615;&#32780;&#22836;&#30171;&#12290; &#32780;&#19988;&#23427;&#21487;&#20197;&#21644;Django&#30340;&#20854;&#23427;&#37096;&#20998;&#24037;&#20316;&#24471;&#24456;&#22909;&#12290;&#22914;&#22312;&#31649;&#29702;&#24037;&#20855;&#20013;&#65292;&#22914;&#26524;&#20320;&#30041;&#31354;&#19968;&#20010;&#23383;&#31526;&#22411;&#23383;&#27573;&#65292;&#23427;&#20250;&#20026;&#27492;&#25554;&#20837;&#19968;&#20010;&#31354;&#23383;&#31526;&#20018;&#65288;&#32780;* &#19981;&#26159;*&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#20294;&#26159;&#65292;&#20854;&#23427;&#25968;&#25454;&#31867;&#22411;&#26377;&#20363;&#22806;&#65306;&#26085;&#26399;&#22411;&#12289;&#26102;&#38388;&#22411;&#21644;&#25968;&#23383;&#22411;&#23383;&#27573;&#19981;&#25509;&#21463;&#31354;&#23383;&#31526;&#20018;&#12290; &#22914;&#26524;&#20320;&#23581;&#35797;&#23558;&#19968;&#20010;&#31354;&#23383;&#31526;&#20018;&#25554;&#20837;&#26085;&#26399;&#22411;&#25110;&#25972;&#25968;&#22411;&#23383;&#27573;&#65292;&#20320;&#21487;&#33021;&#20250;&#24471;&#21040;&#25968;&#25454;&#24211;&#36820;&#22238;&#30340;&#38169;&#35823;&#65292;&#36825;&#21462;&#20915;&#20110;&#37027;&#20010;&#25968;&#25454;&#24211;&#30340;&#31867;&#22411;&#12290; &#65288;PostgreSQL&#27604;&#36739;&#20005;&#31105;&#65292;&#20250;&#25243;&#20986;&#19968;&#20010;&#24322;&#24120;&#65307;MySQL&#21487;&#33021;&#20250;&#20063;&#21487;&#33021;&#19981;&#20250;&#25509;&#21463;&#65292;&#36825;&#21462;&#20915;&#20110;&#20320;&#20351;&#29992;&#30340;&#29256;&#26412;&#21644;&#36816;&#27668;&#20102;&#12290;&#65289;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;&#26159;&#21807;&#19968;&#25351;&#23450;&#31354;&#20540;&#30340;&#26041;&#27861;&#12290; &#22312;Django&#27169;&#22359;&#20013;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;&#28155;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;null=True&lt;/span&gt;&lt;/tt&gt;&#26469;&#25351;&#23450;&#19968;&#20010;&#23383;&#27573;&#20801;&#35768;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#22240;&#27492;&#65292;&#36825;&#35828;&#36215;&#26469;&#26377;&#28857;&#22797;&#26434;&#65306; &#22914;&#26524;&#20320;&#24819;&#20801;&#35768;&#19968;&#20010;&#26085;&#26399;&#22411;&#65288;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DateField&lt;/span&gt;&lt;/tt&gt;&#12289;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TimeField&lt;/span&gt;&lt;/tt&gt;&#12289;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DateTimeField&lt;/span&gt;&lt;/tt&gt;&#65289;&#25110;&#25968;&#23383;&#22411;&#65288;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;IntegerField&lt;/span&gt;&lt;/tt&gt;&#12289;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DecimalField&lt;/span&gt;&lt;/tt&gt;&#12289;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FloatField&lt;/span&gt;&lt;/tt&gt;&#65289;&#23383;&#27573;&#20026;&#31354;&#65292;&#20320;&#38656;&#35201;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;null=True&lt;/span&gt;&lt;/tt&gt; * &#21644;* &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blank=True&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#20026;&#20102;&#20030;&#20363;&#35828;&#26126;&#65292;&#35753;&#25105;&#20204;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book&lt;/span&gt;&lt;/tt&gt;&#27169;&#22359;&#20462;&#25913;&#25104;&#20801;&#35768;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;publication_date&lt;/span&gt;&lt;/tt&gt;&#20026;&#31354;&#12290;&#20462;&#25913;&#21518;&#30340;&#20195;&#30721;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn90&quot;&gt;class Book(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publication_date = models.DateField(**blank=True, null=True** )
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#28155;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;null=True&lt;/span&gt;&lt;/tt&gt;&#27604;&#28155;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blank=True&lt;/span&gt;&lt;/tt&gt;&#22797;&#26434;&#12290;&#22240;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;null=True&lt;/span&gt;&lt;/tt&gt;&#25913;&#21464;&#20102;&#25968;&#25454;&#30340;&#35821;&#20041;&#65292;&#21363;&#25913;&#21464;&#20102;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt;&#35821;&#21477;&#65292;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;publication_date&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#19978;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;&#21024;&#38500;&#20102;&#12290; &#35201;&#23436;&#25104;&#36825;&#20123;&#25913;&#21160;&#65292;&#25105;&#20204;&#36824;&#38656;&#35201;&#26356;&#26032;&#25968;&#25454;&#24211;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#20986;&#20110;&#26576;&#31181;&#21407;&#22240;&#65292;Django&#19981;&#20250;&#23581;&#35797;&#33258;&#21160;&#26356;&#26032;&#25968;&#25454;&#24211;&#32467;&#26500;&#12290;&#25152;&#20197;&#20320;&#24517;&#39035;&#25191;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ALTER&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt;&#35821;&#21477;&#23558;&#27169;&#22359;&#30340;&#25913;&#21160;&#26356;&#26032;&#33267;&#25968;&#25454;&#24211;&#12290; &#20687;&#20808;&#21069;&#37027;&#26679;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;dbshell&lt;/span&gt;&lt;/tt&gt;&#36827;&#20837;&#25968;&#25454;&#24211;&#26381;&#21153;&#29615;&#22659;&#12290;
&#20197;&#19979;&#26159;&#22312;&#36825;&#20010;&#29305;&#27530;&#24773;&#20917;&#19979;&#22914;&#20309;&#21024;&#38500;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;NULL&lt;/span&gt;&lt;/tt&gt;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn94&quot;&gt;ALTER TABLE books_book ALTER COLUMN publication_date DROP NOT NULL;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#65288;&#27880;&#24847;&#65306;&#20197;&#19979;SQL&#35821;&#27861;&#26159;PostgreSQL&#29305;&#26377;&#30340;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#25105;&#20204;&#23558;&#22312;&#31532;&#21313;&#31456;&#35814;&#32454;&#35762;&#36848;&#25968;&#25454;&#24211;&#32467;&#26500;&#26356;&#25913;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#29616;&#22312;&#35753;&#25105;&#20204;&#22238;&#21040;&#31649;&#29702;&#24037;&#20855;&#65292;&#28155;&#21152;book&#30340;&#32534;&#36753;&#39029;&#38754;&#20801;&#35768;&#36755;&#20837;&#19968;&#20010;&#31354;&#30340;publication date&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn98&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#33258;&#23450;&#20041;&#23383;&#27573;&#26631;&#31614;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#22312;&#32534;&#36753;&#39029;&#38754;&#20013;&#65292;&#27599;&#20010;&#23383;&#27573;&#30340;&#26631;&#31614;&#37117;&#26159;&#20174;&#27169;&#22359;&#30340;&#23383;&#27573;&#21517;&#31216;&#29983;&#25104;&#30340;&#12290; &#35268;&#21017;&#24456;&#31616;&#21333;&#65306; &#29992;&#31354;&#26684;&#26367;&#25442;&#19979;&#21010;&#32447;&#65307;&#39318;&#23383;&#27597;&#22823;&#20889;&#12290;&#20363;&#22914;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book&lt;/span&gt;&lt;/tt&gt;&#27169;&#22359;&#20013;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;publication_date&lt;/span&gt;&lt;/tt&gt;&#30340;&#26631;&#31614;&#26159;Publication date&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#28982;&#32780;&#65292;&#23383;&#27573;&#21517;&#31216;&#24182;&#19981;&#24635;&#26159;&#36148;&#20999;&#30340;&#12290;&#26377;&#20123;&#24773;&#20917;&#19979;&#65292;&#20320;&#21487;&#33021;&#24819;&#33258;&#23450;&#20041;&#19968;&#20010;&#26631;&#31614;&#12290; &#20320;&#21482;&#38656;&#22312;&#27169;&#22359;&#20013;&#25351;&#23450;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_name&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&#20030;&#20010;&#20363;&#23376;&#65292;&#35828;&#26126;&#22914;&#20309;&#23558;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author.email&lt;/span&gt;&lt;/tt&gt;&#30340;&#26631;&#31614;&#25913;&#20026;e-mail&#65292;&#20013;&#38388;&#26377;&#20010;&#27178;&#32447;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn103&quot;&gt;class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField(blank=True, **verbose_name=&apos;e-mail&apos;** )
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&#20462;&#25913;&#21518;&#37325;&#21551;&#26381;&#21153;&#22120;&#65292;&#20320;&#20250;&#22312;author&#32534;&#36753;&#39029;&#38754;&#20013;&#30475;&#21040;&#36825;&#20010;&#26032;&#26631;&#31614;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&#35831;&#27880;&#24847;&#65292;&#20320;&#19981;&#24517;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_name&lt;/span&gt;&lt;/tt&gt;&#30340;&#39318;&#23383;&#27597;&#22823;&#20889;&#65292;&#38500;&#38750;&#26159;&#36830;&#32493;&#22823;&#20889;&#65288;&#22914;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;USA&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;state&quot;&lt;/span&gt;&lt;/tt&gt;&#65289;&#12290;Django&#20250;&#33258;&#21160;&#36866;&#26102;&#23558;&#39318;&#23383;&#27597;&#22823;&#20889;&#65292;&#24182;&#19988;&#22312;&#20854;&#23427;&#19981;&#38656;&#35201;&#22823;&#20889;&#30340;&#22320;&#26041;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_name&lt;/span&gt;&lt;/tt&gt;&#30340;&#31934;&#30830;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#26368;&#21518;&#36824;&#38656;&#27880;&#24847;&#30340;&#26159;&#65292;&#20026;&#20102;&#20351;&#35821;&#27861;&#31616;&#27905;&#65292;&#20320;&#21487;&#20197;&#25226;&#23427;&#24403;&#20316;&#22266;&#23450;&#20301;&#32622;&#30340;&#21442;&#25968;&#20256;&#36882;&#12290; &#36825;&#20010;&#20363;&#23376;&#19982;&#19978;&#38754;&#37027;&#20010;&#30340;&#25928;&#26524;&#30456;&#21516;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn108&quot;&gt;class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField(**&apos;e-mail&apos;,**  blank=True)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&#20294;&#36825;&#19981;&#36866;&#29992;&#20110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ManyToManyField&lt;/span&gt;&lt;/tt&gt; &#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ForeignKey&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#65292;&#22240;&#20026;&#23427;&#20204;&#31532;&#19968;&#20010;&#21442;&#25968;&#24517;&#39035;&#26159;&#27169;&#22359;&#31867;&#12290; &#37027;&#31181;&#24773;&#24418;&#65292;&#24517;&#39035;&#26174;&#24335;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_name&lt;/span&gt;&lt;/tt&gt;&#36825;&#20010;&#21442;&#25968;&#21517;&#31216;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;modeladmi&quot;&gt;
&lt;span id=&quot;cn110&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&#33258;&#23450;&#20041;ModelAdmi&#31867;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&#36804;&#20170;&#20026;&#27490;&#65292;&#25105;&#20204;&#20570;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blank=True&lt;/span&gt;&lt;/tt&gt;&#12289;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;null=True&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_name&lt;/span&gt;&lt;/tt&gt;&#20462;&#25913;&#20854;&#23454;&#26159;&#27169;&#22359;&#32423;&#21035;&#65292;&#32780;&#19981;&#26159;&#31649;&#29702;&#32423;&#21035;&#30340;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;&#36825;&#20123;&#20462;&#25913;&#23454;&#36136;&#19978;&#26159;&#26500;&#25104;&#27169;&#22359;&#30340;&#19968;&#37096;&#20998;&#65292;&#24182;&#19988;&#27491;&#22909;&#34987;&#31649;&#29702;&#24037;&#20855;&#20351;&#29992;&#65292;&#32780;&#19981;&#26159;&#19987;&#38376;&#38024;&#23545;&#31649;&#29702;&#24037;&#20855;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&#38500;&#20102;&#36825;&#20123;&#65292;Django&#36824;&#25552;&#20379;&#20102;&#22823;&#37327;&#36873;&#39033;&#35753;&#20320;&#38024;&#23545;&#29305;&#21035;&#30340;&#27169;&#22359;&#33258;&#23450;&#20041;&#31649;&#29702;&#24037;&#20855;&#12290; &#36825;&#20123;&#36873;&#39033;&#37117;&#22312;&lt;em&gt;ModelAdmin classes&lt;/em&gt;&#37324;&#38754;&#65292;&#36825;&#20123;&#31867;&#21253;&#21547;&#20102;&#31649;&#29702;&#24037;&#20855;&#20013;&#38024;&#23545;&#29305;&#21035;&#27169;&#22359;&#30340;&#37197;&#32622;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn113&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#33258;&#23450;&#20041;&#21015;&#34920;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#35753;&#25105;&#20204;&#26356;&#28145;&#19968;&#27493;&#65306;&#33258;&#23450;&#20041;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt;&#27169;&#22359;&#30340;&#21015;&#34920;&#20013;&#30340;&#26174;&#31034;&#23383;&#27573;&#12290; &#21015;&#34920;&#40664;&#35748;&#22320;&#26174;&#31034;&#26597;&#35810;&#32467;&#26524;&#20013;&#23545;&#35937;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt;&#12290; &#22312;&#31532;&#20116;&#31456;&#20013;&#65292;&#25105;&#20204;&#23450;&#20041;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#65292;&#29992;&#20197;&#21516;&#26102;&#26174;&#31034;&#20316;&#32773;&#30340;&#22995;&#21644;&#21517;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn116&quot;&gt;class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField(blank=True, verbose_name=&apos;e-mail&apos;)

    **def __unicode__(self):**
        **return u&apos;%s %s&apos; % (self.first_name, self.last_name)**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&#32467;&#26524;&#27491;&#22914;&#22270;6-7&#25152;&#31034;&#65292;&#21015;&#34920;&#20013;&#26174;&#31034;&#30340;&#26159;&#27599;&#20010;&#20316;&#32773;&#30340;&#22995;&#21517;&#12290;&lt;/p&gt;
&lt;img alt=&quot;Screenshot of the author change list page.&quot; src=&quot;http://new-media.djangobook.com/content/en/2.0/chapter06/author_changelist1.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#22270; 6-7. &#20316;&#32773;&#21015;&#34920;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn120&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#22312;&#36825;&#22522;&#30784;&#19978;&#25913;&#36827;&#65292;&#28155;&#21152;&#20854;&#23427;&#23383;&#27573;&#65292;&#20174;&#32780;&#25913;&#21464;&#21015;&#34920;&#30340;&#26174;&#31034;&#12290; &#36825;&#20010;&#39029;&#38754;&#24212;&#35813;&#25552;&#20379;&#20415;&#21033;&#65292;&#27604;&#22914;&#35828;&#65306;&#22312;&#36825;&#20010;&#21015;&#34920;&#20013;&#21487;&#20197;&#30475;&#21040;&#20316;&#32773;&#30340;&#37038;&#31665;&#22320;&#22336;&#12290;&#22914;&#26524;&#33021;&#25353;&#29031;&#22995;&#27663;&#25110;&#21517;&#23383;&#26469;&#25490;&#24207;&#65292;&#37027;&#23601;&#26356;&#22909;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn121&quot;&gt;&#20026;&#20102;&#36798;&#21040;&#36825;&#20010;&#30446;&#30340;&#65292;&#25105;&#20204;&#23558;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt;&#27169;&#22359;&#23450;&#20041;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ModelAdmin&lt;/span&gt;&lt;/tt&gt;&#31867;&#12290; &#36825;&#20010;&#31867;&#26159;&#33258;&#23450;&#20041;&#31649;&#29702;&#24037;&#20855;&#30340;&#20851;&#38190;&#65292;&#20854;&#20013;&#26368;&#22522;&#26412;&#30340;&#19968;&#20214;&#20107;&#24773;&#26159;&#20801;&#35768;&#20320;&#25351;&#23450;&#21015;&#34920;&#20013;&#30340;&#23383;&#27573;&#12290; &#25171;&#24320;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;admin.py&lt;/span&gt;&lt;/tt&gt;&#24182;&#20462;&#25913;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn123&quot;&gt;from django.contrib import admin
from mysite.books.models import Publisher, Author, Book

**class AuthorAdmin(admin.ModelAdmin):**
    **list_display = (&apos;first_name&apos;, &apos;last_name&apos;, &apos;email&apos;)**

admin.site.register(Publisher)
**admin.site.register(Author, AuthorAdmin)**
admin.site.register(Book)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#35299;&#37322;&#19968;&#19979;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#25105;&#20204;&#26032;&#24314;&#20102;&#19968;&#20010;&#31867;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;AuthorAdmin&lt;/span&gt;&lt;/tt&gt;&#65292;&#23427;&#26159;&#20174;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.admin.ModelAdmin&lt;/span&gt;&lt;/tt&gt;&#27966;&#29983;&#20986;&#26469;&#30340;&#23376;&#31867;&#65292;&#20445;&#23384;&#30528;&#19968;&#20010;&#31867;&#30340;&#33258;&#23450;&#20041;&#37197;&#32622;&#65292;&#20197;&#20379;&#31649;&#29702;&#24037;&#20855;&#20351;&#29992;&#12290; &#25105;&#20204;&#21482;&#33258;&#23450;&#20041;&#20102;&#19968;&#39033;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;list_display&lt;/span&gt;&lt;/tt&gt;&#65292; &#23427;&#26159;&#19968;&#20010;&#23383;&#27573;&#21517;&#31216;&#30340;&#20803;&#32452;&#65292;&#29992;&#20110;&#21015;&#34920;&#26174;&#31034;&#12290; &#24403;&#28982;&#65292;&#36825;&#20123;&#23383;&#27573;&#21517;&#31216;&#24517;&#39035;&#26159;&#27169;&#22359;&#20013;&#26377;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn126&quot;&gt;&#25105;&#20204;&#20462;&#25913;&#20102;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;admin.site.register()&lt;/span&gt;&lt;/tt&gt;&#35843;&#29992;&#65292;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt;&#21518;&#38754;&#28155;&#21152;&#20102;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;AuthorAdmin&lt;/span&gt;&lt;/tt&gt;&#12290;&#20320;&#21487;&#20197;&#36825;&#26679;&#29702;&#35299;&#65306; &#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;AuthorAdmin&lt;/span&gt;&lt;/tt&gt;&#36873;&#39033;&#27880;&#20876;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt;&#27169;&#22359;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;admin.site.register()&lt;/span&gt;&lt;/tt&gt;&#20989;&#25968;&#25509;&#21463;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ModelAdmin&lt;/span&gt;&lt;/tt&gt;&#23376;&#31867;&#20316;&#20026;&#31532;&#20108;&#20010;&#21442;&#25968;&#12290; &#22914;&#26524;&#20320;&#24573;&#30053;&#31532;&#20108;&#20010;&#21442;&#25968;&#65292;Django&#23558;&#20351;&#29992;&#40664;&#35748;&#30340;&#36873;&#39033;&#12290;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book&lt;/span&gt;&lt;/tt&gt;&#30340;&#27880;&#20876;&#23601;&#23646;&#20110;&#36825;&#31181;&#24773;&#20917;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#24324;&#22909;&#20102;&#36825;&#20010;&#19996;&#19996;&#65292;&#20877;&#21047;&#26032;author&#21015;&#34920;&#39029;&#38754;&#65292;&#20320;&#20250;&#30475;&#21040;&#21015;&#34920;&#20013;&#26377;&#19977;&#21015;&#65306;&#22995;&#27663;&#12289;&#21517;&#23383;&#21644;&#37038;&#31665;&#22320;&#22336;&#12290; &#21478;&#22806;&#65292;&#28857;&#20987;&#27599;&#20010;&#21015;&#30340;&#21015;&#22836;&#21487;&#20197;&#23545;&#37027;&#21015;&#36827;&#34892;&#25490;&#24207;&#12290;
&#65288;&#21442;&#35265;&#22270; 6-8&#65289;&lt;/p&gt;
&lt;img alt=&quot;Screenshot of the author change list page after list_display.&quot; src=&quot;http://new-media.djangobook.com/content/en/2.0/chapter06/author_changelist2.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#22270; 6-8. &#20462;&#25913;&#21518;&#30340;author&#21015;&#34920;&#39029;&#38754;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#35753;&#25105;&#20204;&#28155;&#21152;&#19968;&#20010;&#24555;&#36895;&#26597;&#35810;&#26639;&#12290; &#21521;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;AuthorAdmin&lt;/span&gt;&lt;/tt&gt;&#36861;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;search_fields&lt;/span&gt;&lt;/tt&gt;&#65292;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn133&quot;&gt;class AuthorAdmin(admin.ModelAdmin):
    list_display = (&apos;first_name&apos;, &apos;last_name&apos;, &apos;email&apos;)
    **search_fields = (&apos;first_name&apos;, &apos;last_name&apos;)**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn134&quot;&gt;&#21047;&#26032;&#27983;&#35272;&#22120;&#65292;&#20320;&#20250;&#22312;&#39029;&#38754;&#39030;&#31471;&#30475;&#21040;&#19968;&#20010;&#26597;&#35810;&#26639;&#12290;
&#65288;&#35265;&#22270;6-9.&#65289;&#25105;&#20204;&#21018;&#25165;&#25152;&#20316;&#30340;&#20462;&#25913;&#21015;&#34920;&#39029;&#38754;&#65292;&#28155;&#21152;&#20102;&#19968;&#20010;&#26681;&#25454;&#22995;&#21517;&#26597;&#35810;&#30340;&#26597;&#35810;&#26694;&#12290;
&#27491;&#22914;&#29992;&#25143;&#25152;&#24076;&#26395;&#30340;&#37027;&#26679;&#65292;&#23427;&#26159;&#22823;&#23567;&#20889;&#25935;&#24863;&#65292;&#24182;&#19988;&#23545;&#20004;&#20010;&#23383;&#27573;&#26816;&#32034;&#30340;&#26597;&#35810;&#26694;&#12290;&#22914;&#26524;&#26597;&#35810;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;bar&quot;&lt;/span&gt;&lt;/tt&gt;&#65292;&#37027;&#20040;&#21517;&#23383;&#20013;&#21547;&#26377;Barney&#21644;&#22995;&#27663;&#20013;&#21547;&#26377;Hobarson&#30340;&#20316;&#32773;&#35760;&#24405;&#23558;&#34987;&#26816;&#32034;&#20986;&#26469;&#12290;&lt;/p&gt;
&lt;img alt=&quot;Screenshot of the author change list page after search_fields.&quot; src=&quot;http://new-media.djangobook.com/content/en/2.0/chapter06/author_changelist3.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn136&quot;&gt;&#22270; 6-9. &#21547;search_fields&#30340;author&#21015;&#34920;&#39029;&#38754;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn137&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#35753;&#25105;&#20204;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book&lt;/span&gt;&lt;/tt&gt;&#21015;&#34920;&#39029;&#28155;&#21152;&#19968;&#20123;&#36807;&#28388;&#22120;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn139&quot;&gt;from django.contrib import admin
from mysite.books.models import Publisher, Author, Book

class AuthorAdmin(admin.ModelAdmin):
    list_display = (&apos;first_name&apos;, &apos;last_name&apos;, &apos;email&apos;)
    search_fields = (&apos;first_name&apos;, &apos;last_name&apos;)

**class BookAdmin(admin.ModelAdmin):**
    **list_display = (&apos;title&apos;, &apos;publisher&apos;, &apos;publication_date&apos;)**
    **list_filter = (&apos;publication_date&apos;,)**

admin.site.register(Publisher)
admin.site.register(Author, AuthorAdmin)
**admin.site.register(Book, BookAdmin)**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn140&quot;&gt;&#30001;&#20110;&#25105;&#20204;&#35201;&#22788;&#29702;&#19968;&#31995;&#21015;&#36873;&#39033;&#65292;&#22240;&#27492;&#25105;&#20204;&#21019;&#24314;&#20102;&#19968;&#20010;&#21333;&#29420;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ModelAdmin&lt;/span&gt;&lt;/tt&gt;&#31867;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BookAdmin&lt;/span&gt;&lt;/tt&gt;&#12290;&#39318;&#20808;&#65292;&#25105;&#20204;&#23450;&#20041;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;list_display&lt;/span&gt;&lt;/tt&gt;&#65292;&#20197;&#20351;&#24471;&#39029;&#38754;&#22909;&#30475;&#20123;&#12290; &#28982;&#21518;&#65292;&#25105;&#20204;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;list_filter&lt;/span&gt;&lt;/tt&gt;&#36825;&#20010;&#23383;&#27573;&#20803;&#32452;&#21019;&#24314;&#36807;&#28388;&#22120;&#65292;&#23427;&#20301;&#20110;&#21015;&#34920;&#39029;&#38754;&#30340;&#21491;&#36793;&#12290; Django&#20026;&#26085;&#26399;&#22411;&#23383;&#27573;&#25552;&#20379;&#20102;&#24555;&#25463;&#36807;&#28388;&#26041;&#24335;&#65292;&#23427;&#21253;&#21547;&#65306;&#20170;&#22825;&#12289;&#36807;&#24448;&#19971;&#22825;&#12289;&#24403;&#26376;&#21644;&#20170;&#24180;&#12290;&#36825;&#20123;&#26159;&#24320;&#21457;&#20154;&#21592;&#32463;&#24120;&#29992;&#21040;&#30340;&#12290; &#22270; 6-10&#26174;&#31034;&#20102;&#20462;&#25913;&#21518;&#30340;&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;img alt=&quot;Screenshot of the book change list page after list_filter.&quot; src=&quot;http://new-media.djangobook.com/content/en/2.0/chapter06/book_changelist1.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#22270; 6-10. &#21547;&#36807;&#28388;&#22120;&#30340;book&#21015;&#34920;&#39029;&#38754;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn143&quot;&gt;`` &#36807;&#28388;&#22120;`` &#21516;&#26679;&#36866;&#29992;&#20110;&#20854;&#23427;&#31867;&#22411;&#30340;&#23383;&#27573;&#65292;&#32780;&#19981;&#21333;&#26159;`` &#26085;&#26399;&#22411;`` &#65288;&#35831;&#22312;`` &#24067;&#23572;&#22411;`` &#21644;`` &#22806;&#38190;`` &#23383;&#27573;&#19978;&#35797;&#35797;&#65289;&#12290;&#24403;&#26377;&#20004;&#20010;&#20197;&#19978;&#20540;&#26102;&#65292;&#36807;&#28388;&#22120;&#23601;&#20250;&#26174;&#31034;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn144&quot;&gt;&#21478;&#22806;&#19968;&#31181;&#36807;&#28388;&#26085;&#26399;&#30340;&#26041;&#24335;&#26159;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;date_hierarchy&lt;/span&gt;&lt;/tt&gt;&#36873;&#39033;&#65292;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn146&quot;&gt;class BookAdmin(admin.ModelAdmin):
    list_display = (&apos;title&apos;, &apos;publisher&apos;, &apos;publication_date&apos;)
    list_filter = (&apos;publication_date&apos;,)
    **date_hierarchy = &apos;publication_date&apos;**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn147&quot;&gt;&#20462;&#25913;&#22909;&#21518;&#65292;&#39029;&#38754;&#20013;&#30340;&#21015;&#34920;&#39030;&#31471;&#20250;&#26377;&#19968;&#20010;&#36880;&#23618;&#28145;&#20837;&#30340;&#23548;&#33322;&#26465;&#65292;&#25928;&#26524;&#22914;&#22270; 6-11. &#23427;&#20174;&#21487;&#29992;&#30340;&#24180;&#20221;&#24320;&#22987;&#65292;&#28982;&#21518;&#36880;&#23618;&#32454;&#20998;&#21040;&#26376;&#20035;&#33267;&#26085;&#12290;&lt;/p&gt;
&lt;img alt=&quot;Screenshot of the book change list page after date_hierarchy.&quot; src=&quot;http://new-media.djangobook.com/content/en/2.0/chapter06/book_changelist2.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&#22270; 6-11. &#21547;date_hierarchy&#30340;book&#21015;&#34920;&#39029;&#38754;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn150&quot;&gt;&#35831;&#27880;&#24847;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;date_hierarchy&lt;/span&gt;&lt;/tt&gt;&#25509;&#21463;&#30340;&#26159;* &#23383;&#31526;&#20018;* &#65292;&#32780;&#19981;&#26159;&#20803;&#32452;&#12290;&#22240;&#20026;&#21482;&#33021;&#23545;&#19968;&#20010;&#26085;&#26399;&#22411;&#23383;&#27573;&#36827;&#34892;&#23618;&#27425;&#21010;&#20998;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn151&quot;&gt;&#26368;&#21518;&#65292;&#35753;&#25105;&#20204;&#25913;&#21464;&#40664;&#35748;&#30340;&#25490;&#24207;&#26041;&#24335;&#65292;&#25353;publication date&#38477;&#24207;&#25490;&#21015;&#12290; &#21015;&#34920;&#39029;&#38754;&#40664;&#35748;&#25353;&#29031;&#27169;&#22359;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Meta&lt;/span&gt;&lt;/tt&gt;&#65288;&#35814;&#35265;&#31532;&#20116;&#31456;&#65289;&#20013;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ordering&lt;/span&gt;&lt;/tt&gt;&#25152;&#25351;&#30340;&#21015;&#25490;&#24207;&#12290;&#20294;&#30446;&#21069;&#27809;&#26377;&#25351;&#23450;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ordering&lt;/span&gt;&lt;/tt&gt;&#20540;&#65292;&#25152;&#20197;&#24403;&#21069;&#25490;&#24207;&#26159;&#27809;&#26377;&#23450;&#20041;&#30340;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn153&quot;&gt;class BookAdmin(admin.ModelAdmin):
    list_display = (&apos;title&apos;, &apos;publisher&apos;, &apos;publication_date&apos;)
    list_filter = (&apos;publication_date&apos;,)
    date_hierarchy = &apos;publication_date&apos;
    **ordering = (&apos;-publication_date&apos;,)**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&#36825;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ordering&lt;/span&gt;&lt;/tt&gt;&#36873;&#39033;&#22522;&#26412;&#20687;&#27169;&#22359;&#20013;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Meta&lt;/span&gt;&lt;/tt&gt;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ordering&lt;/span&gt;&lt;/tt&gt;&#37027;&#26679;&#24037;&#20316;&#65292;&#38500;&#20102;&#23427;&#21482;&#29992;&#21015;&#34920;&#20013;&#30340;&#31532;&#19968;&#20010;&#23383;&#27573;&#21517;&#12290;
&#22914;&#26524;&#35201;&#23454;&#29616;&#38477;&#24207;&#65292;&#20165;&#38656;&#22312;&#20256;&#20837;&#30340;&#21015;&#34920;&#25110;&#20803;&#32452;&#30340;&#23383;&#27573;&#21069;&#21152;&#19978;&#19968;&#20010;&#20943;&#21495;(-)&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&#21047;&#26032;book&#21015;&#34920;&#39029;&#38754;&#35266;&#30475;&#23454;&#38469;&#25928;&#26524;&#12290; &#27880;&#24847;Publication
date&#21015;&#22836;&#29616;&#22312;&#26377;&#19968;&#20010;&#23567;&#31661;&#22836;&#26174;&#31034;&#25490;&#24207;&#12290; &#65288;&#35265;&#22270; 6-12.&#65289;&lt;/p&gt;
&lt;img alt=&quot;Screenshot of the book change list page after ordering.&quot; src=&quot;http://new-media.djangobook.com/content/en/2.0/chapter06/book_changelist3.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn157&quot;&gt;&#22270; 6-12 &#21547;&#25490;&#24207;&#30340;book&#21015;&#34920;&#39029;&#38754;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn158&quot;&gt;&#25105;&#20204;&#24050;&#32463;&#23398;&#20064;&#20102;&#20027;&#35201;&#30340;&#36873;&#39033;&#12290; &#36890;&#36807;&#20351;&#29992;&#23427;&#20204;&#65292;&#20320;&#21487;&#20197;&#20165;&#38656;&#20960;&#34892;&#20195;&#30721;&#23601;&#33021;&#21019;&#24314;&#19968;&#20010;&#21151;&#33021;&#24378;&#22823;&#12289;&#38543;&#26102;&#19978;&#32447;&#30340;&#25968;&#25454;&#32534;&#36753;&#30028;&#38754;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn159&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&#33258;&#23450;&#20041;&#32534;&#36753;&#34920;&#21333;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn160&quot;&gt;&#27491;&#22914;&#33258;&#23450;&#20041;&#21015;&#34920;&#37027;&#26679;&#65292;&#32534;&#36753;&#34920;&#21333;&#22810;&#26041;&#38754;&#20063;&#33021;&#33258;&#23450;&#20041;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn161&quot;&gt;&#39318;&#20808;&#65292;&#25105;&#20204;&#20808;&#33258;&#23450;&#20041;&#23383;&#27573;&#39034;&#24207;&#12290; &#40664;&#35748;&#22320;&#65292;&#34920;&#21333;&#20013;&#30340;&#23383;&#27573;&#39034;&#24207;&#26159;&#19982;&#27169;&#22359;&#20013;&#23450;&#20041;&#26159;&#19968;&#33268;&#30340;&#12290;
&#25105;&#20204;&#21487;&#20197;&#36890;&#36807;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ModelAdmin&lt;/span&gt;&lt;/tt&gt;&#23376;&#31867;&#20013;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;fields&lt;/span&gt;&lt;/tt&gt;&#36873;&#39033;&#26469;&#25913;&#21464;&#23427;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn163&quot;&gt;class BookAdmin(admin.ModelAdmin):
    list_display = (&apos;title&apos;, &apos;publisher&apos;, &apos;publication_date&apos;)
    list_filter = (&apos;publication_date&apos;,)
    date_hierarchy = &apos;publication_date&apos;
    ordering = (&apos;-publication_date&apos;,)
    **fields = (&apos;title&apos;, &apos;authors&apos;, &apos;publisher&apos;, &apos;publication_date&apos;)**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn164&quot;&gt;&#23436;&#25104;&#20043;&#21518;&#65292;&#32534;&#36753;&#34920;&#21333;&#23558;&#25353;&#29031;&#25351;&#23450;&#30340;&#39034;&#24207;&#26174;&#31034;&#21508;&#23383;&#27573;&#12290; &#23427;&#30475;&#36215;&#26469;&#33258;&#28982;&#22810;&#20102;&#8212;&#8212;&#20316;&#32773;&#25490;&#22312;&#20070;&#21517;&#20043;&#21518;&#12290; &#23383;&#27573;&#39034;&#24207;&#24403;&#28982;&#26159;&#19982;&#25968;&#25454;&#26465;&#30446;&#24405;&#20837;&#39034;&#24207;&#26377;&#20851;&#65292; &#27599;&#20010;&#34920;&#21333;&#37117;&#19981;&#19968;&#26679;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&#36890;&#36807;fields&#36825;&#20010;&#36873;&#39033;&#65292;&#20320;&#21487;&#20197;&#25490;&#38500;&#19968;&#20123;&#19981;&#24819;&#34987;&#20854;&#20182;&#20154;&#32534;&#36753;&#30340;fields &#21482;&#35201;&#19981;&#36873;&#19978;&#19981;&#24819;&#34987;&#32534;&#36753;&#30340;field(s)&#21363;&#21487;&#12290; &#24403;&#20320;&#30340;admi&#29992;&#25143;&#21482;&#26159;&#34987;&#20449;&#20219;&#21487;&#20197;&#26356;&#25913;&#20320;&#30340;&#26576;&#19968;&#37096;&#20998;&#25968;&#25454;&#26102;&#65292;&#25110;&#32773;&#65292;&#20320;&#30340;&#25968;&#25454;&#34987;&#19968;&#20123;&#22806;&#37096;&#30340;&#31243;&#24207;&#33258;&#21160;&#22788;&#29702;&#32780;&#25913;&#21464;&#20102;&#20102;&#65292;&#20320;&#23601;&#21487;&#20197;&#29992;&#36825;&#20010;&#21151;&#33021;&#12290; &#20363;&#22914;&#65292;&#22312;book&#25968;&#25454;&#24211;&#20013;&#65292;&#25105;&#20204;&#21487;&#20197;&#38544;&#34255;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;publication_date&lt;/span&gt;&lt;/tt&gt;&#65292;&#20197;&#38450;&#27490;&#23427;&#34987;&#32534;&#36753;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn167&quot;&gt;class BookAdmin(admin.ModelAdmin):
    list_display = (&apos;title&apos;, &apos;publisher&apos;, &apos;publication_date&apos;)
    list_filter = (&apos;publication_date&apos;,)
    date_hierarchy = &apos;publication_date&apos;
    ordering = (&apos;-publication_date&apos;,)
    **fields = (&apos;title&apos;, &apos;authors&apos;, &apos;publisher&apos;)**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&#36825;&#26679;&#65292;&#22312;&#32534;&#36753;&#39029;&#38754;&#23601;&#26080;&#27861;&#23545;publication date&#36827;&#34892;&#25913;&#21160;&#12290; &#22914;&#26524;&#20320;&#26159;&#19968;&#20010;&#32534;&#36753;&#65292;&#19981;&#24076;&#26395;&#20316;&#32773;&#25512;&#36831;&#20986;&#29256;&#26085;&#26399;&#30340;&#35805;&#65292;&#36825;&#20010;&#21151;&#33021;&#23601;&#24456;&#26377;&#29992;&#12290; &#65288;&#24403;&#28982;&#65292;&#36825;&#32431;&#31929;&#26159;&#19968;&#20010;&#20551;&#35774;&#30340;&#20363;&#23376;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn169&quot;&gt;&#24403;&#19968;&#20010;&#29992;&#25143;&#29992;&#36825;&#20010;&#19981;&#21253;&#21547;&#23436;&#25972;&#20449;&#24687;&#30340;&#34920;&#21333;&#28155;&#21152;&#19968;&#26412;&#26032;&#20070;&#26102;&#65292;Django&#20250;&#31616;&#21333;&#22320;&#23558;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;publication_date&lt;/span&gt;&lt;/tt&gt;&#35774;&#32622;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt;&#65292;&#20197;&#30830;&#20445;&#36825;&#20010;&#23383;&#27573;&#28385;&#36275;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;null=True&lt;/span&gt;&lt;/tt&gt;&#30340;&#26465;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn170&quot;&gt;&#21478;&#19968;&#20010;&#24120;&#29992;&#30340;&#32534;&#36753;&#39029;&#38754;&#33258;&#23450;&#20041;&#26159;&#38024;&#23545;&#22810;&#23545;&#22810;&#23383;&#27573;&#30340;&#12290; &#30495;&#22914;&#25105;&#20204;&#22312;book&#32534;&#36753;&#39029;&#38754;&#30475;&#21040;&#30340;&#37027;&#26679;&#65292;`` &#22810;&#23545;&#22810;&#23383;&#27573;`` &#34987;&#23637;&#29616;&#25104;&#22810;&#36873;&#26694;&#12290;&#34429;&#28982;&#22810;&#36873;&#26694;&#22312;&#36923;&#36753;&#19978;&#26159;&#26368;&#36866;&#21512;&#30340;HTML&#25511;&#20214;&#65292;&#20294;&#23427;&#21364;&#19981;&#37027;&#20040;&#22909;&#29992;&#12290; &#22914;&#26524;&#20320;&#24819;&#36873;&#25321;&#22810;&#39033;&#65292;&#20320;&#24517;&#39035;&#36824;&#35201;&#25353;&#19979;Ctrl&#38190;&#65288;&#33529;&#26524;&#26426;&#26159;command&#38190;&#65289;&#12290; &#34429;&#28982;&#31649;&#29702;&#24037;&#20855;&#22240;&#27492;&#28155;&#21152;&#20102;&#27880;&#37322;&#65288;help_text&#65289;&#65292;&#20294;&#26159;&#24403;&#23427;&#26377;&#20960;&#30334;&#20010;&#36873;&#39033;&#26102;&#65292;&#23427;&#20381;&#28982;&#26174;&#24471;&#31528;&#25305;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn171&quot;&gt;&#26356;&#22909;&#30340;&#21150;&#27861;&#26159;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;filter_horizontal&lt;/span&gt;&lt;/tt&gt;&#12290;&#35753;&#25105;&#20204;&#25226;&#23427;&#28155;&#21152;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BookAdmin&lt;/span&gt;&lt;/tt&gt;&#20013;&#65292;&#28982;&#21518;&#30475;&#30475;&#23427;&#30340;&#25928;&#26524;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn173&quot;&gt;class BookAdmin(admin.ModelAdmin):
    list_display = (&apos;title&apos;, &apos;publisher&apos;, &apos;publication_date&apos;)
    list_filter = (&apos;publication_date&apos;,)
    date_hierarchy = &apos;publication_date&apos;
    ordering = (&apos;-publication_date&apos;,)
    **filter_horizontal = (&apos;authors&apos;,)**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#65288;&#22914;&#26524;&#20320;&#19968;&#30528;&#36319;&#30528;&#20570;&#32451;&#20064;&#65292;&#35831;&#27880;&#24847;&#31227;&#38500;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;fields&lt;/span&gt;&lt;/tt&gt;&#36873;&#39033;&#65292;&#20197;&#20351;&#24471;&#32534;&#36753;&#39029;&#38754;&#21253;&#21547;&#25152;&#26377;&#23383;&#27573;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn175&quot;&gt;&#21047;&#26032;book&#32534;&#36753;&#39029;&#38754;&#65292;&#20320;&#20250;&#30475;&#21040;Author&#21306;&#20013;&#26377;&#19968;&#20010;&#31934;&#24039;&#30340;JavaScript&#36807;&#28388;&#22120;&#65292;&#23427;&#20801;&#35768;&#20320;&#26816;&#32034;&#36873;&#39033;&#65292;&#28982;&#21518;&#23558;&#36873;&#20013;&#30340;authors&#20174;Available&#26694;&#31227;&#21040;Chosen&#26694;&#65292;&#36824;&#21487;&#20197;&#31227;&#22238;&#26469;&#12290;&lt;/p&gt;
&lt;img alt=&quot;Screenshot of the book edit form after adding filter_horizontal.&quot; src=&quot;http://new-media.djangobook.com/content/en/2.0/chapter06/book_editform1.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn177&quot;&gt;&#22270; 6-13. &#21547;filter_horizontal&#30340;book&#32534;&#36753;&#39029;&#38754;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn178&quot;&gt;&#25105;&#20204;&#24378;&#28872;&#24314;&#35758;&#38024;&#23545;&#37027;&#20123;&#25317;&#26377;&#21313;&#20010;&#20197;&#19978;&#36873;&#39033;&#30340;`` &#22810;&#23545;&#22810;&#23383;&#27573;`` &#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;filter_horizontal&lt;/span&gt;&lt;/tt&gt;&#12290; &#36825;&#27604;&#22810;&#36873;&#26694;&#22909;&#29992;&#22810;&#20102;&#12290; &#20320;&#21487;&#20197;&#22312;&#22810;&#20010;&#23383;&#27573;&#19978;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;filter_horizontal&lt;/span&gt;&lt;/tt&gt;&#65292;&#21482;&#38656;&#22312;&#36825;&#20010;&#20803;&#32452;&#20013;&#25351;&#23450;&#27599;&#20010;&#23383;&#27573;&#30340;&#21517;&#23383;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn179&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ModelAdmin&lt;/span&gt;&lt;/tt&gt;&#31867;&#36824;&#25903;&#25345;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;filter_vertical&lt;/span&gt;&lt;/tt&gt;&#36873;&#39033;&#12290; &#23427;&#20687;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;filter_horizontal&lt;/span&gt;&lt;/tt&gt;&#37027;&#26679;&#24037;&#20316;&#65292;&#38500;&#20102;&#25511;&#20214;&#37117;&#26159;&#22402;&#30452;&#25490;&#21015;&#65292;&#32780;&#19981;&#26159;&#27700;&#24179;&#25490;&#21015;&#30340;&#12290; &#33267;&#20110;&#20351;&#29992;&#21738;&#20010;&#65292;&#21482;&#26159;&#20010;&#20154;&#21916;&#22909;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;filter_horizontal&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;filter_vertical&lt;/span&gt;&lt;/tt&gt;&#36873;&#39033;&#21482;&#33021;&#29992;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#22810;&#23545;&#22810;&#23383;&#27573;&lt;/span&gt;&lt;/tt&gt; &#19978;, &#32780;&#19981;&#33021;&#29992;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ForeignKey&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#12290; &#40664;&#35748;&#22320;&#65292;&#31649;&#29702;&#24037;&#20855;&#20351;&#29992;`` &#19979;&#25289;&#26694;`` &#26469;&#23637;&#29616;`` &#22806;&#38190;`` &#23383;&#27573;&#12290;&#20294;&#26159;&#65292;&#27491;&#22914;`` &#22810;&#23545;&#22810;&#23383;&#27573;`` &#37027;&#26679;&#65292;&#26377;&#26102;&#20505;&#20320;&#19981;&#24819;&#24525;&#21463;&#22240;&#35013;&#36733;&#24182;&#26174;&#31034;&#36825;&#20123;&#36873;&#39033;&#32780;&#20135;&#29983;&#30340;&#22823;&#37327;&#24320;&#38144;&#12290; &#20363;&#22914;&#65292;&#25105;&#20204;&#30340;book&#25968;&#25454;&#24211;&#33192;&#32960;&#21040;&#25317;&#26377;&#25968;&#21315;&#26465;publishers&#30340;&#35760;&#24405;&#65292;&#20197;&#33268;&#20110;book&#30340;&#28155;&#21152;&#39029;&#38754;&#35013;&#36733;&#26102;&#38388;&#36739;&#20037;&#65292;&#22240;&#20026;&#23427;&#24517;&#39035;&#25226;&#27599;&#19968;&#20010;publishe&#37117;&#35013;&#36733;&#24182;&#26174;&#31034;&#22312;`` &#19979;&#25289;&#26694;`` &#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn181&quot;&gt;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#30340;&#21150;&#27861;&#26159;&#20351;&#29992;`` raw_id_fields`` &#36873;&#39033;&#12290;&#23427;&#26159;&#19968;&#20010;&#21253;&#21547;&#22806;&#38190;&#23383;&#27573;&#21517;&#31216;&#30340;&#20803;&#32452;&#65292;&#23427;&#21253;&#21547;&#30340;&#23383;&#27573;&#23558;&#34987;&#23637;&#29616;&#25104;`` &#25991;&#26412;&#26694;`` &#65292;&#32780;&#19981;&#20877;&#26159;`` &#19979;&#25289;&#26694;`` &#12290;&#35265;&#22270; 6-14&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn183&quot;&gt;class BookAdmin(admin.ModelAdmin):
    list_display = (&apos;title&apos;, &apos;publisher&apos;, &apos;publication_date&apos;)
    list_filter = (&apos;publication_date&apos;,)
    date_hierarchy = &apos;publication_date&apos;
    ordering = (&apos;-publication_date&apos;,)
    filter_horizontal = (&apos;authors&apos;,)
    **raw_id_fields = (&apos;publisher&apos;,)**
&lt;/pre&gt;
&lt;img alt=&quot;Screenshot of edit form after raw_id_fields.&quot; src=&quot;http://new-media.djangobook.com/content/en/2.0/chapter06/book_editform2.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#22270; 6-14. &#21547;raw_id_fields&#30340;book&#32534;&#36753;&#39029;&#38754;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#22312;&#36825;&#20010;&#36755;&#20837;&#26694;&#20013;&#65292;&#20320;&#36755;&#20837;&#20160;&#20040;&#21602;&#65311; publisher&#30340;&#25968;&#25454;&#24211;ID&#21495;&#12290; &#32771;&#34385;&#21040;&#20154;&#20204;&#36890;&#24120;&#19981;&#20250;&#35760;&#20303;&#36825;&#20123;&#25968;&#25454;&#24211;ID&#65292;&#31649;&#29702;&#24037;&#20855;&#25552;&#20379;&#20102;&#19968;&#20010;&#25918;&#22823;&#38236;&#22270;&#26631;&#26041;&#20415;&#20320;&#36755;&#20837;&#12290;&#28857;&#20987;&#37027;&#20010;&#22270;&#26631;&#23558;&#20250;&#24377;&#20986;&#19968;&#20010;&#31383;&#21475;&#65292;&#22312;&#37027;&#37324;&#20320;&#21487;&#20197;&#36873;&#25321;&#24819;&#35201;&#28155;&#21152;&#30340;publishe&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn187&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn187&quot;&gt;&#29992;&#25143;&#12289;&#29992;&#25143;&#32452;&#21644;&#26435;&#38480;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn188&quot;&gt;&#22240;&#20026;&#20320;&#26159;&#29992;&#36229;&#32423;&#29992;&#25143;&#30331;&#24405;&#30340;&#65292;&#20320;&#21487;&#20197;&#21019;&#24314;&#65292;&#32534;&#36753;&#21644;&#21024;&#38500;&#20219;&#20309;&#23545;&#20687;&#12290; &#28982;&#32780;&#65292;&#19981;&#21516;&#30340;&#29615;&#22659;&#35201;&#27714;&#26377;&#19981;&#21516;&#30340;&#26435;&#38480;&#65292;&#31995;&#32479;&#19981;&#20801;&#35768;&#25152;&#26377;&#20154;&#37117;&#26159;&#36229;&#32423;&#29992;&#25143;&#12290; &#31649;&#29702;&#24037;&#20855;&#26377;&#19968;&#20010;&#29992;&#25143;&#26435;&#38480;&#31995;&#32479;&#65292;&#36890;&#36807;&#23427;&#20320;&#21487;&#20197;&#26681;&#25454;&#29992;&#25143;&#30340;&#38656;&#35201;&#26469;&#25351;&#23450;&#20182;&#20204;&#30340;&#26435;&#38480;&#65292;&#20174;&#32780;&#36798;&#21040;&#37096;&#20998;&#35775;&#38382;&#31995;&#32479;&#30340;&#30446;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn189&quot;&gt;&#29992;&#25143;&#24080;&#21495;&#24212;&#35813;&#26159;&#36890;&#29992;&#30340;&#12289;&#29420;&#31435;&#20110;&#31649;&#29702;&#30028;&#38754;&#20197;&#22806;&#20173;&#21487;&#20197;&#20351;&#29992;&#12290;&#20294;&#25105;&#20204;&#29616;&#22312;&#25226;&#23427;&#30475;&#20316;&#26159;&#31649;&#29702;&#30028;&#38754;&#30340;&#19968;&#37096;&#20998;&#12290; &#22312;&#31532;&#21313;&#22235;&#31456;&#65292;&#25105;&#20204;&#23558;&#35762;&#36848;&#22914;&#20309;&#25226;&#29992;&#25143;&#24080;&#21495;&#19982;&#20320;&#30340;&#32593;&#31449;&#65288;&#19981;&#20165;&#20165;&#26159;&#31649;&#29702;&#24037;&#20855;&#65289;&#38598;&#25104;&#22312;&#19968;&#36215;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&#20320;&#36890;&#36807;&#31649;&#29702;&#30028;&#38754;&#32534;&#36753;&#29992;&#25143;&#21450;&#20854;&#35768;&#21487;&#23601;&#20687;&#20320;&#32534;&#36753;&#21035;&#30340;&#23545;&#35937;&#19968;&#26679;&#12290; &#25105;&#20204;&#22312;&#26412;&#31456;&#30340;&#21069;&#38754;&#65292;&#27983;&#35272;&#29992;&#25143;&#21644;&#29992;&#25143;&#32452;&#21306;&#22495;&#30340;&#26102;&#20505;&#24050;&#32463;&#35265;&#36807;&#36825;&#20123;&#20102;&#12290; &#22914;&#20320;&#25152;&#24819;&#65292;&#29992;&#25143;&#23545;&#35937;&#26377;&#26631;&#20934;&#30340;&#29992;&#25143;&#21517;&#12289;&#23494;&#30721;&#12289;&#37038;&#31665;&#22320;&#22336;&#21644;&#30495;&#23454;&#22995;&#21517;&#65292;&#21516;&#26102;&#23427;&#36824;&#26377;&#20851;&#20110;&#20351;&#29992;&#31649;&#29702;&#30028;&#38754;&#30340;&#26435;&#38480;&#23450;&#20041;&#12290; &#39318;&#20808;&#65292;&#36825;&#26377;&#19968;&#32452;&#19977;&#20010;&#24067;&#23572;&#22411;&#26631;&#35760;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn191&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn191&quot;&gt;&#27963;&#21160;&#26631;&#24535;&#65292;&#23427;&#29992;&#26469;&#25511;&#21046;&#29992;&#25143;&#26159;&#21542;&#24050;&#32463;&#28608;&#27963;&#12290; &#22914;&#26524;&#19968;&#20010;&#29992;&#25143;&#24080;&#21495;&#30340;&#36825;&#20010;&#26631;&#35760;&#26159;&#20851;&#38381;&#29366;&#24577;&#65292;&#32780;&#29992;&#25143;&#21448;&#23581;&#35797;&#29992;&#23427;&#30331;&#24405;&#26102;&#65292;&#21363;&#20351;&#23494;&#30721;&#27491;&#30830;&#65292;&#20182;&#20063;&#26080;&#27861;&#30331;&#24405;&#31995;&#32479;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn192&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn192&quot;&gt;&#25104;&#21592;&#26631;&#24535;&#65292;&#23427;&#29992;&#26469;&#25511;&#21046;&#36825;&#20010;&#29992;&#25143;&#26159;&#21542;&#21487;&#20197;&#30331;&#24405;&#31649;&#29702;&#30028;&#38754;&#65288;&#21363;&#65306;&#36825;&#20010;&#29992;&#25143;&#26159;&#19981;&#26159;&#20320;&#20204;&#32452;&#32455;&#37324;&#30340;&#25104;&#21592;&#65289; &#30001;&#20110;&#29992;&#25143;&#31995;&#32479;&#21487;&#20197;&#34987;&#29992;&#20110;&#25511;&#21046;&#20844;&#20247;&#39029;&#38754;&#65288;&#21363;&#65306;&#38750;&#31649;&#29702;&#39029;&#38754;&#65289;&#30340;&#35775;&#38382;&#26435;&#38480;&#65288;&#35814;&#35265;&#31532;&#21313;&#22235;&#31456;&#65289;&#65292;&#36825;&#20010;&#26631;&#24535;&#21487;&#29992;&#26469;&#21306;&#20998;&#20844;&#20247;&#29992;&#25143;&#21644;&#31649;&#29702;&#29992;&#25143;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn193&quot;&gt;&#36229;&#32423;&#29992;&#25143;&#26631;&#24535;&#65292;&#23427;&#36171;&#20104;&#29992;&#25143;&#22312;&#31649;&#29702;&#30028;&#38754;&#20013;&#28155;&#21152;&#12289;&#20462;&#25913;&#21644;&#21024;&#38500;&#20219;&#20309;&#39033;&#30446;&#30340;&#26435;&#38480;&#12290; &#22914;&#26524;&#19968;&#20010;&#29992;&#25143;&#24080;&#21495;&#26377;&#36825;&#20010;&#26631;&#24535;&#65292;&#37027;&#20040;&#25152;&#26377;&#26435;&#38480;&#35774;&#32622;&#65288;&#21363;&#20351;&#27809;&#26377;&#65289;&#37117;&#20250;&#34987;&#24573;&#30053;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn194&quot;&gt;&#26222;&#36890;&#30340;&#27963;&#36291;&#65292;&#38750;&#36229;&#32423;&#29992;&#25143;&#30340;&#31649;&#29702;&#29992;&#25143;&#21487;&#20197;&#26681;&#25454;&#19968;&#22871;&#35774;&#23450;&#22909;&#30340;&#35768;&#21487;&#36827;&#20837;&#12290; &#31649;&#29702;&#30028;&#38754;&#20013;&#27599;&#31181;&#21487;&#32534;&#36753;&#30340;&#23545;&#35937;&#65288;&#22914;&#65306;books&#12289;authors&#12289;publishers&#65289;&#37117;&#26377;&#19977;&#31181;&#26435;&#38480;&#65306; &lt;em&gt;&#21019;&#24314;&lt;/em&gt; &#35768;&#21487;&#65292; &lt;em&gt;&#32534;&#36753;&lt;/em&gt; &#35768;&#21487;&#21644; &lt;em&gt;&#21024;&#38500;&lt;/em&gt; &#35768;&#21487;&#12290; &#32473;&#19968;&#20010;&#29992;&#25143;&#25480;&#26435;&#35768;&#21487;&#20063;&#23601;&#34920;&#26126;&#35813;&#29992;&#25143;&#21487;&#20197;&#36827;&#34892;&#35768;&#21487;&#25551;&#36848;&#30340;&#25805;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn195&quot;&gt;&#24403;&#20320;&#21019;&#24314;&#19968;&#20010;&#29992;&#25143;&#26102;&#65292;&#23427;&#27809;&#26377;&#20219;&#20309;&#26435;&#38480;&#65292;&#35813;&#26377;&#20160;&#20040;&#26435;&#38480;&#26159;&#30001;&#20320;&#20915;&#23450;&#30340;&#12290; &#20363;&#22914;&#65292;&#20320;&#21487;&#20197;&#32473;&#19968;&#20010;&#29992;&#25143;&#28155;&#21152;&#21644;&#20462;&#25913;publishers&#30340;&#26435;&#38480;&#65292;&#32780;&#19981;&#32473;&#20182;&#21024;&#38500;&#30340;&#26435;&#38480;&#12290; &#35831;&#27880;&#24847;&#65292;&#36825;&#20123;&#26435;&#38480;&#26159;&#23450;&#20041;&#22312;&#27169;&#22359;&#32423;&#21035;&#19978;&#65292;&#32780;&#19981;&#26159;&#23545;&#35937;&#32423;&#21035;&#19978;&#30340;&#12290;&#25454;&#20010;&#20363;&#23376;&#65292;&#20320;&#21487;&#20197;&#35753;&#23567;&#24378;&#20462;&#25913;&#20219;&#20309;&#22270;&#20070;&#65292;&#20294;&#26159;&#19981;&#33021;&#35753;&#20182;&#20165;&#20462;&#25913;&#30001;&#26426;&#26800;&#24037;&#19994;&#20986;&#29256;&#31038;&#20986;&#29256;&#30340;&#22270;&#20070;&#12290; &#21518;&#38754;&#36825;&#31181;&#22522;&#20110;&#23545;&#35937;&#32423;&#21035;&#30340;&#26435;&#38480;&#35774;&#32622;&#27604;&#36739;&#22797;&#26434;&#65292;&#24182;&#19988;&#36229;&#20986;&#20102;&#26412;&#20070;&#30340;&#35206;&#30422;&#33539;&#22260;&#65292;&#20294;&#20320;&#21487;&#20197;&#22312;Django documentation&#20013;&#23547;&#25214;&#31572;&#26696;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn196&quot;&gt;&#27880;&#37322;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&#26435;&#38480;&#31649;&#29702;&#31995;&#32479;&#20063;&#25511;&#21046;&#32534;&#36753;&#29992;&#25143;&#21644;&#26435;&#38480;&#12290; &#22914;&#26524;&#20320;&#32473;&#26576;&#20154;&#32534;&#36753;&#29992;&#25143;&#30340;&#26435;&#38480;&#65292;&#20182;&#21487;&#20197;&#32534;&#36753;&#33258;&#24049;&#30340;&#26435;&#38480;&#65292;&#36825;&#31181;&#33021;&#21147;&#21487;&#33021;&#19981;&#26159;&#20320;&#24076;&#26395;&#30340;&#12290; &#36171;&#20104;&#19968;&#20010;&#29992;&#25143;&#20462;&#25913;&#29992;&#25143;&#30340;&#26435;&#38480;&#65292;&#26412;&#36136;&#19978;&#35828;&#23601;&#26159;&#25226;&#20182;&#21464;&#25104;&#19968;&#20010;&#36229;&#32423;&#29992;&#25143;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&#20320;&#20063;&#21487;&#20197;&#32473;&#32452;&#20013;&#20998;&#37197;&#29992;&#25143;&#12290; &#19968;&#20010; &lt;em&gt;&#32452;&lt;/em&gt; &#31616;&#21270;&#20102;&#32473;&#32452;&#20013;&#25152;&#26377;&#25104;&#21592;&#24212;&#29992;&#19968;&#22871;&#35768;&#21487;&#30340;&#21160;&#20316;&#12290; &#32452;&#22312;&#32473;&#22823;&#37327;&#29992;&#25143;&#29305;&#23450;&#26435;&#38480;&#30340;&#26102;&#20505;&#24456;&#26377;&#29992;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn199&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&#20309;&#26102;&#12289;&#20026;&#20160;&#20040;&#20351;&#29992;&#31649;&#29702;&#30028;&#38754;&#65311;&#20309;&#26102;&#21448;&#19981;&#20351;&#29992;&#21602;&#65311;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&#32463;&#36807;&#36825;&#19968;&#31456;&#30340;&#23398;&#20064;&#65292;&#20320;&#24212;&#35813;&#23545;Django&#31649;&#29702;&#24037;&#20855;&#26377;&#25152;&#35748;&#35782;&#12290; &#20294;&#26159;&#25105;&#20204;&#38656;&#35201;&#34920;&#26126;&#19968;&#20010;&#35266;&#28857;&#65306;* &#20160;&#20040;&#26102;&#20505;* &#12289;* &#20026;&#20160;&#20040;* &#29992;&#65292;&#20197;&#21450;&#20160;&#20040;&#26102;&#20505;&#21448;* &#19981;* &#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn201&quot;&gt;Django&#30340;&#31649;&#29702;&#30028;&#38754;&#23545;&#38750;&#25216;&#26415;&#29992;&#25143;&#35201;&#36755;&#20837;&#20182;&#20204;&#30340;&#25968;&#25454;&#26102;&#29305;&#21035;&#26377;&#29992;&#65307;&#20107;&#23454;&#19978;&#36825;&#20010;&#29305;&#24615;&#23601;&#26159;&#19987;&#38376;&#20026;&#36825;&#20010; &#23454;&#29616;&#30340;&#12290; &#22312;Django&#26368;&#24320;&#22987;&#24320;&#21457;&#30340;&#26032;&#38395;&#25253;&#36947;&#30340;&#34892;&#19994;&#24212;&#29992;&#20013;&#65292;&#26377;&#19968;&#20010;&#20856;&#22411;&#30340;&#22312;&#32447;&#33258;&#26469;&#27700;&#30340;&#27700;&#36136;&#19987;&#39064;&#25253;&#36947; &#24212;&#29992;&#65292;&#23427;&#30340;&#23454;&#29616;&#27969;&#31243;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn202&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn202&quot;&gt;&#36127;&#36131;&#36825;&#20010;&#25253;&#36947;&#30340;&#35760;&#32773;&#21644;&#35201;&#22788;&#29702;&#25968;&#25454;&#30340;&#24320;&#21457;&#32773;&#30896;&#22836;&#65292;&#25552;&#20379;&#19968;&#20123;&#25968;&#25454;&#32473;&#24320;&#21457;&#32773;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn203&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn203&quot;&gt;&#24320;&#21457;&#32773;&#22260;&#32469;&#36825;&#20123;&#25968;&#25454;&#35774;&#35745;&#27169;&#22411;&#28982;&#21518;&#37197;&#32622;&#19968;&#20010;&#31649;&#29702;&#30028;&#38754;&#32473;&#35760;&#32773;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn204&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn204&quot;&gt;&#35760;&#32773;&#26816;&#26597;&#31649;&#29702;&#30028;&#38754;&#65292;&#23613;&#26089;&#25351;&#20986;&#32570;&#23569;&#25110;&#22810;&#20313;&#30340;&#23383;&#27573;&#12290; &#24320;&#21457;&#32773;&#26469;&#22238;&#22320;&#20462;&#25913;&#27169;&#22359;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn205&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn205&quot;&gt;&#24403;&#27169;&#22359;&#35748;&#21487;&#21518;&#65292;&#35760;&#32773;&#23601;&#24320;&#22987;&#29992;&#31649;&#29702;&#30028;&#38754;&#36755;&#20837;&#25968;&#25454;&#12290; &#21516;&#26102;&#65292;&#31243;&#24207;&#21592;&#21487;&#20197;&#19987;&#27880;&#20110;&#24320;&#21457;&#20844;&#20247;&#35775;&#38382;&#35270;&#22270;&#21644;&#27169;&#26495;&#65288;&#26377;&#36259;&#30340;&#37096;&#20998;&#65289;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn206&quot;&gt;&#25442;&#21477;&#35805;&#35828;&#65292;Django&#30340;&#31649;&#29702;&#30028;&#38754;&#20026;&#20869;&#23481;&#36755;&#20837;&#20154;&#21592;&#21644;&#32534;&#31243;&#20154;&#21592;&#37117;&#25552;&#20379;&#20102;&#20415;&#21033;&#30340;&#24037;&#20855;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn207&quot;&gt;&#24403;&#28982;&#65292;&#38500;&#20102;&#25968;&#25454;&#36755;&#20837;&#26041;&#38754;&#65292;&#25105;&#20204;&#21457;&#29616;&#31649;&#29702;&#30028;&#38754;&#22312;&#19979;&#38754;&#36825;&#20123;&#24773;&#26223;&#20013;&#20063;&#26159;&#24456;&#26377;&#29992;&#30340;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn208&quot;&gt;&lt;ul class=&quot;first&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn208&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn208&quot;&gt;&#26816;&#26597;&#27169;&#22359;* &#65306;&#24403;&#20320;&#23450;&#20041;&#22909;&#20102;&#33509;&#24178;&#20010;&#27169;&#22359;&#65292;&#22312;&#31649;&#29702;&#39029;&#38754;&#20013;&#25226;&#20182;&#20204;&#35843;&#20986;&#26469;&#28982;&#21518;&#36755;&#20837;&#19968;&#20123;&#34394;&#20551;&#30340;&#25968;&#25454;&#65292;&#36825;&#26159;&#30456;&#24403;&#26377;&#29992;&#30340;&#12290; &#26377;&#26102;&#20505;&#65292;&#23427;&#33021;&#26174;&#31034;&#25968;&#25454;&#24314;&#27169;&#30340;&#38169;&#35823;&#25110;&#32773;&#27169;&#22359;&#20013;&#20854;&#23427;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&lt;ul class=&quot;first&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn209&quot;&gt;&#31649;&#29702;&#26082;&#24471;&#25968;&#25454;* &#65306;&#22914;&#26524;&#20320;&#30340;&#24212;&#29992;&#31243;&#24207;&#20381;&#36182;&#22806;&#37096;&#25968;&#25454;&#65288;&#26469;&#33258;&#29992;&#25143;&#36755;&#20837;&#25110;&#32593;&#32476;&#29228;&#34411;&#65289;&#65292;&#31649;&#29702;&#30028;&#38754;&#25552;&#20379;&#20102;&#19968;&#20010;&#20415;&#25463;&#30340;&#36884;&#24452;&#65292;&#35753;&#20320;&#26816;&#26597;&#21644;&#32534;&#36753;&#37027;&#20123;&#25968;&#25454;&#12290; &#20320;&#21487;&#20197;&#25226;&#23427;&#30475;&#20316;&#26159;&#19968;&#20010;&#21151;&#33021;&#19981;&#37027;&#20040;&#24378;&#22823;&#65292;&#20294;&#26159;&#24456;&#26041;&#20415;&#30340;&#25968;&#25454;&#24211;&#21629;&#20196;&#34892;&#24037;&#20855;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&lt;ul class=&quot;first&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn210&quot;&gt;&#20020;&#26102;&#30340;&#25968;&#25454;&#31649;&#29702;&#31243;&#24207;* &#65306;&#20320;&#21487;&#20197;&#29992;&#31649;&#29702;&#24037;&#20855;&#24314;&#31435;&#33258;&#24049;&#30340;&#36731;&#37327;&#32423;&#25968;&#25454;&#31649;&#29702;&#31243;&#24207;&#65292;&#27604;&#22914;&#35828;&#24320;&#38144;&#35760;&#24405;&#12290; &#22914;&#26524;&#20320;&#27491;&#22312;&#26681;&#25454;&#33258;&#24049;&#30340;&#65292;&#32780;&#19981;&#26159;&#20844;&#20247;&#30340;&#38656;&#35201;&#24320;&#21457;&#20123;&#20160;&#20040;&#65292;&#37027;&#20040;&#31649;&#29702;&#30028;&#38754;&#21487;&#20197;&#24102;&#32473;&#20320;&#24456;&#22823;&#30340;&#24110;&#21161;&#12290; &#20174;&#36825;&#20010;&#24847;&#20041;&#19978;&#35762;&#65292;&#20320;&#21487;&#20197;&#25226;&#23427;&#30475;&#20316;&#26159;&#19968;&#20010;&#22686;&#24378;&#30340;&#20851;&#31995;&#22411;&#30005;&#23376;&#34920;&#26684;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn211&quot;&gt;&#26368;&#21518;&#19968;&#28857;&#35201;&#28548;&#28165;&#30340;&#26159;&#65306; &#31649;&#29702;&#30028;&#38754;&#19981;&#26159;&#32456;&#32467;&#32773;&#12290; &#36807;&#24448;&#35768;&#22810;&#24180;&#38388;&#65292;&#25105;&#20204;&#30475;&#21040;&#23427;&#34987;&#25286;&#20998;&#12289;&#20462;&#25913;&#25104;&#33509;&#24178;&#20010;&#21151;&#33021;&#27169;&#22359;&#65292;&#32780;&#36825;&#20123;&#21151;&#33021;&#19981;&#26159;&#23427;&#25152;&#25903;&#25345;&#30340;&#12290; &#23427;&#19981;&#24212;&#25104;&#20026;&#19968;&#20010;* &#20844;&#20247;* &#25968;&#25454;&#35775;&#38382;&#25509;&#21475;&#65292;&#20063;&#19981;&#24212;&#20801;&#35768;&#23545;&#20320;&#30340;&#25968;&#25454;&#36827;&#34892;&#22797;&#26434;&#30340;&#25490;&#24207;&#21644;&#26597;&#35810;&#12290; &#27491;&#22914;&#26412;&#31456;&#24320;&#22836;&#25152;&#35828;&#65292;&#23427;&#20165;&#25552;&#20379;&#32473;&#21487;&#20449;&#20219;&#30340;&#31649;&#29702;&#21592;&#12290; &#35831;&#35760;&#20303;&#36825;&#19968;&#28857;&#65292;&#23427;&#26159;&#26377;&#25928;&#20351;&#29992;&#31649;&#29702;&#30028;&#38754;&#30340;&#38053;&#21273;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn212&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn212&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn213&quot;&gt;&#21040;&#29616;&#22312;&#65292;&#25105;&#20204;&#24050;&#32463;&#21019;&#24314;&#20102;&#19968;&#20123;&#27169;&#22359;&#65292;&#24182;&#19988;&#20026;&#32534;&#36753;&#25968;&#25454;&#37197;&#32622;&#20102;&#19968;&#20010;&#20248;&#31168;&#30340;&#30028;&#38754;&#12290; ` &#19979;&#19968;&#31456; &amp;lt;../chapter07/&amp;gt;`__ &#65292;&#25105;&#20204;&#23558;&#36716;&#20837;&#21040;&#32593;&#31449;&#24320;&#21457;&#20013;&#26368;&#37325;&#35201;&#30340;&#37096;&#20998;&#65306; &#34920;&#21333;&#30340;&#21019;&#24314;&#21644;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter07</id>
        <title type="html">chapter07</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter07"/>
        <published>2015-02-26T23:26:56+08:00</published>
        <updated>2015-02-26T23:26:56+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;7&#31456; &#34920;&#21333;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#20174;Google&#30340;&#31616;&#26420;&#30340;&#21333;&#20010;&#25628;&#32034;&#26694;&#65292;&#21040;&#24120;&#35265;&#30340;Blog&#35780;&#35770;&#25552;&#20132;&#34920;&#21333;&#65292;&#20877;&#21040;&#22797;&#26434;&#30340;&#33258;&#23450;&#20041;&#25968;&#25454;&#36755;&#20837;&#25509;&#21475;&#65292;HTML&#34920;&#21333;&#19968;&#30452;&#26159;&#20132;&#20114;&#24615;&#32593;&#31449;&#30340;&#25903;&#26609;&#12290; &#26412;&#31456;&#20171;&#32461;&#22914;&#20309;&#29992;Django&#23545;&#29992;&#25143;&#36890;&#36807;&#34920;&#21333;&#25552;&#20132;&#30340;&#25968;&#25454;&#36827;&#34892;&#35775;&#38382;&#12289;&#26377;&#25928;&#24615;&#26816;&#26597;&#20197;&#21450;&#20854;&#23427;&#22788;&#29702;&#12290; &#19982;&#27492;&#21516;&#26102;&#65292;&#25105;&#20204;&#23558;&#20171;&#32461;HttpRequest&#23545;&#35937;&#21644;Form&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;request&quot;&gt;
&lt;span id=&quot;cn2&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#20174;Request&#23545;&#35937;&#20013;&#33719;&#21462;&#25968;&#25454;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#25105;&#20204;&#22312;&#31532;&#19977;&#31456;&#35762;&#36848;View&#30340;&#20989;&#25968;&#26102;&#24050;&#32463;&#20171;&#32461;&#36807;HttpRequest&#23545;&#35937;&#20102;&#65292;&#20294;&#24403;&#26102;&#24182;&#27809;&#26377;&#35762;&#22826;&#22810;&#12290; &#35753;&#25105;&#20204;&#22238;&#24518;&#19979;&#65306;&#27599;&#20010;view&#20989;&#25968;&#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#26159;&#19968;&#20010;HttpRequest&#23545;&#35937;&#65292;&#23601;&#20687;&#19979;&#38754;&#36825;&#20010;hello()&#20989;&#25968;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn5&quot;&gt;from django.http import HttpResponse

def hello(request):
    return HttpResponse(&quot;Hello world&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;HttpRequest&#23545;&#35937;&#65292;&#27604;&#22914;&#19978;&#38754;&#20195;&#30721;&#37324;&#30340;request&#21464;&#37327;&#65292;&#20250;&#26377;&#19968;&#20123;&#26377;&#36259;&#30340;&#12289;&#20320;&#24517;&#39035;&#35753;&#33258;&#24049;&#29087;&#24713;&#30340;&#23646;&#24615;&#21644;&#26041;&#27861;&#65292;&#20197;&#20415;&#30693;&#36947;&#33021;&#25343;&#23427;&#20204;&#26469;&#20570;&#20123;&#20160;&#20040;&#12290; &#22312;view&#20989;&#25968;&#30340;&#25191;&#34892;&#36807;&#31243;&#20013;&#65292;&#20320;&#21487;&#20197;&#29992;&#36825;&#20123;&#23646;&#24615;&#26469;&#33719;&#21462;&#24403;&#21069;request&#30340;&#19968;&#20123;&#20449;&#24687;&#65288;&#27604;&#22914;&#65292;&#20320;&#27491;&#22312;&#21152;&#36733;&#36825;&#20010;&#39029;&#38754;&#30340;&#29992;&#25143;&#26159;&#35841;&#65292;&#25110;&#32773;&#29992;&#30340;&#26159;&#20160;&#20040;&#27983;&#35272;&#22120;&#65289;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;url&quot;&gt;
&lt;span id=&quot;cn7&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn7&quot;&gt;URL&#30456;&#20851;&#20449;&#24687;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;HttpRequest&#23545;&#35937;&#21253;&#21547;&#24403;&#21069;&#35831;&#27714;URL&#30340;&#19968;&#20123;&#20449;&#24687;&#65306;&lt;/p&gt;
&lt;table class=&quot;cn docutils&quot; id=&quot;cn9&quot;&gt;
&lt;colgroup&gt;
&lt;col width=&quot;24%&quot;&gt;
&lt;col width=&quot;49%&quot;&gt;
&lt;col width=&quot;27%&quot;&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&#23646;&#24615;/&#26041;&#27861;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#35828;&#26126;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#20030;&#20363;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.path&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#38500;&#22495;&#21517;&#20197;&#22806;&#30340;&#35831;&#27714;&#36335;&#24452;&#65292;&#20197;&#27491;&#26012;&#26464;&#24320;&#22836;&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;/hello/&quot;&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.get_host()&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#20027;&#26426;&#21517;&#65288;&#27604;&#22914;&#65292;&#36890;&#24120;&#25152;&#35828;&#30340;&#22495;&#21517;&#65289;&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;127.0.0.1:8000&quot;&lt;/span&gt;&lt;/tt&gt; or
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;www.example.com&quot;&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.get_full_path()&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#35831;&#27714;&#36335;&#24452;&#65292;&#21487;&#33021;&#21253;&#21547;&#26597;&#35810;&#23383;&#31526;&#20018;&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;/hello/?print=true&quot;&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.is_secure()&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#22914;&#26524;&#36890;&#36807;HTTPS&#35775;&#38382;&#65292;&#21017;&#27492;&#26041;&#27861;&#36820;&#22238;True&#65292; &#21542;&#21017;&#36820;&#22238;False&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#22312;view&#20989;&#25968;&#37324;&#65292;&#35201;&#22987;&#32456;&#29992;&#36825;&#20010;&#23646;&#24615;&#25110;&#26041;&#27861;&#26469;&#24471;&#21040;URL&#65292;&#32780;&#19981;&#35201;&#25163;&#21160;&#36755;&#20837;&#12290; &#36825;&#20250;&#20351;&#24471;&#20195;&#30721;&#26356;&#21152;&#28789;&#27963;&#65292;&#20197;&#20415;&#22312;&#20854;&#23427;&#22320;&#26041;&#37325;&#29992;&#12290; &#19979;&#38754;&#26159;&#19968;&#20010;&#31616;&#21333;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn12&quot;&gt;# BAD!
def current_url_view_bad(request):
    return HttpResponse(&quot;Welcome to the page at /current/&quot;)

# GOOD
def current_url_view_good(request):
    return HttpResponse(&quot;Welcome to the page at %s&quot; % request.path)
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn13&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&#26377;&#20851;request&#30340;&#20854;&#23427;&#20449;&#24687;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;request.META &#26159;&#19968;&#20010;Python&#23383;&#20856;&#65292;&#21253;&#21547;&#20102;&#25152;&#26377;&#26412;&#27425;HTTP&#35831;&#27714;&#30340;Header&#20449;&#24687;&#65292;&#27604;&#22914;&#29992;&#25143;IP&#22320;&#22336;&#21644;&#29992;&#25143;Agent&#65288;&#36890;&#24120;&#26159;&#27983;&#35272;&#22120;&#30340;&#21517;&#31216;&#21644;&#29256;&#26412;&#21495;&#65289;&#12290; &#27880;&#24847;&#65292;Header&#20449;&#24687;&#30340;&#23436;&#25972;&#21015;&#34920;&#21462;&#20915;&#20110;&#29992;&#25143;&#25152;&#21457;&#36865;&#30340;Header&#20449;&#24687;&#21644;&#26381;&#21153;&#22120;&#31471;&#35774;&#32622;&#30340;Header&#20449;&#24687;&#12290; &#36825;&#20010;&#23383;&#20856;&#20013;&#20960;&#20010;&#24120;&#35265;&#30340;&#38190;&#20540;&#26377;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn15&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HTTP_REFERER&lt;/span&gt;&lt;/tt&gt;&#65292;&#36827;&#31449;&#21069;&#38142;&#25509;&#32593;&#39029;&#65292;&#22914;&#26524;&#26377;&#30340;&#35805;&#12290; &#65288;&#35831;&#27880;&#24847;&#65292;&#23427;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;REFERRER&lt;/span&gt;&lt;/tt&gt;&#30340;&#31508;&#35823;&#12290;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn16&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HTTP_USER_AGENT&lt;/span&gt;&lt;/tt&gt;&#65292;&#29992;&#25143;&#27983;&#35272;&#22120;&#30340;user-agent&#23383;&#31526;&#20018;&#65292;&#22914;&#26524;&#26377;&#30340;&#35805;&#12290; &#20363;&#22914;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;Mozilla/5.0&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;(X11;&lt;/span&gt;
&lt;span class=&quot;pre&quot;&gt;U;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Linux&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;i686;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;fr-FR;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;rv:1.8.1.17)&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Gecko/20080829&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Firefox/2.0.0.17&quot;&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn17&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;REMOTE_ADDR&lt;/span&gt;&lt;/tt&gt; &#23458;&#25143;&#31471;IP&#65292;&#22914;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;12.345.67.89&quot;&lt;/span&gt;&lt;/tt&gt; &#12290;(&#22914;&#26524;&#30003;&#35831;&#26159;&#32463;&#36807;&#20195;&#29702;&#26381;&#21153;&#22120;&#30340;&#35805;&#65292;&#37027;&#20040;&#23427;&#21487;&#33021;&#26159;&#20197;&#36887;&#21495;&#20998;&#21106;&#30340;&#22810;&#20010;IP&#22320;&#22336;&#65292;&#22914;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;12.345.67.89,23.456.78.90&quot;&lt;/span&gt;&lt;/tt&gt; &#12290;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#27880;&#24847;&#65292;&#22240;&#20026; request.META &#26159;&#19968;&#20010;&#26222;&#36890;&#30340;Python&#23383;&#20856;&#65292;&#22240;&#27492;&#24403;&#20320;&#35797;&#22270;&#35775;&#38382;&#19968;&#20010;&#19981;&#23384;&#22312;&#30340;&#38190;&#26102;&#65292;&#20250;&#35302;&#21457;&#19968;&#20010;KeyError&#24322;&#24120;&#12290; &#65288;HTTP header&#20449;&#24687;&#26159;&#30001;&#29992;&#25143;&#30340;&#27983;&#35272;&#22120;&#25152;&#25552;&#20132;&#30340;&#12289;&#19981;&#24212;&#35813;&#32473;&#20104;&#20449;&#20219;&#30340;&#8220;&#39069;&#22806;&#8221;&#25968;&#25454;&#65292;&#22240;&#27492;&#20320;&#24635;&#26159;&#24212;&#35813;&#22909;&#22909;&#35774;&#35745;&#20320;&#30340;&#24212;&#29992;&#20197;&#20415;&#24403;&#19968;&#20010;&#29305;&#23450;&#30340;Header&#25968;&#25454;&#19981;&#23384;&#22312;&#26102;&#65292;&#32473;&#20986;&#19968;&#20010;&#20248;&#38597;&#30340;&#22238;&#24212;&#12290;&#65289;&#20320;&#24212;&#35813;&#29992; try/except &#35821;&#21477;&#65292;&#25110;&#32773;&#29992;Python&#23383;&#20856;&#30340; get() &#26041;&#27861;&#26469;&#22788;&#29702;&#36825;&#20123;&#8220;&#21487;&#33021;&#19981;&#23384;&#22312;&#30340;&#38190;&#8221;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn20&quot;&gt;# BAD!
def ua_display_bad(request):
    ua = request.META[&apos;HTTP_USER_AGENT&apos;]  # Might raise KeyError!
    return HttpResponse(&quot;Your browser is %s&quot; % ua)

# GOOD (VERSION 1)
def ua_display_good1(request):
    try:
        ua = request.META[&apos;HTTP_USER_AGENT&apos;]
    except KeyError:
        ua = &apos;unknown&apos;
    return HttpResponse(&quot;Your browser is %s&quot; % ua)

# GOOD (VERSION 2)
def ua_display_good2(request):
    ua = request.META.get(&apos;HTTP_USER_AGENT&apos;, &apos;unknown&apos;)
    return HttpResponse(&quot;Your browser is %s&quot; % ua)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#25105;&#20204;&#40723;&#21169;&#20320;&#21160;&#25163;&#20889;&#19968;&#20010;&#31616;&#21333;&#30340;view&#20989;&#25968;&#26469;&#26174;&#31034; request.META &#30340;&#25152;&#26377;&#25968;&#25454;&#65292;&#36825;&#26679;&#20320;&#23601;&#30693;&#36947;&#37324;&#38754;&#26377;&#20160;&#20040;&#20102;&#12290; &#36825;&#20010;view&#20989;&#25968;&#21487;&#33021;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn23&quot;&gt;def display_meta(request):
    values = request.META.items()
    values.sort()
    html = []
    for k, v in values:
        html.append(&apos;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;%s&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;%s&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&apos; % (k, v))
    return HttpResponse(&apos;&amp;lt;table&amp;gt;%s&amp;lt;/table&amp;gt;&apos; % &apos;\n&apos;.join(html))
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#20570;&#20026;&#19968;&#20010;&#32451;&#20064;&#65292;&#30475;&#20320;&#33258;&#24049;&#33021;&#19981;&#33021;&#25226;&#19978;&#38754;&#36825;&#20010;view&#20989;&#25968;&#25913;&#29992;Django&#27169;&#26495;&#31995;&#32479;&#26469;&#23454;&#29616;&#65292;&#32780;&#19981;&#26159;&#19978;&#38754;&#36825;&#26679;&#26469;&#25163;&#21160;&#36755;&#20837;HTML&#20195;&#30721;&#12290;
&#20063;&#21487;&#20197;&#35797;&#30528;&#25226;&#21069;&#38754;&#25552;&#21040;&#30340; request.path &#26041;&#27861;&#25110; HttpRequest &#23545;&#35937;&#30340;&#20854;&#23427;&#26041;&#27861;&#21152;&#36827;&#21435;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn25&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#25552;&#20132;&#30340;&#25968;&#25454;&#20449;&#24687;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&#38500;&#20102;&#22522;&#26412;&#30340;&#20803;&#25968;&#25454;&#65292;HttpRequest&#23545;&#35937;&#36824;&#26377;&#20004;&#20010;&#23646;&#24615;&#21253;&#21547;&#20102;&#29992;&#25143;&#25152;&#25552;&#20132;&#30340;&#20449;&#24687;&#65306; request.GET &#21644; request.POST&#12290;&#20108;&#32773;&#37117;&#26159;&#31867;&#23383;&#20856;&#23545;&#35937;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;&#23427;&#20204;&#26469;&#35775;&#38382;GET&#21644;POST&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&#31867;&#23383;&#20856;&#23545;&#35937;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&#25105;&#20204;&#35828;&#8220;request.GET&#21644;request.POST&#26159;&#31867;&#23383;&#20856;&#23545;&#35937;&#8221;&#65292;&#24847;&#24605;&#26159;&#20182;&#20204;&#30340;&#34892;&#20026;&#20687;Python&#37324;&#26631;&#20934;&#30340;&#23383;&#20856;&#23545;&#35937;&#65292;&#20294;&#22312;&#25216;&#26415;&#24213;&#23618;&#19978;&#20182;&#20204;&#19981;&#26159;&#26631;&#20934;&#23383;&#20856;&#23545;&#35937;&#12290; &#27604;&#22914;&#35828;&#65292;request.GET&#21644;request.POST&#37117;&#26377;get()&#12289;keys()&#21644;values()&#26041;&#27861;&#65292;&#20320;&#21487;&#20197;&#29992;&#29992; for key in request.GET &#33719;&#21462;&#25152;&#26377;&#30340;&#38190;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#37027;&#21040;&#24213;&#26377;&#20160;&#20040;&#21306;&#21035;&#21602;&#65311; &#22240;&#20026;request.GET&#21644;request.POST&#25317;&#26377;&#19968;&#20123;&#26222;&#36890;&#30340;&#23383;&#20856;&#23545;&#35937;&#25152;&#27809;&#26377;&#30340;&#26041;&#27861;&#12290; &#25105;&#20204;&#20250;&#31245;&#21518;&#35762;&#21040;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#20320;&#21487;&#33021;&#20197;&#21069;&#36935;&#21040;&#36807;&#30456;&#20284;&#30340;&#21517;&#23383;&#65306;&#31867;&#25991;&#20214;&#23545;&#35937;&#65292;&#36825;&#20123;Python&#23545;&#35937;&#26377;&#19968;&#20123;&#22522;&#26412;&#30340;&#26041;&#27861;&#65292;&#22914;read()&#65292;&#29992;&#26469;&#20570;&#30495;&#27491;&#30340;Python&#25991;&#20214;&#23545;&#35937;&#30340;&#20195;&#29992;&#21697;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;POST&#25968;&#25454;&#26159;&#26469;&#33258;HTML&#20013;&#30340;&#12296;form&#12297;&#26631;&#31614;&#25552;&#20132;&#30340;&#65292;&#32780;GET&#25968;&#25454;&#21487;&#33021;&#26469;&#33258;&#12296;form&#12297;&#25552;&#20132;&#20063;&#21487;&#33021;&#26159;URL&#20013;&#30340;&#26597;&#35810;&#23383;&#31526;&#20018;(the query string)&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn32&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#19968;&#20010;&#31616;&#21333;&#30340;&#34920;&#21333;&#22788;&#29702;&#31034;&#20363;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#32487;&#32493;&#26412;&#20070;&#19968;&#30452;&#36827;&#34892;&#30340;&#20851;&#20110;&#20070;&#31821;&#12289;&#20316;&#32773;&#12289;&#20986;&#29256;&#31038;&#30340;&#20363;&#23376;&#65292;&#25105;&#20204;&#29616;&#22312;&#26469;&#21019;&#24314;&#19968;&#20010;&#31616;&#21333;&#30340;view&#20989;&#25968;&#20197;&#20415;&#35753;&#29992;&#25143;&#21487;&#20197;&#36890;&#36807;&#20070;&#21517;&#20174;&#25968;&#25454;&#24211;&#20013;&#26597;&#25214;&#20070;&#31821;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#36890;&#24120;&#65292;&#34920;&#21333;&#24320;&#21457;&#20998;&#20026;&#20004;&#20010;&#37096;&#20998;&#65306; &#21069;&#31471;HTML&#39029;&#38754;&#29992;&#25143;&#25509;&#21475;&#21644;&#21518;&#21488;view&#20989;&#25968;&#23545;&#25152;&#25552;&#20132;&#25968;&#25454;&#30340;&#22788;&#29702;&#36807;&#31243;&#12290; &#31532;&#19968;&#37096;&#20998;&#24456;&#31616;&#21333;&#65307;&#29616;&#22312;&#25105;&#20204;&#26469;&#24314;&#31435;&#20010;view&#26469;&#26174;&#31034;&#19968;&#20010;&#25628;&#32034;&#34920;&#21333;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn36&quot;&gt;from django.shortcuts import render_to_response

def search_form(request):
    return render_to_response(&apos;search_form.html&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#22312;&#31532;&#19977;&#31456;&#24050;&#32463;&#23398;&#36807;&#65292;&#36825;&#20010;view&#20989;&#25968;&#21487;&#20197;&#25918;&#21040;Python&#30340;&#25628;&#32034;&#36335;&#24452;&#30340;&#20219;&#20309;&#20301;&#32622;&#12290; &#20026;&#20102;&#20415;&#20110;&#35752;&#35770;&#65292;&#21681;&#20204;&#23558;&#23427;&#25918;&#22312; books/views.py &#37324;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#36825;&#20010; search_form.html &#27169;&#26495;&#65292;&#21487;&#33021;&#30475;&#36215;&#26469;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn40&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Search&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form action=&quot;/search/&quot; method=&quot;get&quot;&amp;gt;
        &amp;lt;input type=&quot;text&quot; name=&quot;q&quot;&amp;gt;
        &amp;lt;input type=&quot;submit&quot; value=&quot;Search&quot;&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#32780; urls.py &#20013;&#30340; URLpattern &#21487;&#33021;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn43&quot;&gt;from mysite.books import views

urlpatterns = patterns(&apos;&apos;,
    # ...
    (r&apos;^search-form/$&apos;, views.search_form),
    # ...
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#65288;&#27880;&#24847;&#65292;&#25105;&#20204;&#30452;&#25509;&#23558;views&#27169;&#22359;import&#36827;&#26469;&#20102;&#65292;&#32780;&#19981;&#26159;&#29992;&#31867;&#20284; from mysite.views import
search_form &#36825;&#26679;&#30340;&#35821;&#21477;&#65292;&#22240;&#20026;&#21069;&#32773;&#30475;&#36215;&#26469;&#26356;&#31616;&#27905;&#12290; &#25105;&#20204;&#23558;&#22312;&#31532;&#65304;&#31456;&#35762;&#36848;&#26356;&#22810;&#30340;&#20851;&#20110;import&#30340;&#29992;&#27861;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#29616;&#22312;&#65292;&#22914;&#26524;&#20320;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;runserver&lt;/span&gt;&lt;/tt&gt;  &#21629;&#20196;&#65292;&#28982;&#21518;&#35775;&#38382;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://127.0.0.1:8000/search-form/&lt;/span&gt;&lt;/tt&gt;&#65292;&#20320;&#20250;&#30475;&#21040;&#25628;&#32034;&#30028;&#38754;&#12290;
&#38750;&#24120;&#31616;&#21333;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#19981;&#36807;&#65292;&#24403;&#20320;&#36890;&#36807;&#36825;&#20010;form&#25552;&#20132;&#25968;&#25454;&#26102;&#65292;&#20320;&#20250;&#24471;&#21040;&#19968;&#20010;Django 404&#38169;&#35823;&#12290; &#36825;&#20010;Form&#25351;&#21521;&#30340;URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/search/&lt;/span&gt;&lt;/tt&gt; &#36824;&#27809;&#26377;&#34987;&#23454;&#29616;&#12290; &#35753;&#25105;&#20204;&#28155;&#21152;&#31532;&#20108;&#20010;&#35270;&#22270;&#20989;&#25968;&#24182;&#35774;&#32622;URL&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn48&quot;&gt;# urls.py

urlpatterns = patterns(&apos;&apos;,
    # ...
    (r&apos;^search-form/$&apos;, views.search_form),
    (r&apos;^search/$&apos;, views.search),
    # ...
)

# views.py

def search(request):
    if &apos;q&apos; in request.GET:
        message = &apos;You searched for: %r&apos; % request.GET[&apos;q&apos;]
    else:
        message = &apos;You submitted an empty form.&apos;
    return HttpResponse(message)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#26242;&#26102;&#20808;&#21482;&#26174;&#31034;&#29992;&#25143;&#25628;&#32034;&#30340;&#23383;&#35789;&#65292;&#20197;&#30830;&#23450;&#25628;&#32034;&#25968;&#25454;&#34987;&#27491;&#30830;&#22320;&#25552;&#20132;&#32473;&#20102;Django&#65292;&#36825;&#26679;&#20320;&#23601;&#20250;&#30693;&#36947;&#25628;&#32034;&#25968;&#25454;&#26159;&#22914;&#20309;&#22312;&#36825;&#20010;&#31995;&#32479;&#20013;&#20256;&#36882;&#30340;&#12290; &#31616;&#32780;&#35328;&#20043;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn50&quot;&gt;&#22312;HTML&#37324;&#25105;&#20204;&#23450;&#20041;&#20102;&#19968;&#20010;&#21464;&#37327;q&#12290;&#24403;&#25552;&#20132;&#34920;&#21333;&#26102;&#65292;&#21464;&#37327;q&#30340;&#20540;&#36890;&#36807;GET(method=&#8221;get&#8221;)&#38468;&#21152;&#22312;URL /search/&#19978;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn51&quot;&gt;&#22788;&#29702;/search/&#65288;search()&#65289;&#30340;&#35270;&#22270;&#36890;&#36807;request.GET&#26469;&#33719;&#21462;q&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#38656;&#35201;&#27880;&#24847;&#30340;&#26159;&#22312;&#36825;&#37324;&#26126;&#30830;&#22320;&#21028;&#26029;q&#26159;&#21542;&#21253;&#21547;&#22312;request.GET&#20013;&#12290;&#23601;&#20687;&#19978;&#38754;request.META&#23567;&#33410;&#37324;&#38754;&#25552;&#21040;&#65292;&#23545;&#20110;&#29992;&#25143;&#25552;&#20132;&#36807;&#26469;&#30340;&#25968;&#25454;&#65292;&#29978;&#33267;&#26159;&#27491;&#30830;&#30340;&#25968;&#25454;&#65292;&#37117;&#38656;&#35201;&#36827;&#34892;&#36807;&#28388;&#12290; &#22312;&#36825;&#37324;&#33509;&#27809;&#26377;&#36827;&#34892;&#26816;&#27979;&#65292;&#37027;&#20040;&#29992;&#25143;&#25552;&#20132;&#19968;&#20010;&#31354;&#30340;&#34920;&#21333;&#23558;&#24341;&#21457;KeyError&#24322;&#24120;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn54&quot;&gt;# BAD!
def bad_search(request):
    # The following line will raise KeyError if &apos;q&apos; hasn&apos;t
    # been submitted!
    message = &apos;You searched for: %r&apos; % request.GET[&apos;q&apos;]
    return HttpResponse(message)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#26597;&#35810;&#23383;&#31526;&#20018;&#21442;&#25968;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#22240;&#20026;&#20351;&#29992;GET&#26041;&#27861;&#30340;&#25968;&#25454;&#26159;&#36890;&#36807;&#26597;&#35810;&#23383;&#31526;&#20018;&#30340;&#26041;&#24335;&#20256;&#36882;&#30340;&#65288;&#20363;&#22914;/search/?q=django&#65289;&#65292;&#25152;&#20197;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992;requet.GET&#26469;&#33719;&#21462;&#36825;&#20123;&#25968;&#25454;&#12290; &#31532;&#19977;&#31456;&#20171;&#32461;Django&#30340;URLconf&#31995;&#32479;&#26102;&#25105;&#20204;&#27604;&#36739;&#20102;Django&#30340;&#31616;&#27905;&#30340;URL&#19982;PHP/Java&#20256;&#32479;&#30340;URL&#65292;&#25105;&#20204;&#25552;&#21040;&#23558;&#22312;&#31532;&#19971;&#31456;&#35762;&#36848;&#22914;&#20309;&#20351;&#29992;&#20256;&#32479;&#30340;URL&#12290;&#36890;&#36807;&#21018;&#25165;&#30340;&#20171;&#32461;&#65292;&#25105;&#20204;&#30693;&#36947;&#22312;&#35270;&#22270;&#37324;&#21487;&#20197;&#20351;&#29992;request.GET&#26469;&#33719;&#21462;&#20256;&#32479;URL&#37324;&#30340;&#26597;&#35810;&#23383;&#31526;&#20018;&#65288;&#20363;&#22914;hours=3&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#33719;&#21462;&#20351;&#29992;POST&#26041;&#27861;&#30340;&#25968;&#25454;&#19982;GET&#30340;&#30456;&#20284;&#65292;&#21482;&#26159;&#20351;&#29992;request.POST&#20195;&#26367;&#20102;request.GET&#12290;&#37027;&#20040;&#65292;POST&#19982;GET&#20043;&#38388;&#26377;&#20160;&#20040;&#19981;&#21516;&#65311;&#24403;&#25105;&#20204;&#25552;&#20132;&#34920;&#21333;&#20165;&#20165;&#38656;&#35201;&#33719;&#21462;&#25968;&#25454;&#26102;&#23601;&#21487;&#20197;&#29992;GET&#65307; &#32780;&#24403;&#25105;&#20204;&#25552;&#20132;&#34920;&#21333;&#26102;&#38656;&#35201;&#26356;&#25913;&#26381;&#21153;&#22120;&#25968;&#25454;&#30340;&#29366;&#24577;&#65292;&#25110;&#32773;&#35828;&#21457;&#36865;e-mail&#65292;&#25110;&#32773;&#20854;&#20182;&#19981;&#20165;&#20165;&#26159;&#33719;&#21462;&#24182;&#26174;&#31034;&#25968;&#25454;&#30340;&#26102;&#20505;&#23601;&#20351;&#29992;POST&#12290; &#22312;&#36825;&#20010;&#25628;&#32034;&#20070;&#31821;&#30340;&#20363;&#23376;&#37324;&#65292;&#25105;&#20204;&#20351;&#29992;GET&#65292;&#22240;&#20026;&#36825;&#20010;&#26597;&#35810;&#19981;&#20250;&#26356;&#25913;&#26381;&#21153;&#22120;&#25968;&#25454;&#30340;&#29366;&#24577;&#12290; (&#22914;&#26524;&#20320;&#26377;&#20852;&#36259;&#20102;&#35299;&#26356;&#22810;&#20851;&#20110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt;&#30340;&#30693;&#35782;&#65292;&#21487;&#20197;&#21442;&#35265;&lt;a class=&quot;reference external&quot; href=&quot;http://www.w3.org/2001/tag/doc/whenToUseGet.html&quot;&gt;http://www.w3.org/2001/tag/doc/whenToUseGet.html&lt;/a&gt;&#12290;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&#26082;&#28982;&#24050;&#32463;&#30830;&#35748;&#29992;&#25143;&#25152;&#25552;&#20132;&#30340;&#25968;&#25454;&#26159;&#26377;&#25928;&#30340;&#65292;&#37027;&#20040;&#25509;&#19979;&#26469;&#23601;&#21487;&#20197;&#20174;&#25968;&#25454;&#24211;&#20013;&#26597;&#35810;&#36825;&#20010;&#26377;&#25928;&#30340;&#25968;&#25454;&#65288;&#21516;&#26679;&#65292;&#22312;views.py&#37324;&#25805;&#20316;&#65289;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn60&quot;&gt;from django.http import HttpResponse
from django.shortcuts import render_to_response
from mysite.books.models import Book

def search(request):
    if &apos;q&apos; in request.GET and request.GET[&apos;q&apos;]:
        q = request.GET[&apos;q&apos;]
        books = Book.objects.filter(title__icontains=q)
        return render_to_response(&apos;search_results.html&apos;,
            {&apos;books&apos;: books, &apos;query&apos;: q})
    else:
        return HttpResponse(&apos;Please submit a search term.&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&#35753;&#25105;&#20204;&#26469;&#20998;&#26512;&#19968;&#19979;&#19978;&#38754;&#30340;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#38500;&#20102;&#26816;&#26597;q&#26159;&#21542;&#23384;&#22312;&#20110;request.GET&#20043;&#22806;&#65292;&#25105;&#20204;&#36824;&#26816;&#26597;&#26469;reuqest.GET[&#8216;q&#8217;]&#30340;&#20540;&#26159;&#21542;&#20026;&#31354;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#25105;&#20204;&#20351;&#29992;Book.objects.filter(title__icontains=q)&#33719;&#21462;&#25968;&#25454;&#24211;&#20013;&#26631;&#39064;&#21253;&#21547;q&#30340;&#20070;&#31821;&#12290; icontains&#26159;&#19968;&#20010;&#26597;&#35810;&#20851;&#38190;&#23383;&#65288;&#21442;&#30475;&#31532;&#20116;&#31456;&#21644;&#38468;&#24405;B&#65289;&#12290;&#36825;&#20010;&#35821;&#21477;&#21487;&#20197;&#29702;&#35299;&#20026;&#33719;&#21462;&#26631;&#39064;&#37324;&#21253;&#21547;q&#30340;&#20070;&#31821;&#65292;&#19981;&#21306;&#20998;&#22823;&#23567;&#20889;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#36825;&#26159;&#23454;&#29616;&#20070;&#31821;&#26597;&#35810;&#30340;&#19968;&#20010;&#24456;&#31616;&#21333;&#30340;&#26041;&#27861;&#12290; &#25105;&#20204;&#19981;&#25512;&#33616;&#22312;&#19968;&#20010;&#21253;&#21547;&#22823;&#37327;&#20135;&#21697;&#30340;&#25968;&#25454;&#24211;&#20013;&#20351;&#29992;icontains&#26597;&#35810;&#65292;&#22240;&#20026;&#37027;&#20250;&#24456;&#24930;&#12290; &#65288;&#22312;&#30495;&#23454;&#30340;&#26696;&#20363;&#20013;&#65292;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992;&#20197;&#26576;&#31181;&#20998;&#31867;&#30340;&#33258;&#23450;&#20041;&#26597;&#35810;&#31995;&#32479;&#12290;
&#22312;&#32593;&#19978;&#25628;&#32034;&#8220;&#24320;&#28304; &#20840;&#25991;&#25628;&#32034;&#8221;&#30475;&#30475;&#26159;&#21542;&#26377;&#22909;&#30340;&#26041;&#27861;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#26368;&#21518;&#65292;&#25105;&#20204;&#32473;&#27169;&#26495;&#20256;&#36882;&#26469;books&#65292;&#19968;&#20010;&#21253;&#21547;Book&#23545;&#35937;&#30340;&#21015;&#34920;&#12290; &#26597;&#35810;&#32467;&#26524;&#30340;&#26174;&#31034;&#27169;&#26495;search_results.html&#22914;&#19979;&#25152;&#31034;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn67&quot;&gt;&amp;lt;p&amp;gt;You searched for: &amp;lt;strong&amp;gt;{{ query }}&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;

{% if books %}
    &amp;lt;p&amp;gt;Found {{ books|length }} book{{ books|pluralize }}.&amp;lt;/p&amp;gt;
    &amp;lt;ul&amp;gt;
        {% for book in books %}
        &amp;lt;li&amp;gt;{{ book.title }}&amp;lt;/li&amp;gt;
        {% endfor %}
    &amp;lt;/ul&amp;gt;
{% else %}
    &amp;lt;p&amp;gt;No books matched your search criteria.&amp;lt;/p&amp;gt;
{% endif %}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#27880;&#24847;&#36825;&#37324;pluralize&#30340;&#20351;&#29992;&#65292;&#36825;&#20010;&#36807;&#28388;&#22120;&#22312;&#36866;&#24403;&#30340;&#26102;&#20505;&#20250;&#36755;&#20986;s&#65288;&#20363;&#22914;&#25214;&#21040;&#22810;&#26412;&#20070;&#31821;&#65289;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn69&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#25913;&#36827;&#34920;&#21333;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#21516;&#19978;&#19968;&#31456;&#19968;&#26679;&#65292;&#25105;&#20204;&#20808;&#20174;&#26368;&#20026;&#31616;&#21333;&#12289;&#26377;&#25928;&#30340;&#20363;&#23376;&#24320;&#22987;&#12290; &#29616;&#22312;&#25105;&#20204;&#20877;&#26469;&#25214;&#20986;&#36825;&#20010;&#31616;&#21333;&#30340;&#20363;&#23376;&#20013;&#30340;&#19981;&#36275;&#65292;&#28982;&#21518;&#25913;&#36827;&#20182;&#20204;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#39318;&#20808;&#65292;search()&#35270;&#22270;&#23545;&#20110;&#31354;&#23383;&#31526;&#20018;&#30340;&#22788;&#29702;&#30456;&#24403;&#34180;&#24369;&#8212;&#8212;&#20165;&#26174;&#31034;&#19968;&#26465;&#8221;Please submit a search term.&#8221;&#30340;&#25552;&#31034;&#20449;&#24687;&#12290; &#33509;&#29992;&#25143;&#35201;&#37325;&#26032;&#22635;&#20889;&#34920;&#21333;&#24517;&#39035;&#33258;&#34892;&#28857;&#20987;&#8220;&#21518;&#36864;&#8221;&#25353;&#38062;&#65292; &#36825;&#31181;&#20570;&#27861;&#26082;&#31967;&#31957;&#21448;&#19981;&#19987;&#19994;&#12290;&#22914;&#26524;&#22312;&#29616;&#23454;&#30340;&#26696;&#20363;&#20013;&#65292;&#25105;&#20204;&#36825;&#26679;&#23376;&#32534;&#20889;&#65292;&#37027;&#20040;Django&#30340;&#20248;&#21183;&#23558;&#33633;&#28982;&#26080;&#23384;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&#22312;&#26816;&#27979;&#21040;&#31354;&#23383;&#31526;&#20018;&#26102;&#26356;&#22909;&#30340;&#35299;&#20915;&#26041;&#27861;&#26159;&#37325;&#26032;&#26174;&#31034;&#34920;&#21333;&#65292;&#24182;&#22312;&#34920;&#21333;&#19978;&#38754;&#32473;&#20986;&#38169;&#35823;&#25552;&#31034;&#20197;&#20415;&#29992;&#25143;&#31435;&#21051;&#37325;&#26032;&#22635;&#20889;&#12290; &#26368;&#31616;&#21333;&#30340;&#23454;&#29616;&#26041;&#27861;&#26082;&#26159;&#28155;&#21152;else&#20998;&#21477;&#37325;&#26032;&#26174;&#31034;&#34920;&#21333;&#65292;&#20195;&#30721;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn74&quot;&gt;from django.http import HttpResponse
from django.shortcuts import render_to_response
from mysite.books.models import Book

def search_form(request):
    return render_to_response(&apos;search_form.html&apos;)

def search(request):
    if &apos;q&apos; in request.GET and request.GET[&apos;q&apos;]:
        q = request.GET[&apos;q&apos;]
        books = Book.objects.filter(title__icontains=q)
        return render_to_response(&apos;search_results.html&apos;,
            {&apos;books&apos;: books, &apos;query&apos;: q})
    else:
        **return render_to_response(&apos;search_form.html&apos;, {&apos;error&apos;: True})**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#65288;&#27880;&#24847;&#65292;&#23558;search_form()&#35270;&#22270;&#20063;&#21253;&#21547;&#36827;&#26469;&#20197;&#20415;&#26597;&#30475;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#36825;&#27573;&#20195;&#30721;&#37324;&#65292;&#25105;&#20204;&#25913;&#36827;&#26469;search()&#35270;&#22270;&#65306;&#22312;&#23383;&#31526;&#20018;&#20026;&#31354;&#26102;&#37325;&#26032;&#26174;&#31034;search_form.html&#12290; &#24182;&#19988;&#32473;&#36825;&#20010;&#27169;&#26495;&#20256;&#36882;&#20102;&#19968;&#20010;&#21464;&#37327;error&#65292;&#35760;&#24405;&#30528;&#38169;&#35823;&#25552;&#31034;&#20449;&#24687;&#12290; &#29616;&#22312;&#25105;&#20204;&#32534;&#36753;&#19968;&#19979;search_form.html&#65292;&#26816;&#27979;&#21464;&#37327;error&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn78&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Search&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    **{% if error %}**
        **&amp;lt;p style=&quot;color: red;&quot;&amp;gt;Please submit a search term.&amp;lt;/p&amp;gt;**
    **{% endif %}**
    &amp;lt;form action=&quot;/search/&quot; method=&quot;get&quot;&amp;gt;
        &amp;lt;input type=&quot;text&quot; name=&quot;q&quot;&amp;gt;
        &amp;lt;input type=&quot;submit&quot; value=&quot;Search&quot;&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&#25105;&#20204;&#20462;&#25913;&#20102;search_form()&#35270;&#22270;&#25152;&#20351;&#29992;&#30340;&#27169;&#26495;&#65292;&#22240;&#20026;search_form()&#35270;&#22270;&#27809;&#26377;&#20256;&#36882;error&#21464;&#37327;&#65292;&#25152;&#20197;&#22312;&#26465;&#29992;search_form&#35270;&#22270;&#26102;&#19981;&#20250;&#26174;&#31034;&#38169;&#35823;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#36890;&#36807;&#19978;&#38754;&#30340;&#19968;&#20123;&#20462;&#25913;&#65292;&#29616;&#22312;&#31243;&#24207;&#21464;&#30340;&#22909;&#22810;&#20102;&#65292;&#20294;&#26159;&#29616;&#22312;&#20986;&#29616;&#19968;&#20010;&#38382;&#39064;&#65306; &#26159;&#21542;&#26377;&#24517;&#35201;&#19987;&#38376;&#32534;&#20889;search_form()&#26469;&#26174;&#31034;&#34920;&#21333;&#65311; &#25353;&#23454;&#38469;&#24773;&#20917;&#26469;&#35828;&#65292;&#24403;&#19968;&#20010;&#35831;&#27714;&#21457;&#36865;&#33267;/search/&#65288;&#26410;&#21253;&#21547;GET&#30340;&#25968;&#25454;&#65289;&#21518;&#23558;&#20250;&#26174;&#31034;&#19968;&#20010;&#31354;&#30340;&#34920;&#21333;&#65288;&#24102;&#26377;&#38169;&#35823;&#20449;&#24687;&#65289;&#12290; &#25152;&#20197;&#65292;&#21482;&#35201;&#25105;&#20204;&#25913;&#21464;search()&#35270;&#22270;&#65306;&#24403;&#29992;&#25143;&#35775;&#38382;/search/&#24182;&#26410;&#25552;&#20132;&#20219;&#20309;&#25968;&#25454;&#26102;&#23601;&#38544;&#34255;&#38169;&#35823;&#20449;&#24687;&#65292;&#36825;&#26679;&#23601;&#31227;&#21435;search_form()&#35270;&#22270;&#20197;&#21450;&#23545;&#24212;&#30340;URLpattern&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn82&quot;&gt;def search(request):
    error = False
    if &apos;q&apos; in request.GET:
        q = request.GET[&apos;q&apos;]
        if not q:
            error = True
        else:
            books = Book.objects.filter(title__icontains=q)
            return render_to_response(&apos;search_results.html&apos;,
                {&apos;books&apos;: books, &apos;query&apos;: q})
    return render_to_response(&apos;search_form.html&apos;,
        {&apos;error&apos;: error})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#22312;&#25913;&#36827;&#21518;&#30340;&#35270;&#22270;&#20013;&#65292;&#33509;&#29992;&#25143;&#35775;&#38382;/search/&#24182;&#19988;&#27809;&#26377;&#24102;&#26377;GET&#25968;&#25454;&#65292;&#37027;&#20040;&#20182;&#23558;&#30475;&#21040;&#19968;&#20010;&#27809;&#26377;&#38169;&#35823;&#20449;&#24687;&#30340;&#34920;&#21333;&#65307; &#22914;&#26524;&#29992;&#25143;&#25552;&#20132;&#20102;&#19968;&#20010;&#31354;&#34920;&#21333;&#65292;&#37027;&#20040;&#23427;&#23558;&#30475;&#21040;&#38169;&#35823;&#25552;&#31034;&#20449;&#24687;&#65292;&#36824;&#26377;&#34920;&#21333;&#65307; &#26368;&#21518;&#65292;&#33509;&#29992;&#25143;&#25552;&#20132;&#20102;&#19968;&#20010;&#38750;&#31354;&#30340;&#20540;&#65292;&#37027;&#20040;&#20182;&#23558;&#30475;&#21040;&#25628;&#32034;&#32467;&#26524;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#26368;&#21518;&#65292;&#25105;&#20204;&#20877;&#31245;&#24494;&#25913;&#36827;&#19968;&#19979;&#36825;&#20010;&#34920;&#21333;&#65292;&#21435;&#25481;&#20887;&#20313;&#30340;&#37096;&#20998;&#12290; &#26082;&#28982;&#24050;&#32463;&#23558;&#20004;&#20010;&#35270;&#22270;&#19982;URLs&#21512;&#24182;&#36215;&#26469;&#65292;/search/&#35270;&#22270;&#31649;&#29702;&#30528;&#34920;&#21333;&#30340;&#26174;&#31034;&#20197;&#21450;&#32467;&#26524;&#30340;&#26174;&#31034;&#65292;&#37027;&#20040;&#22312;search_form.html&#37324;&#34920;&#21333;&#30340;action&#20540;&#23601;&#27809;&#26377;&#24517;&#35201;&#30828;&#32534;&#30721;&#30340;&#25351;&#23450;URL&#12290; &#21407;&#20808;&#30340;&#20195;&#30721;&#26159;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn86&quot;&gt;&amp;lt;form action=&quot;/search/&quot; method=&quot;get&quot;&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#29616;&#22312;&#25913;&#25104;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn89&quot;&gt;&amp;lt;form action=&quot;&quot; method=&quot;get&quot;&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn90&quot;&gt;action=&#8221;&#8220;&#24847;&#21619;&#30528;&#34920;&#21333;&#23558;&#25552;&#20132;&#32473;&#19982;&#24403;&#21069;&#39029;&#38754;&#30456;&#21516;&#30340;URL&#12290; &#36825;&#26679;&#20462;&#25913;&#20043;&#21518;&#65292;&#22914;&#26524;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;search()&lt;/span&gt;&lt;/tt&gt;&#35270;&#22270;&#19981;&#25351;&#21521;&#20854;&#23427;&#39029;&#38754;&#30340;&#35805;&#65292;&#20320;&#23558;&#19981;&#24517;&#20877;&#20462;&#25913;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;action&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn91&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#31616;&#21333;&#30340;&#39564;&#35777;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#25105;&#20204;&#30340;&#25628;&#32034;&#31034;&#20363;&#20173;&#28982;&#30456;&#24403;&#22320;&#31616;&#21333;&#65292;&#29305;&#21035;&#20174;&#25968;&#25454;&#39564;&#35777;&#26041;&#38754;&#26469;&#35762;&#65307;&#25105;&#20204;&#20165;&#20165;&#21482;&#39564;&#35777;&#25628;&#32034;&#20851;&#38190;&#20540;&#26159;&#21542;&#20026;&#31354;&#12290; &#28982;&#21518;&#35768;&#22810;HTML&#34920;&#21333;&#21253;&#21547;&#30528;&#27604;&#26816;&#27979;&#20540;&#26159;&#21542;&#20026;&#31354;&#26356;&#20026;&#22797;&#26434;&#30340;&#39564;&#35777;&#12290; &#25105;&#20204;&#37117;&#26377;&#22312;&#32593;&#31449;&#19978;&#35265;&#36807;&#31867;&#20284;&#20197;&#19979;&#30340;&#38169;&#35823;&#25552;&#31034;&#20449;&#24687;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn93&quot;&gt;&#35831;&#36755;&#20837;&#19968;&#20010;&#26377;&#25928;&#30340;email&#22320;&#22336;&#65292; foo&#8217; &#24182;&#19981;&#26159;&#19968;&#20010;&#26377;&#25928;&#30340;e-mail&#22320;&#22336;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn94&quot;&gt;&#35831;&#36755;&#20837;5&#20301;&#25968;&#30340;U.S &#37038;&#25919;&#32534;&#30721;&#65292; 123&#24182;&#38750;&#26159;&#19968;&#20010;&#26377;&#25928;&#30340;&#37038;&#25919;&#32534;&#30721;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn95&quot;&gt;&#35831;&#36755;&#20837;YYYY-MM-DD&#26684;&#24335;&#30340;&#26085;&#26399;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn96&quot;&gt;&#35831;&#36755;&#20837;8&#20301;&#25968;&#20197;&#19978;&#24182;&#33267;&#23569;&#21253;&#21547;&#19968;&#20010;&#25968;&#23383;&#30340;&#23494;&#30721;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#20851;&#20110;JavaScript&#39564;&#35777;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#21487;&#20197;&#20351;&#29992;Javascript&#22312;&#23458;&#25143;&#31471;&#27983;&#35272;&#22120;&#37324;&#23545;&#25968;&#25454;&#36827;&#34892;&#39564;&#35777;&#65292;&#36825;&#20123;&#30693;&#35782;&#24050;&#36229;&#20986;&#26412;&#20070;&#33539;&#22260;&#12290; &#35201;&#27880;&#24847;&#65306; &#21363;&#20351;&#22312;&#23458;&#25143;&#31471;&#24050;&#32463;&#20570;&#20102;&#39564;&#35777;&#65292;&#20294;&#26159;&#26381;&#21153;&#22120;&#31471;&#20173;&#24517;&#39035;&#20877;&#39564;&#35777;&#19968;&#27425;&#12290; &#22240;&#20026;&#26377;&#20123;&#29992;&#25143;&#20250;&#23558;JavaScript&#20851;&#38381;&#25481;&#65292;&#24182;&#19988;&#36824;&#26377;&#19968;&#20123;&#24576;&#26377;&#24694;&#24847;&#30340;&#29992;&#25143;&#20250;&#23581;&#35797;&#25552;&#20132;&#38750;&#27861;&#30340;&#25968;&#25454;&#26469;&#25506;&#27979;&#26159;&#21542;&#26377;&#21487;&#20197;&#25915;&#20987;&#30340;&#26426;&#20250;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#38500;&#20102;&#22312;&#26381;&#21153;&#22120;&#31471;&#23545;&#29992;&#25143;&#25552;&#20132;&#30340;&#25968;&#25454;&#36827;&#34892;&#39564;&#35777;&#65288;&#20363;&#22914;&#22312;&#35270;&#22270;&#37324;&#39564;&#35777;&#65289;&#65292;&#25105;&#20204;&#27809;&#26377;&#20854;&#20182;&#21150;&#27861;&#12290; JavaScript&#39564;&#35777;&#21487;&#20197;&#30475;&#20316;&#26159;&#39069;&#22806;&#30340;&#21151;&#33021;&#65292;&#20294;&#19981;&#33021;&#20316;&#20026;&#21807;&#19968;&#30340;&#39564;&#35777;&#21151;&#33021;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#25105;&#20204;&#26469;&#35843;&#25972;&#19968;&#19979;search()&#35270;&#22270;&#65292;&#35753;&#22905;&#33021;&#22815;&#39564;&#35777;&#25628;&#32034;&#20851;&#38190;&#35789;&#26159;&#21542;&#23567;&#20110;&#25110;&#31561;&#20110;20&#20010;&#23383;&#31526;&#12290; &#65288;&#20026;&#26469;&#35753;&#20363;&#23376;&#26356;&#20026;&#26174;&#33879;&#65292;&#25105;&#20204;&#20551;&#35774;&#22914;&#26524;&#20851;&#38190;&#35789;&#36229;&#36807;20&#20010;&#23383;&#31526;&#23558;&#23548;&#33268;&#26597;&#35810;&#21313;&#20998;&#32531;&#24930;&#65289;&#12290;&#37027;&#20040;&#35813;&#22914;&#20309;&#23454;&#29616;&#21602;&#65311;
&#26368;&#31616;&#21333;&#30340;&#26041;&#24335;&#23601;&#26159;&#23558;&#36923;&#36753;&#22788;&#29702;&#30452;&#25509;&#23884;&#20837;&#21040;&#35270;&#22270;&#37324;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn102&quot;&gt;def search(request):
    error = False
    if &apos;q&apos; in request.GET:
        q = request.GET[&apos;q&apos;]
        if not q:
            error = True
        **elif len(q) &amp;gt; 20:**
            **error = True**
        else:
            books = Book.objects.filter(title__icontains=q)
            return render_to_response(&apos;search_results.html&apos;,
                {&apos;books&apos;: books, &apos;query&apos;: q})
    return render_to_response(&apos;search_form.html&apos;,
        {&apos;error&apos;: error})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#29616;&#22312;&#65292;&#22914;&#26524;&#23581;&#35797;&#30528;&#25552;&#20132;&#19968;&#20010;&#36229;&#36807;20&#20010;&#23383;&#31526;&#30340;&#25628;&#32034;&#20851;&#38190;&#35789;&#65292;&#31995;&#32479;&#19981;&#20250;&#25191;&#34892;&#25628;&#32034;&#25805;&#20316;&#65292;&#32780;&#26159;&#26174;&#31034;&#19968;&#26465;&#38169;&#35823;&#25552;&#31034;&#20449;&#24687;&#12290; &#20294;&#26159;&#65292;search_form.html&#37324;&#30340;&#36825;&#26465;&#25552;&#31034;&#20449;&#24687;&#26159;&#65306;&#8221;Please submit a search term.&#8221;&#65292;&#36825;&#26174;&#28982;&#26159;&#38169;&#35823;&#30340;&#65292; &#25152;&#20197;&#25105;&#20204;&#38656;&#35201;&#26356;&#31934;&#30830;&#30340;&#25552;&#31034;&#20449;&#24687;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn105&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Search&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    {% if error %}
        &amp;lt;p style=&quot;color: red;&quot;&amp;gt;Please submit a search term 20 characters or shorter.&amp;lt;/p&amp;gt;
    {% endif %}
    &amp;lt;form action=&quot;/search/&quot; method=&quot;get&quot;&amp;gt;
        &amp;lt;input type=&quot;text&quot; name=&quot;q&quot;&amp;gt;
        &amp;lt;input type=&quot;submit&quot; value=&quot;Search&quot;&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#20294;&#20687;&#36825;&#26679;&#20462;&#25913;&#20043;&#21518;&#20173;&#26377;&#19968;&#20123;&#38382;&#39064;&#12290; &#25105;&#20204;&#21253;&#21547;&#19975;&#35937;&#30340;&#25552;&#31034;&#20449;&#24687;&#24456;&#23481;&#26131;&#20351;&#20154;&#20135;&#29983;&#22256;&#24785;&#65306; &#25552;&#20132;&#19968;&#20010;&#31354;&#34920;&#21333;&#24590;&#20040;&#20250;&#20986;&#29616;&#19968;&#20010;&#20851;&#20110;20&#20010;&#23383;&#31526;&#38480;&#21046;&#30340;&#25552;&#31034;&#65311; &#25152;&#20197;&#65292;&#25552;&#31034;&#20449;&#24687;&#24517;&#39035;&#26159;&#35814;&#32454;&#30340;&#65292;&#26126;&#30830;&#30340;&#65292;&#19981;&#20250;&#20135;&#29983;&#30097;&#35758;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#38382;&#39064;&#30340;&#23454;&#36136;&#22312;&#20110;&#25105;&#20204;&#21482;&#20351;&#29992;&#26469;&#19968;&#20010;&#24067;&#23572;&#31867;&#22411;&#30340;&#21464;&#37327;&#26469;&#26816;&#27979;&#26159;&#21542;&#20986;&#38169;&#65292;&#32780;&#19981;&#26159;&#20351;&#29992;&#19968;&#20010;&#21015;&#34920;&#26469;&#35760;&#24405;&#30456;&#24212;&#30340;&#38169;&#35823;&#20449;&#24687;&#12290; &#25105;&#20204;&#38656;&#35201;&#20570;&#22914;&#19979;&#30340;&#35843;&#25972;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn109&quot;&gt;def search(request):
    **errors = []**
    if &apos;q&apos; in request.GET:
        q = request.GET[&apos;q&apos;]
        if not q:
            **errors.append(&apos;Enter a search term.&apos;)**
        elif len(q) &amp;gt; 20:
            **errors.append(&apos;Please enter at most 20 characters.&apos;)**
        else:
            books = Book.objects.filter(title__icontains=q)
            return render_to_response(&apos;search_results.html&apos;,
                {&apos;books&apos;: books, &apos;query&apos;: q})
    return render_to_response(&apos;search_form.html&apos;,
        {**&apos;errors&apos;: errors** })
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&#25509;&#30528;&#65292;&#25105;&#20204;&#35201;&#20462;&#25913;&#19968;&#19979;search_form.html&#27169;&#26495;&#65292;&#29616;&#22312;&#38656;&#35201;&#26174;&#31034;&#19968;&#20010;errors&#21015;&#34920;&#32780;&#19981;&#26159;&#19968;&#20010;&#24067;&#23572;&#21028;&#26029;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn112&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Search&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    **{% if errors %}**
        **&amp;lt;ul&amp;gt;**
            **{% for error in errors %}**
            **&amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;**
            **{% endfor %}**
        **&amp;lt;/ul&amp;gt;**
    **{% endif %}**
    &amp;lt;form action=&quot;/search/&quot; method=&quot;get&quot;&amp;gt;
        &amp;lt;input type=&quot;text&quot; name=&quot;q&quot;&amp;gt;
        &amp;lt;input type=&quot;submit&quot; value=&quot;Search&quot;&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;contact&quot;&gt;
&lt;span id=&quot;cn113&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#32534;&#20889;Contact&#34920;&#21333;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#34429;&#28982;&#25105;&#20204;&#19968;&#30452;&#20351;&#29992;&#20070;&#31821;&#25628;&#32034;&#30340;&#31034;&#20363;&#34920;&#21333;&#65292;&#24182;&#23558;&#36215;&#25913;&#36827;&#30340;&#24456;&#23436;&#32654;&#65292;&#20294;&#26159;&#36825;&#36824;&#26159;&#30456;&#24403;&#30340;&#31616;&#38475;&#65306; &#21482;&#21253;&#21547;&#19968;&#20010;&#23383;&#27573;&#65292;q&#12290;&#36825;&#31616;&#21333;&#30340;&#20363;&#23376;&#65292;&#25105;&#20204;&#19981;&#38656;&#35201;&#20351;&#29992;Django&#34920;&#21333;&#24211;&#26469;&#22788;&#29702;&#12290;
&#20294;&#26159;&#22797;&#26434;&#19968;&#28857;&#30340;&#34920;&#21333;&#23601;&#38656;&#35201;&#22810;&#26041;&#38754;&#30340;&#22788;&#29702;&#65292;&#25105;&#20204;&#29616;&#22312;&#26469;&#19968;&#19979;&#19968;&#20010;&#36739;&#20026;&#22797;&#26434;&#30340;&#20363;&#23376;&#65306; &#31449;&#28857;&#32852;&#31995;&#34920;&#21333;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#36825;&#20010;&#34920;&#21333;&#21253;&#25324;&#29992;&#25143;&#25552;&#20132;&#30340;&#21453;&#39304;&#20449;&#24687;&#65292;&#19968;&#20010;&#21487;&#36873;&#30340;e-mail&#22238;&#20449;&#22320;&#22336;&#12290; &#24403;&#36825;&#20010;&#34920;&#21333;&#25552;&#20132;&#24182;&#19988;&#25968;&#25454;&#36890;&#36807;&#39564;&#35777;&#21518;&#65292;&#31995;&#32479;&#23558;&#33258;&#21160;&#21457;&#36865;&#19968;&#23553;&#21253;&#21547;&#39064;&#29992;&#25143;&#25552;&#20132;&#30340;&#20449;&#24687;&#30340;e-mail&#32473;&#31449;&#28857;&#24037;&#20316;&#20154;&#21592;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn116&quot;&gt;&#25105;&#20204;&#20174;contact_form.html&#27169;&#26495;&#20837;&#25163;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn118&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Contact us&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Contact us&amp;lt;/h1&amp;gt;

    {% if errors %}
        &amp;lt;ul&amp;gt;
            {% for error in errors %}
            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;
            {% endfor %}
        &amp;lt;/ul&amp;gt;
    {% endif %}

    &amp;lt;form action=&quot;/contact/&quot; method=&quot;post&quot;&amp;gt;
        &amp;lt;p&amp;gt;Subject: &amp;lt;input type=&quot;text&quot; name=&quot;subject&quot;&amp;gt;&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;Your e-mail (optional): &amp;lt;input type=&quot;text&quot; name=&quot;email&quot;&amp;gt;&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;Message: &amp;lt;textarea name=&quot;message&quot; rows=&quot;10&quot; cols=&quot;50&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&amp;lt;/p&amp;gt;
        &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#25105;&#20204;&#23450;&#20041;&#20102;&#19977;&#20010;&#23383;&#27573;&#65306; &#20027;&#39064;&#65292;e-mail&#21644;&#21453;&#39304;&#20449;&#24687;&#12290; &#38500;&#20102;e-mail&#23383;&#27573;&#20026;&#21487;&#36873;&#65292;&#20854;&#20182;&#20004;&#20010;&#23383;&#27573;&#37117;&#26159;&#24517;&#22635;&#39033;&#12290; &#27880;&#24847;&#65292;&#36825;&#37324;&#25105;&#20204;&#20351;&#29992;method=&#8221;post&#8221;&#32780;&#38750;method=&#8221;get&#8221;&#65292;&#22240;&#20026;&#36825;&#20010;&#34920;&#21333;&#20250;&#26377;&#19968;&#20010;&#26381;&#21153;&#22120;&#31471;&#30340;&#25805;&#20316;&#65306;&#21457;&#36865;&#19968;&#23553;e-mail&#12290; &#24182;&#19988;&#65292;&#25105;&#20204;&#22797;&#21046;&#20102;&#21069;&#19968;&#20010;&#27169;&#26495;search_form.html&#20013;&#38169;&#35823;&#20449;&#24687;&#26174;&#31034;&#30340;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn120&quot;&gt;&#22914;&#26524;&#25105;&#20204;&#39034;&#30528;&#19978;&#19968;&#33410;&#32534;&#20889;search()&#35270;&#22270;&#30340;&#24605;&#36335;&#65292;&#37027;&#20040;&#19968;&#20010;contact()&#35270;&#22270;&#20195;&#30721;&#24212;&#35813;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn122&quot;&gt;from django.core.mail import send_mail
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response

def contact(request):
    errors = []
    if request.method == &apos;POST&apos;:
        if not request.POST.get(&apos;subject&apos;, &apos;&apos;):
            errors.append(&apos;Enter a subject.&apos;)
        if not request.POST.get(&apos;message&apos;, &apos;&apos;):
            errors.append(&apos;Enter a message.&apos;)
        if request.POST.get(&apos;email&apos;) and &apos;@&apos; not in request.POST[&apos;email&apos;]:
            errors.append(&apos;Enter a valid e-mail address.&apos;)
        if not errors:
            send_mail(
                request.POST[&apos;subject&apos;],
                request.POST[&apos;message&apos;],
                request.POST.get(&apos;email&apos;, &apos;noreply@example.com&apos;),
                [&apos;siteowner@example.com&apos;],
            )
            return HttpResponseRedirect(&apos;/contact/thanks/&apos;)
    return render_to_response(&apos;contact_form.html&apos;,
        {&apos;errors&apos;: errors})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&#65288;&#22914;&#26524;&#25353;&#29031;&#20070;&#20013;&#30340;&#31034;&#20363;&#20570;&#19979;&#26469;&#65292;&#36825;&#36825;&#37324;&#21487;&#33021;&#20046;&#20135;&#29983;&#19968;&#20010;&#30097;&#38382;&#65306;contact()&#35270;&#22270;&#26159;&#21542;&#35201;&#25918;&#22312;books/views.py&#36825;&#20010;&#25991;&#20214;&#37324;&#12290; &#20294;&#26159;contact()&#35270;&#22270;&#19982;books&#24212;&#29992;&#27809;&#26377;&#20219;&#20309;&#20851;&#32852;&#65292;&#37027;&#20040;&#36825;&#20010;&#35270;&#22270;&#24212;&#35813;&#21487;&#20197;&#25918;&#22312;&#21035;&#30340;&#22320;&#26041;&#65311; &#36825;&#27627;&#26080;&#32039;&#35201;&#65292;&#21482;&#35201;&#22312;URLconf&#37324;&#27491;&#30830;&#35774;&#32622;URL&#19982;&#35270;&#22270;&#20043;&#38388;&#30340;&#26144;&#23556;&#65292;Django&#20250;&#27491;&#30830;&#22788;&#29702;&#30340;&#12290; &#31508;&#32773;&#20010;&#20154;&#21916;&#27426;&#21019;&#24314;&#19968;&#20010;contact&#30340;&#25991;&#20214;&#22841;&#65292;&#19982;books&#25991;&#20214;&#22841;&#21516;&#32423;&#12290;&#36825;&#20010;&#25991;&#20214;&#22841;&#20013;&#21253;&#25324;&#31354;&#30340;__init__.py&#21644;views.py&#20004;&#20010;&#25991;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#29616;&#22312;&#26469;&#20998;&#26512;&#19968;&#19979;&#20197;&#19978;&#30340;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#30830;&#35748;request.method&#30340;&#20540;&#26159;&#8217;POST&#8217;&#12290;&#29992;&#25143;&#27983;&#35272;&#34920;&#21333;&#26102;&#36825;&#20010;&#20540;&#24182;&#19981;&#23384;&#22312;&#65292;&#24403;&#19988;&#20165;&#24403;&#34920;&#21333;&#34987;&#25552;&#20132;&#26102;&#36825;&#20010;&#20540;&#25165;&#20986;&#29616;&#12290; &#65288;&#22312;&#21518;&#38754;&#30340;&#20363;&#23376;&#20013;&#65292;request.method&#23558;&#20250;&#35774;&#32622;&#20026;&#8217;GET&#8217;&#65292;&#22240;&#20026;&#22312;&#26222;&#36890;&#30340;&#32593;&#39029;&#27983;&#35272;&#20013;&#65292;&#27983;&#35272;&#22120;&#37117;&#20351;&#29992;GET&#65292;&#32780;&#38750;POST&#65289;&#12290;&#21028;&#26029;request.method&#30340;&#20540;&#24456;&#22909;&#22320;&#24110;&#21161;&#25105;&#20204;&#23558;&#34920;&#21333;&#26174;&#31034;&#19982;&#34920;&#21333;&#22788;&#29702;&#38548;&#31163;&#24320;&#26469;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn126&quot;&gt;&#25105;&#20204;&#20351;&#29992;request.POST&#20195;&#26367;request.GET&#26469;&#33719;&#21462;&#25552;&#20132;&#36807;&#26469;&#30340;&#25968;&#25454;&#12290; &#36825;&#26159;&#24517;&#39035;&#30340;&#65292;&#22240;&#20026;contact_form.html&#37324;&#34920;&#21333;&#20351;&#29992;&#30340;&#26159;method=&#8221;post&#8221;&#12290;&#22914;&#26524;&#22312;&#35270;&#22270;&#37324;&#36890;&#36807;POST&#33719;&#21462;&#25968;&#25454;&#65292;&#37027;&#20040;request.GET&#23558;&#20026;&#31354;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&#36825;&#37324;&#65292;&#26377;&#20004;&#20010;&#24517;&#22635;&#39033;&#65292;subject &#21644; message&#65292;&#25152;&#20197;&#38656;&#35201;&#23545;&#36825;&#20004;&#20010;&#36827;&#34892;&#39564;&#35777;&#12290; &#27880;&#24847;&#65292;&#25105;&#20204;&#20351;&#29992;request.POST.get()&#26041;&#27861;&#65292;&#24182;&#25552;&#20379;&#19968;&#20010;&#31354;&#30340;&#23383;&#31526;&#20018;&#20316;&#20026;&#40664;&#35748;&#20540;&#65307;&#36825;&#20010;&#26041;&#27861;&#24456;&#22909;&#30340;&#35299;&#20915;&#20102;&#38190;&#20002;&#22833;&#19982;&#31354;&#25968;&#25454;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#34429;&#28982;email&#38750;&#24517;&#22635;&#39033;&#65292;&#20294;&#22914;&#26524;&#26377;&#25552;&#20132;&#22905;&#30340;&#20540;&#21017;&#25105;&#20204;&#20063;&#38656;&#36827;&#34892;&#39564;&#35777;&#12290; &#25105;&#20204;&#30340;&#39564;&#35777;&#31639;&#27861;&#30456;&#24403;&#30340;&#34180;&#24369;&#65292;&#20165;&#39564;&#35777;&#20540;&#26159;&#21542;&#21253;&#21547;@&#23383;&#31526;&#12290; &#22312;&#23454;&#38469;&#24212;&#29992;&#20013;&#65292;&#38656;&#35201;&#26356;&#20026;&#20581;&#22766;&#30340;&#39564;&#35777;&#26426;&#21046;&#65288;Django&#25552;&#20379;&#36825;&#20123;&#39564;&#35777;&#26426;&#21046;&#65292;&#31245;&#20505;&#25105;&#20204;&#23601;&#20250;&#30475;&#21040;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#25105;&#20204;&#20351;&#29992;&#20102;django.core.mail.send_mail&#20989;&#25968;&#26469;&#21457;&#36865;e-mail&#12290; &#36825;&#20010;&#20989;&#25968;&#26377;&#22235;&#20010;&#24517;&#36873;&#21442;&#25968;&#65306; &#20027;&#39064;&#65292;&#27491;&#25991;&#65292;&#23492;&#20449;&#20154;&#21644;&#25910;&#20214;&#20154;&#21015;&#34920;&#12290; send_mail&#26159;Django&#30340;EmailMessage&#31867;&#30340;&#19968;&#20010;&#26041;&#20415;&#30340;&#21253;&#35013;&#65292;EmailMessage&#31867;&#25552;&#20379;&#20102;&#26356;&#39640;&#32423;&#30340;&#26041;&#27861;&#65292;&#27604;&#22914;&#38468;&#20214;&#65292;&#22810;&#37096;&#20998;&#37038;&#20214;&#65292;&#20197;&#21450;&#23545;&#20110;&#37038;&#20214;&#22836;&#37096;&#30340;&#23436;&#25972;&#25511;&#21046;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#27880;&#24847;&#65292;&#33509;&#35201;&#20351;&#29992;send_mail()&#20989;&#25968;&#26469;&#21457;&#36865;&#37038;&#20214;&#65292;&#37027;&#20040;&#26381;&#21153;&#22120;&#38656;&#35201;&#37197;&#32622;&#25104;&#33021;&#22815;&#23545;&#22806;&#21457;&#36865;&#37038;&#20214;&#65292;&#24182;&#19988;&#22312;Django&#20013;&#35774;&#32622;&#20986;&#31449;&#26381;&#21153;&#22120;&#22320;&#22336;&#12290; &#21442;&#35265;&#35268;&#33539;&#65306;&lt;a class=&quot;reference external&quot; href=&quot;http://docs.djangoproject.com/en/dev/topics/email/&quot;&gt;http://docs.djangoproject.com/en/dev/topics/email/&lt;/a&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#24403;&#37038;&#20214;&#21457;&#36865;&#25104;&#21151;&#20043;&#21518;&#65292;&#25105;&#20204;&#20351;&#29992;HttpResponseRedirect&#23545;&#35937;&#23558;&#32593;&#39029;&#37325;&#23450;&#21521;&#33267;&#19968;&#20010;&#21253;&#21547;&#25104;&#21151;&#20449;&#24687;&#30340;&#39029;&#38754;&#12290; &#21253;&#21547;&#25104;&#21151;&#20449;&#24687;&#30340;&#39029;&#38754;&#36825;&#37324;&#30041;&#32473;&#35835;&#32773;&#21435;&#32534;&#20889;&#65288;&#24456;&#31616;&#21333; &#19968;&#20010;&#35270;&#22270;/URL&#26144;&#23556;/&#19968;&#20221;&#27169;&#26495;&#21363;&#21487;&#65289;&#65292;&#20294;&#26159;&#25105;&#20204;&#35201;&#35299;&#37322;&#19968;&#19979;&#20026;&#20309;&#37325;&#23450;&#21521;&#33267;&#26032;&#30340;&#39029;&#38754;&#65292;&#32780;&#19981;&#26159;&#22312;&#27169;&#26495;&#20013;&#30452;&#25509;&#35843;&#29992;render_to_response()&#26469;&#36755;&#20986;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&#21407;&#22240;&#23601;&#26159;&#65306; &#33509;&#29992;&#25143;&#21047;&#26032;&#19968;&#20010;&#21253;&#21547;POST&#34920;&#21333;&#30340;&#39029;&#38754;&#65292;&#37027;&#20040;&#35831;&#27714;&#23558;&#20250;&#37325;&#26032;&#21457;&#36865;&#36896;&#25104;&#37325;&#22797;&#12290; &#36825;&#36890;&#24120;&#20250;&#36896;&#25104;&#38750;&#26399;&#26395;&#30340;&#32467;&#26524;&#65292;&#27604;&#22914;&#35828;&#37325;&#22797;&#30340;&#25968;&#25454;&#24211;&#35760;&#24405;&#65307;&#22312;&#25105;&#20204;&#30340;&#20363;&#23376;&#20013;&#65292;&#23558;&#23548;&#33268;&#21457;&#36865;&#20004;&#23553;&#21516;&#26679;&#30340;&#37038;&#20214;&#12290; &#22914;&#26524;&#29992;&#25143;&#22312;POST&#34920;&#21333;&#20043;&#21518;&#34987;&#37325;&#23450;&#21521;&#33267;&#21478;&#22806;&#30340;&#39029;&#38754;&#65292;&#23601;&#19981;&#20250;&#36896;&#25104;&#37325;&#22797;&#30340;&#35831;&#27714;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#25105;&#20204;&#24212;&#27599;&#27425;&#37117;&#32473;&#25104;&#21151;&#30340;POST&#35831;&#27714;&#20570;&#37325;&#23450;&#21521;&#12290; &#36825;&#23601;&#26159;web&#24320;&#21457;&#30340;&#26368;&#20339;&#23454;&#36341;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn134&quot;&gt;contact()&#35270;&#22270;&#21487;&#20197;&#27491;&#24120;&#24037;&#20316;&#65292;&#20294;&#26159;&#22905;&#30340;&#39564;&#35777;&#21151;&#33021;&#26377;&#20123;&#22797;&#26434;&#12290; &#24819;&#35937;&#19968;&#19979;&#20551;&#22914;&#19968;&#20010;&#34920;&#21333;&#21253;&#21547;&#19968;&#25171;&#23383;&#27573;&#65292;&#25105;&#20204;&#30495;&#30340;&#23558;&#24517;&#39035;&#21435;&#32534;&#20889;&#27599;&#20010;&#22495;&#23545;&#24212;&#30340;if&#21028;&#26029;&#35821;&#21477;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#21478;&#22806;&#19968;&#20010;&#38382;&#39064;&#26159;&#34920;&#21333;&#30340;&#37325;&#26032;&#26174;&#31034;&#12290;&#33509;&#25968;&#25454;&#39564;&#35777;&#22833;&#36133;&#21518;&#65292;&#36820;&#22238;&#23458;&#25143;&#31471;&#30340;&#34920;&#21333;&#20013;&#21508;&#23383;&#27573;&#26368;&#22909;&#26159;&#22635;&#26377;&#21407;&#26469;&#25552;&#20132;&#30340;&#25968;&#25454;&#65292;&#20197;&#20415;&#29992;&#25143;&#26597;&#30475;&#21738;&#37324;&#20986;&#29616;&#38169;&#35823;&#65288;&#29992;&#25143;&#20063;&#19981;&#38656;&#20877;&#27425;&#22635;&#20889;&#27491;&#30830;&#30340;&#23383;&#27573;&#20540;&#65289;&#12290; &#25105;&#20204;&#21487;&#20197;&#25163;&#21160;&#22320;&#23558;&#21407;&#26469;&#30340;&#25552;&#20132;&#25968;&#25454;&#36820;&#22238;&#32473;&#27169;&#26495;&#65292;&#24182;&#19988;&#24517;&#39035;&#32534;&#36753;HTML&#37324;&#30340;&#21508;&#23383;&#27573;&#26469;&#22635;&#20805;&#21407;&#26469;&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn137&quot;&gt;# views.py

def contact(request):
    errors = []
    if request.method == &apos;POST&apos;:
        if not request.POST.get(&apos;subject&apos;, &apos;&apos;):
            errors.append(&apos;Enter a subject.&apos;)
        if not request.POST.get(&apos;message&apos;, &apos;&apos;):
            errors.append(&apos;Enter a message.&apos;)
        if request.POST.get(&apos;email&apos;) and &apos;@&apos; not in request.POST[&apos;email&apos;]:
            errors.append(&apos;Enter a valid e-mail address.&apos;)
        if not errors:
            send_mail(
                request.POST[&apos;subject&apos;],
                request.POST[&apos;message&apos;],
                request.POST.get(&apos;email&apos;, `&apos;noreply@example.com`_&apos;),
                [`&apos;siteowner@example.com`_&apos;],
            )
            return HttpResponseRedirect(&apos;/contact/thanks/&apos;)
    return render_to_response(&apos;contact_form.html&apos;, {
        &apos;errors&apos;: errors,
        **&apos;subject&apos;: request.POST.get(&apos;subject&apos;, &apos;&apos;),**
        **&apos;message&apos;: request.POST.get(&apos;message&apos;, &apos;&apos;),**
        **&apos;email&apos;: request.POST.get(&apos;email&apos;, &apos;&apos;),**
    })

# contact_form.html

&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Contact us&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Contact us&amp;lt;/h1&amp;gt;

    {% if errors %}
        &amp;lt;ul&amp;gt;
            {% for error in errors %}
            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;
            {% endfor %}
        &amp;lt;/ul&amp;gt;
    {% endif %}

    &amp;lt;form action=&quot;/contact/&quot; method=&quot;post&quot;&amp;gt;
        &amp;lt;p&amp;gt;Subject: &amp;lt;input type=&quot;text&quot; name=&quot;subject&quot; **value=&quot;{{ subject }}&quot;** &amp;gt;&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;Your e-mail (optional): &amp;lt;input type=&quot;text&quot; name=&quot;email&quot; **value=&quot;{{ email }}&quot;** &amp;gt;&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;Message: &amp;lt;textarea name=&quot;message&quot; rows=&quot;10&quot; cols=&quot;50&quot;&amp;gt;**{{ message }}**&amp;lt;/textarea&amp;gt;&amp;lt;/p&amp;gt;
        &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#36825;&#30475;&#36215;&#26469;&#26434;&#20081;&#65292;&#19988;&#20889;&#30340;&#26102;&#20505;&#23481;&#26131;&#20986;&#38169;&#12290; &#24076;&#26395;&#20320;&#24320;&#22987;&#26126;&#30333;&#20351;&#29992;&#39640;&#32423;&#24211;&#30340;&#29992;&#24847;&#8212;&#8212;&#36127;&#36131;&#22788;&#29702;&#34920;&#21333;&#21450;&#30456;&#20851;&#26657;&#39564;&#20219;&#21153;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;form&quot;&gt;
&lt;span id=&quot;cn139&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&#31532;&#19968;&#20010;Form&#31867;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn140&quot;&gt;Django&#24102;&#26377;&#19968;&#20010;form&#24211;&#65292;&#31216;&#20026;django.forms&#65292;&#36825;&#20010;&#24211;&#21487;&#20197;&#22788;&#29702;&#25105;&#20204;&#26412;&#31456;&#25152;&#25552;&#21040;&#30340;&#21253;&#25324;HTML&#34920;&#21333;&#26174;&#31034;&#20197;&#21450;&#39564;&#35777;&#12290; &#25509;&#19979;&#26469;&#25105;&#20204;&#26469;&#28145;&#20837;&#20102;&#35299;&#19968;&#19979;form&#24211;&#65292;&#24182;&#20351;&#29992;&#22905;&#26469;&#37325;&#20889;contact&#34920;&#21333;&#24212;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn141&quot;&gt;Django&#30340;newforms&#24211;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#22312;Django&#31038;&#21306;&#19978;&#20250;&#32463;&#24120;&#30475;&#21040;django.newforms&#36825;&#20010;&#35789;&#35821;&#12290;&#24403;&#20154;&#20204;&#35752;&#35770;django.newforms&#65292;&#20854;&#23454;&#23601;&#26159;&#25105;&#20204;&#26412;&#31456;&#37324;&#38754;&#20171;&#32461;&#30340;django.forms&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn143&quot;&gt;&#25913;&#21517;&#20854;&#23454;&#26377;&#21382;&#21490;&#21407;&#22240;&#30340;&#12290; &#24403;Django&#19968;&#27425;&#21521;&#20844;&#20247;&#21457;&#34892;&#26102;&#65292;&#23427;&#26377;&#19968;&#20010;&#22797;&#26434;&#38590;&#25026;&#30340;&#34920;&#21333;&#31995;&#32479;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.forms&lt;/span&gt;&lt;/tt&gt;&#12290;&#21518;&#26469;&#23427;&#34987;&#23436;&#20840;&#37325;&#20889;&#20102;&#65292;&#26032;&#30340;&#29256;&#26412;&#25913;&#21483;&#20316;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.newforms&lt;/span&gt;&lt;/tt&gt;&#65292;&#36825;&#26679;&#20154;&#20204;&#36824;&#21487;&#20197;&#36890;&#36807;&#21517;&#31216;&#65292;&#20351;&#29992;&#26087;&#29256;&#26412;&#12290; &#24403;Django 1.0&#21457;&#24067;&#26102;&#65292;&#26087;&#29256;&#26412;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.forms&lt;/span&gt;&lt;/tt&gt;&#23601;&#19981;&#20877;&#20351;&#29992;&#20102;&#65292;&#32780;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.newforms&lt;/span&gt;&lt;/tt&gt;&#20063;&#32456;&#20110;&#21487;&#20197;&#21517;&#27491;&#35328;&#39034;&#30340;&#21483;&#20570;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.forms&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn144&quot;&gt;&#34920;&#21333;&#26694;&#26550;&#26368;&#20027;&#35201;&#30340;&#29992;&#27861;&#26159;&#65292;&#20026;&#27599;&#19968;&#20010;&#23558;&#35201;&#22788;&#29702;&#30340;HTML&#30340;`` &amp;lt;Form&amp;gt;`` &#23450;&#20041;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#31867;&#12290;
&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#21482;&#26377;&#19968;&#20010;`` &amp;lt;Form&amp;gt;`` &#65292;&#22240;&#27492;&#25105;&#20204;&#21482;&#38656;&#23450;&#20041;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#31867;&#12290; &#36825;&#20010;&#31867;&#21487;&#20197;&#23384;&#22312;&#20110;&#20219;&#20309;&#22320;&#26041;&#65292;&#29978;&#33267;&#30452;&#25509;&#20889;&#22312;`` views.py`` &#25991;&#20214;&#37324;&#20063;&#34892;&#65292;&#20294;&#26159;&#31038;&#21306;&#30340;&#24815;&#20363;&#26159;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#31867;&#37117;&#25918;&#21040;&#19968;&#20010;&#25991;&#20214;&#20013;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forms.py&lt;/span&gt;&lt;/tt&gt;&#12290;&#22312;&#23384;&#25918;`` views.py`` &#30340;&#30446;&#24405;&#20013;&#65292;&#21019;&#24314;&#36825;&#20010;&#25991;&#20214;&#65292;&#28982;&#21518;&#36755;&#20837;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn146&quot;&gt;from django import forms

class ContactForm(forms.Form):
    subject = forms.CharField()
    email = forms.EmailField(required=False)
    message = forms.CharField()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn147&quot;&gt;&#36825;&#30475;&#19978;&#21435;&#31616;&#21333;&#26131;&#25026;&#65292;&#24182;&#19988;&#24456;&#20687;&#22312;&#27169;&#22359;&#20013;&#20351;&#29992;&#30340;&#35821;&#27861;&#12290; &#34920;&#21333;&#20013;&#30340;&#27599;&#19968;&#20010;&#23383;&#27573;&#65288;&#22495;&#65289;&#20316;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#31867;&#30340;&#23646;&#24615;&#65292;&#34987;&#23637;&#29616;&#25104;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Field&lt;/span&gt;&lt;/tt&gt;&#31867;&#12290;&#36825;&#37324;&#21482;&#29992;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CharField&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;EmailField&lt;/span&gt;&lt;/tt&gt;&#31867;&#22411;&#12290; &#27599;&#19968;&#20010;&#23383;&#27573;&#37117;&#40664;&#35748;&#26159;&#24517;&#22635;&#12290;&#35201;&#20351;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;email&lt;/span&gt;&lt;/tt&gt;&#25104;&#20026;&#21487;&#36873;&#39033;&#65292;&#25105;&#20204;&#38656;&#35201;&#25351;&#23450;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;required=False&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn148&quot;&gt;&#35753;&#25105;&#20204;&#38075;&#30740;&#21040;Python&#35299;&#37322;&#22120;&#37324;&#38754;&#30475;&#30475;&#36825;&#20010;&#31867;&#20570;&#20102;&#20123;&#20160;&#20040;&#12290; &#23427;&#20570;&#30340;&#31532;&#19968;&#20214;&#20107;&#26159;&#23558;&#33258;&#24049;&#26174;&#31034;&#25104;HTML&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn150&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from contact.forms import ContactForm
&amp;gt;&amp;gt;&amp;gt; f = ContactForm()
&amp;gt;&amp;gt;&amp;gt; print f
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;&amp;lt;label for=&quot;id_subject&quot;&amp;gt;Subject:&amp;lt;/label&amp;gt;&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt;&amp;lt;input type=&quot;text&quot; name=&quot;subject&quot; id=&quot;id_subject&quot; /&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;&amp;lt;label for=&quot;id_email&quot;&amp;gt;Email:&amp;lt;/label&amp;gt;&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt;&amp;lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;id_email&quot; /&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;&amp;lt;label for=&quot;id_message&quot;&amp;gt;Message:&amp;lt;/label&amp;gt;&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt;&amp;lt;input type=&quot;text&quot; name=&quot;message&quot; id=&quot;id_message&quot; /&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn151&quot;&gt;&#20026;&#20102;&#20415;&#20110;&#35775;&#38382;&#65292;Django&#29992;`` &amp;lt;label&amp;gt;`` &#26631;&#24535;&#65292;&#20026;&#27599;&#19968;&#20010;&#23383;&#27573;&#28155;&#21152;&#20102;&#26631;&#31614;&#12290; &#36825;&#20010;&#20570;&#27861;&#20351;&#40664;&#35748;&#34892;&#20026;&#23613;&#21487;&#33021;&#21512;&#36866;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn152&quot;&gt;&#40664;&#35748;&#36755;&#20986;&#25353;&#29031;HTML&#30340;&amp;lt;`` table`` &amp;gt;&#26684;&#24335;&#65292;&#21478;&#22806;&#26377;&#19968;&#20123;&#20854;&#23427;&#26684;&#24335;&#30340;&#36755;&#20986;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn154&quot;&gt;&amp;gt;&amp;gt;&amp;gt; print f.as_ul()
&amp;lt;li&amp;gt;&amp;lt;label for=&quot;id_subject&quot;&amp;gt;Subject:&amp;lt;/label&amp;gt; &amp;lt;input type=&quot;text&quot; name=&quot;subject&quot; id=&quot;id_subject&quot; /&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;label for=&quot;id_email&quot;&amp;gt;Email:&amp;lt;/label&amp;gt; &amp;lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;id_email&quot; /&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;label for=&quot;id_message&quot;&amp;gt;Message:&amp;lt;/label&amp;gt; &amp;lt;input type=&quot;text&quot; name=&quot;message&quot; id=&quot;id_message&quot; /&amp;gt;&amp;lt;/li&amp;gt;
&amp;gt;&amp;gt;&amp;gt; print f.as_p()
&amp;lt;p&amp;gt;&amp;lt;label for=&quot;id_subject&quot;&amp;gt;Subject:&amp;lt;/label&amp;gt; &amp;lt;input type=&quot;text&quot; name=&quot;subject&quot; id=&quot;id_subject&quot; /&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;label for=&quot;id_email&quot;&amp;gt;Email:&amp;lt;/label&amp;gt; &amp;lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;id_email&quot; /&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;label for=&quot;id_message&quot;&amp;gt;Message:&amp;lt;/label&amp;gt; &amp;lt;input type=&quot;text&quot; name=&quot;message&quot; id=&quot;id_message&quot; /&amp;gt;&amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&#35831;&#27880;&#24847;&#65292;&#26631;&#31614;&amp;lt;table&amp;gt;&#12289;&amp;lt;ul&amp;gt;&#12289;&amp;lt;form&amp;gt;&#30340;&#24320;&#38381;&#21512;&#26631;&#35760;&#27809;&#26377;&#21253;&#21547;&#20110;&#36755;&#20986;&#24403;&#20013;&#65292;&#36825;&#26679;&#20320;&#23601;&#21487;&#20197;&#28155;&#21152;&#39069;&#22806;&#30340;&#34892;&#25110;&#32773;&#33258;&#23450;&#20041;&#26684;&#24335;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn156&quot;&gt;&#36825;&#20123;&#31867;&#26041;&#27861;&#21482;&#26159;&#19968;&#33324;&#24773;&#20917;&#19979;&#29992;&#20110;&#24555;&#25463;&#26174;&#31034;&#23436;&#25972;&#34920;&#21333;&#30340;&#26041;&#27861;&#12290; &#20320;&#21516;&#26679;&#21487;&#20197;&#29992;HTML&#26174;&#31034;&#20010;&#21035;&#23383;&#27573;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn158&quot;&gt;&amp;gt;&amp;gt;&amp;gt; print f[&apos;subject&apos;]
&amp;lt;input type=&quot;text&quot; name=&quot;subject&quot; id=&quot;id_subject&quot; /&amp;gt;
&amp;gt;&amp;gt;&amp;gt; print f[&apos;message&apos;]
&amp;lt;input type=&quot;text&quot; name=&quot;message&quot; id=&quot;id_message&quot; /&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#20570;&#30340;&#31532;&#20108;&#20214;&#20107;&#26159;&#26657;&#39564;&#25968;&#25454;&#12290; &#20026;&#20102;&#26657;&#39564;&#25968;&#25454;&#65292;&#25105;&#20204;&#21019;&#24314;&#19968;&#20010;&#26032;&#30340;&#23545;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#35937;&#65292;&#24182;&#19988;&#20256;&#20837;&#19968;&#20010;&#19982;&#23450;&#20041;&#21305;&#37197;&#30340;&#23383;&#20856;&#31867;&#22411;&#25968;&#25454;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn161&quot;&gt;&amp;gt;&amp;gt;&amp;gt; f = ContactForm({&apos;subject&apos;: &apos;Hello&apos;, &apos;email&apos;: &apos;adrian@example.com&apos;, &apos;message&apos;: &apos;Nice site!&apos;})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#19968;&#26086;&#20320;&#23545;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#23454;&#20307;&#36171;&#20540;&#65292;&#20320;&#23601;&#24471;&#21040;&#20102;&#19968;&#20010;&#32465;&#23450;form&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn164&quot;&gt;&amp;gt;&amp;gt;&amp;gt; f.is_bound
True
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&#35843;&#29992;&#20219;&#20309;&#32465;&#23450;form&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;is_valid()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#65292;&#23601;&#21487;&#20197;&#30693;&#36947;&#23427;&#30340;&#25968;&#25454;&#26159;&#21542;&#21512;&#27861;&#12290; &#25105;&#20204;&#24050;&#32463;&#20026;&#27599;&#20010;&#23383;&#27573;&#20256;&#20837;&#20102;&#20540;&#65292;&#22240;&#27492;&#25972;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#26159;&#21512;&#27861;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn167&quot;&gt;&amp;gt;&amp;gt;&amp;gt; f.is_valid()
True
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&#22914;&#26524;&#25105;&#20204;&#19981;&#20256;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;email&lt;/span&gt;&lt;/tt&gt;&#20540;&#65292;&#23427;&#20381;&#28982;&#26159;&#21512;&#27861;&#30340;&#12290;&#22240;&#20026;&#25105;&#20204;&#25351;&#23450;&#36825;&#20010;&#23383;&#27573;&#30340;&#23646;&#24615;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;required=False&lt;/span&gt;&lt;/tt&gt;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn170&quot;&gt;&amp;gt;&amp;gt;&amp;gt; f = ContactForm({&apos;subject&apos;: &apos;Hello&apos;, &apos;message&apos;: &apos;Nice site!&apos;})
&amp;gt;&amp;gt;&amp;gt; f.is_valid()
True
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn171&quot;&gt;&#20294;&#26159;&#65292;&#22914;&#26524;&#30041;&#31354;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;subject&lt;/span&gt;&lt;/tt&gt;&#25110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;message&lt;/span&gt;&lt;/tt&gt;&#65292;&#25972;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#23601;&#19981;&#20877;&#21512;&#27861;&#20102;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn173&quot;&gt;&amp;gt;&amp;gt;&amp;gt; f = ContactForm({&apos;subject&apos;: &apos;Hello&apos;})
&amp;gt;&amp;gt;&amp;gt; f.is_valid()
False
&amp;gt;&amp;gt;&amp;gt; f = ContactForm({&apos;subject&apos;: &apos;Hello&apos;, &apos;message&apos;: &apos;&apos;})
&amp;gt;&amp;gt;&amp;gt; f.is_valid()
False
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#20320;&#21487;&#20197;&#36880;&#19968;&#26597;&#30475;&#27599;&#20010;&#23383;&#27573;&#30340;&#20986;&#38169;&#28040;&#24687;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn176&quot;&gt;&amp;gt;&amp;gt;&amp;gt; f = ContactForm({&apos;subject&apos;: &apos;Hello&apos;, &apos;message&apos;: &apos;&apos;})
&amp;gt;&amp;gt;&amp;gt; f[&apos;message&apos;].errors
[u&apos;This field is required.&apos;]
&amp;gt;&amp;gt;&amp;gt; f[&apos;subject&apos;].errors
[]
&amp;gt;&amp;gt;&amp;gt; f[&apos;email&apos;].errors
[]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn177&quot;&gt;&#27599;&#19968;&#20010;&#37030;&#23450;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#23454;&#20307;&#37117;&#26377;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;errors&lt;/span&gt;&lt;/tt&gt;&#23646;&#24615;&#65292;&#23427;&#20026;&#20320;&#25552;&#20379;&#20102;&#19968;&#20010;&#23383;&#27573;&#19982;&#38169;&#35823;&#28040;&#24687;&#30456;&#26144;&#23556;&#30340;&#23383;&#20856;&#34920;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn179&quot;&gt;&amp;gt;&amp;gt;&amp;gt; f = ContactForm({&apos;subject&apos;: &apos;Hello&apos;, &apos;message&apos;: &apos;&apos;})
&amp;gt;&amp;gt;&amp;gt; f.errors
{&apos;message&apos;: [u&apos;This field is required.&apos;]}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;&#26368;&#32456;&#65292;&#22914;&#26524;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#23454;&#20307;&#30340;&#25968;&#25454;&#26159;&#21512;&#27861;&#30340;&#65292;&#23427;&#23601;&#20250;&#26377;&#19968;&#20010;&#21487;&#29992;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cleaned_data&lt;/span&gt;&lt;/tt&gt;&#23646;&#24615;&#12290; &#36825;&#26159;&#19968;&#20010;&#21253;&#21547;&#24178;&#20928;&#30340;&#25552;&#20132;&#25968;&#25454;&#30340;&#23383;&#20856;&#12290; Django&#30340;form&#26694;&#26550;&#19981;&#20294;&#26657;&#39564;&#25968;&#25454;&#65292;&#23427;&#36824;&#20250;&#25226;&#23427;&#20204;&#36716;&#25442;&#25104;&#30456;&#24212;&#30340;Python&#31867;&#22411;&#25968;&#25454;&#65292;&#36825;&#21483;&#20570;&#28165;&#29702;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn182&quot;&gt;&amp;gt;&amp;gt;&amp;gt; f = ContactForm({subject&apos;: Hello, email: adrian@example.com, message: Nice site!})
&amp;gt;&amp;gt;&amp;gt; f.is_valid()
True
&amp;gt;&amp;gt;&amp;gt; f.cleaned_data
{message&apos;: uNice site!, email: uadrian@example.com, subject: uHello}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn183&quot;&gt;&#25105;&#20204;&#30340;contact form&#21482;&#28041;&#21450;&#23383;&#31526;&#20018;&#31867;&#22411;&#65292;&#23427;&#20204;&#20250;&#34987;&#28165;&#29702;&#25104;Unicode&#23545;&#35937;&#12290;&#22914;&#26524;&#25105;&#20204;&#20351;&#29992;&#25972;&#25968;&#22411;&#25110;&#26085;&#26399;&#22411;&#65292;form&#26694;&#26550;&#20250;&#30830;&#20445;&#26041;&#27861;&#20351;&#29992;&#21512;&#36866;&#30340;Python&#25972;&#25968;&#22411;&#25110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime.date&lt;/span&gt;&lt;/tt&gt;&#22411;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn184&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn184&quot;&gt;&#22312;&#35270;&#22270;&#20013;&#20351;&#29992;Form&#23545;&#35937;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#22312;&#23398;&#20064;&#20102;&#20851;&#20110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#31867;&#30340;&#22522;&#26412;&#30693;&#35782;&#21518;&#65292;&#20320;&#20250;&#30475;&#21040;&#25105;&#20204;&#22914;&#20309;&#25226;&#23427;&#29992;&#21040;&#35270;&#22270;&#20013;&#65292;&#21462;&#20195;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;contact()&lt;/span&gt;&lt;/tt&gt;&#20195;&#30721;&#20013;&#19981;&#25972;&#40784;&#30340;&#37096;&#20998;&#12290; &#19968;&#19979;&#31034;&#20363;&#35828;&#26126;&#20102;&#25105;&#20204;&#22914;&#20309;&#29992;forms&#26694;&#26550;&#37325;&#20889;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;contact()&lt;/span&gt;&lt;/tt&gt;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn187&quot;&gt;# views.py

from django.shortcuts import render_to_response
from mysite.contact.forms import ContactForm

def contact(request):
    if request.method == &apos;POST&apos;:
        form = ContactForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            send_mail(
                cd[&apos;subject&apos;],
                cd[&apos;message&apos;],
                cd.get(&apos;email&apos;, &apos;noreply@example.com&apos;),
                [&apos;siteowner@example.com&apos;],
            )
            return HttpResponseRedirect(&apos;/contact/thanks/&apos;)
    else:
        form = ContactForm()
    return render_to_response(&apos;contact_form.html&apos;, {&apos;form&apos;: form})

# contact_form.html

&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Contact us&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Contact us&amp;lt;/h1&amp;gt;

    {% if form.errors %}
        &amp;lt;p style=&quot;color: red;&quot;&amp;gt;
            Please correct the error{{ form.errors|pluralize }} below.
        &amp;lt;/p&amp;gt;
    {% endif %}

    &amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;
        &amp;lt;table&amp;gt;
            {{ form.as_table }}
        &amp;lt;/table&amp;gt;
        &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn188&quot;&gt;&#30475;&#30475;&#65292;&#25105;&#20204;&#33021;&#31227;&#38500;&#36825;&#20040;&#22810;&#19981;&#25972;&#40784;&#30340;&#20195;&#30721;&#65281; Django&#30340;forms&#26694;&#26550;&#22788;&#29702;HTML&#26174;&#31034;&#12289;&#25968;&#25454;&#26657;&#39564;&#12289;&#25968;&#25454;&#28165;&#29702;&#21644;&#34920;&#21333;&#38169;&#35823;&#37325;&#29616;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn189&quot;&gt;&#23581;&#35797;&#22312;&#26412;&#22320;&#36816;&#34892;&#12290; &#35013;&#36733;&#34920;&#21333;&#65292;&#20808;&#30041;&#31354;&#25152;&#26377;&#23383;&#27573;&#25552;&#20132;&#31354;&#34920;&#21333;&#65307;&#32487;&#32780;&#22635;&#20889;&#19968;&#20010;&#38169;&#35823;&#30340;&#37038;&#31665;&#22320;&#22336;&#20877;&#23581;&#35797;&#25552;&#20132;&#34920;&#21333;&#65307;&#26368;&#21518;&#20877;&#29992;&#27491;&#30830;&#25968;&#25454;&#25552;&#20132;&#34920;&#21333;&#12290; &#65288;&#26681;&#25454;&#26381;&#21153;&#22120;&#30340;&#35774;&#32622;&#65292;&#24403;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;send_mail()&lt;/span&gt;&lt;/tt&gt;&#34987;&#35843;&#29992;&#26102;&#65292;&#20320;&#23558;&#24471;&#21040;&#19968;&#20010;&#38169;&#35823;&#25552;&#31034;&#12290;&#32780;&#36825;&#26159;&#21478;&#19968;&#20010;&#38382;&#39064;&#12290;&#65289;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn190&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&#25913;&#21464;&#23383;&#27573;&#26174;&#31034;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn191&quot;&gt;&#20320;&#21487;&#33021;&#39318;&#20808;&#27880;&#24847;&#21040;&#65306;&#24403;&#20320;&#22312;&#26412;&#22320;&#26174;&#31034;&#36825;&#20010;&#34920;&#21333;&#30340;&#26102;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;message&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#34987;&#26174;&#31034;&#25104;`` input type=&#8221;text&#8221;`` &#65292;&#32780;&#23427;&#24212;&#35813;&#34987;&#26174;&#31034;&#25104;&amp;lt;`` textarea`` &amp;gt;&#12290;&#25105;&#20204;&#21487;&#20197;&#36890;&#36807;&#35774;&#32622;* widget* &#26469;&#20462;&#25913;&#23427;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn193&quot;&gt;from django import forms

class ContactForm(forms.Form):
    subject = forms.CharField()
    email = forms.EmailField(required=False)
    message = forms.CharField(**widget=forms.Textarea** )
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn194&quot;&gt;forms&#26694;&#26550;&#25226;&#27599;&#19968;&#20010;&#23383;&#27573;&#30340;&#26174;&#31034;&#36923;&#36753;&#20998;&#31163;&#21040;&#19968;&#32452;&#37096;&#20214;&#65288;widget&#65289;&#20013;&#12290; &#27599;&#19968;&#20010;&#23383;&#27573;&#31867;&#22411;&#37117;&#25317;&#26377;&#19968;&#20010;&#40664;&#35748;&#30340;&#37096;&#20214;&#65292;&#25105;&#20204;&#20063;&#21487;&#20197;&#23481;&#26131;&#22320;&#26367;&#25442;&#25481;&#40664;&#35748;&#30340;&#37096;&#20214;&#65292;&#25110;&#32773;&#25552;&#20379;&#19968;&#20010;&#33258;&#23450;&#20041;&#30340;&#37096;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn195&quot;&gt;&#32771;&#34385;&#19968;&#19979;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Field&lt;/span&gt;&lt;/tt&gt;&#31867;&#34920;&#29616;* &#26657;&#39564;&#36923;&#36753;* &#65292;&#32780;&#37096;&#20214;&#34920;&#29616;* &#26174;&#31034;&#36923;&#36753;* &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn196&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn196&quot;&gt;&#35774;&#32622;&#26368;&#22823;&#38271;&#24230;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&#19968;&#20010;&#26368;&#32463;&#24120;&#20351;&#29992;&#30340;&#26657;&#39564;&#35201;&#27714;&#26159;&#26816;&#26597;&#23383;&#27573;&#38271;&#24230;&#12290; &#21478;&#22806;&#65292;&#25105;&#20204;&#24212;&#35813;&#25913;&#36827;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ContactForm&lt;/span&gt;&lt;/tt&gt;&#65292;&#20351;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;subject&lt;/span&gt;&lt;/tt&gt;&#38480;&#21046;&#22312;100&#20010;&#23383;&#31526;&#20197;&#20869;&#12290; &#20026;&#27492;&#65292;&#20165;&#38656;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CharField&lt;/span&gt;&lt;/tt&gt;&#25552;&#20379;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;max_length&lt;/span&gt;&lt;/tt&gt;&#21442;&#25968;&#65292;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn199&quot;&gt;from django import forms

class ContactForm(forms.Form):
    subject = forms.CharField(**max_length=100** )
    email = forms.EmailField(required=False)
    message = forms.CharField(widget=forms.Textarea)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&#36873;&#39033;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;min_length&lt;/span&gt;&lt;/tt&gt;&#21442;&#25968;&#21516;&#26679;&#21487;&#29992;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn201&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn201&quot;&gt;&#35774;&#32622;&#21021;&#22987;&#20540;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn202&quot;&gt;&#35753;&#25105;&#20204;&#20877;&#25913;&#36827;&#19968;&#19979;&#36825;&#20010;&#34920;&#21333;&#65306;&#20026;&#23383;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;subject&lt;/span&gt;&lt;/tt&gt;&#27573;&#28155;&#21152;* &#21021;&#22987;&#20540;* &#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;I&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;love&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;your&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;site!&quot;&lt;/span&gt;&lt;/tt&gt; &#65288;&#19968;&#28857;&#24314;&#35758;&#65292;&#20294;&#27809;&#22351;&#22788;&#12290;&#65289;&#20026;&#27492;&#65292;&#25105;&#20204;&#21487;&#20197;&#22312;&#21019;&#24314;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Form&lt;/span&gt;&lt;/tt&gt;&#23454;&#20307;&#26102;&#65292;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;initial&lt;/span&gt;&lt;/tt&gt;&#21442;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn204&quot;&gt;def contact(request):
    if request.method == &apos;POST&apos;:
        form = ContactForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            send_mail(
                cd[&apos;subject&apos;],
                cd[&apos;message&apos;],
                cd.get(&apos;email&apos;, `&apos;noreply@example.com`_&apos;),
                [`&apos;siteowner@example.com`_&apos;],
            )
            return HttpResponseRedirect(&apos;/contact/thanks/&apos;)
    else:
        form = ContactForm(
            **initial={&apos;subject&apos;: &apos;I love your site!&apos;}**
        )
    return render_to_response(&apos;contact_form.html&apos;, {&apos;form&apos;: form})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn205&quot;&gt;&#29616;&#22312;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;subject&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#23558;&#34987;&#37027;&#20010;&#21477;&#23376;&#22635;&#20805;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn206&quot;&gt;&#35831;&#27880;&#24847;&#65292;&#20256;&#20837;* &#21021;&#22987;&#20540;* &#25968;&#25454;&#21644;&#20256;&#20837;&#25968;&#25454;&#20197;* &#32465;&#23450;* &#34920;&#21333;&#26159;&#26377;&#21306;&#21035;&#30340;&#12290; &#26368;&#22823;&#30340;&#21306;&#21035;&#26159;&#65292;&#22914;&#26524;&#20165;&#20256;&#20837;* &#21021;&#22987;&#20540;* &#25968;&#25454;&#65292;&#34920;&#21333;&#26159;&lt;em&gt;unbound&lt;/em&gt;&#30340;&#65292;&#37027;&#24847;&#21619;&#30528;&#23427;&#27809;&#26377;&#38169;&#35823;&#28040;&#24687;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn207&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn207&quot;&gt;&#33258;&#23450;&#20041;&#26657;&#39564;&#35268;&#21017;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn208&quot;&gt;&#20551;&#35774;&#25105;&#20204;&#24050;&#32463;&#21457;&#24067;&#20102;&#21453;&#39304;&#39029;&#38754;&#20102;&#65292;email&#24050;&#32463;&#24320;&#22987;&#28304;&#28304;&#19981;&#26029;&#22320;&#28044;&#20837;&#20102;&#12290; &#36825;&#37324;&#26377;&#19968;&#20010;&#38382;&#39064;&#65306; &#19968;&#20123;&#25552;&#20132;&#30340;&#28040;&#24687;&#21482;&#26377;&#19968;&#20004;&#20010;&#23383;&#65292;&#25105;&#20204;&#26080;&#27861;&#24471;&#30693;&#35814;&#32454;&#30340;&#20449;&#24687;&#12290; &#25152;&#20197;&#25105;&#20204;&#20915;&#23450;&#22686;&#21152;&#19968;&#26465;&#26032;&#30340;&#26657;&#39564;&#65306; &#26469;&#28857;&#19987;&#19994;&#31934;&#31070;&#65292;&#26368;&#36215;&#30721;&#20889;&#22235;&#20010;&#23383;&#65292;&#25308;&#25176;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&#25105;&#20204;&#26377;&#24456;&#22810;&#30340;&#26041;&#27861;&#25226;&#25105;&#20204;&#30340;&#33258;&#23450;&#20041;&#26657;&#39564;&#25346;&#22312;Django&#30340;form&#19978;&#12290; &#22914;&#26524;&#25105;&#20204;&#30340;&#35268;&#21017;&#20250;&#34987;&#19968;&#27425;&#21448;&#19968;&#27425;&#30340;&#20351;&#29992;&#65292;&#25105;&#20204;&#21487;&#20197;&#21019;&#24314;&#19968;&#20010;&#33258;&#23450;&#20041;&#30340;&#23383;&#27573;&#31867;&#22411;&#12290; &#22823;&#22810;&#25968;&#30340;&#33258;&#23450;&#20041;&#26657;&#39564;&#37117;&#26159;&#19968;&#27425;&#24615;&#30340;&#65292;&#21487;&#20197;&#30452;&#25509;&#32465;&#23450;&#21040;form&#31867;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&#25105;&#20204;&#24076;&#26395;`` message`` &#23383;&#27573;&#26377;&#19968;&#20010;&#39069;&#22806;&#30340;&#26657;&#39564;&#65292;&#25105;&#20204;&#22686;&#21152;&#19968;&#20010;`` clean_message()`` &#26041;&#27861;&#21040;`` Form`` &#31867;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn212&quot;&gt;from django import forms

class ContactForm(forms.Form):
    subject = forms.CharField(max_length=100)
    email = forms.EmailField(required=False)
    message = forms.CharField(widget=forms.Textarea)

    def clean_message(self):
        message = self.cleaned_data[&apos;message&apos;]
        num_words = len(message.split())
        if num_words &amp;lt; 4:
            raise forms.ValidationError(&quot;Not enough words!&quot;)
        return message
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn213&quot;&gt;Django&#30340;form&#31995;&#32479;&#33258;&#21160;&#23547;&#25214;&#21305;&#37197;&#30340;&#20989;&#25968;&#26041;&#27861;&#65292;&#35813;&#26041;&#27861;&#21517;&#31216;&#20197;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;clean_&lt;/span&gt;&lt;/tt&gt;&#24320;&#22836;&#65292;&#24182;&#20197;&#23383;&#27573;&#21517;&#31216;&#32467;&#26463;&#12290; &#22914;&#26524;&#26377;&#36825;&#26679;&#30340;&#26041;&#27861;&#65292;&#23427;&#23558;&#22312;&#26657;&#39564;&#26102;&#34987;&#35843;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn214&quot;&gt;&#29305;&#21035;&#22320;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;clean_message()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#23558;&#22312;&#25351;&#23450;&#23383;&#27573;&#30340;&#40664;&#35748;&#26657;&#39564;&#36923;&#36753;&#25191;&#34892;* &#20043;&#21518;* &#34987;&#35843;&#29992;&#12290;&#65288;&#26412;&#20363;&#20013;&#65292;&#22312;&#24517;&#22635;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CharField&lt;/span&gt;&lt;/tt&gt;&#36825;&#20010;&#26657;&#39564;&#36923;&#36753;&#20043;&#21518;&#12290;&#65289;&#22240;&#20026;&#23383;&#27573;&#25968;&#25454;&#24050;&#32463;&#34987;&#37096;&#20998;&#22788;&#29702;&#65292;&#25152;&#20197;&#23427;&#34987;&#20174;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;self.cleaned_data&lt;/span&gt;&lt;/tt&gt;&#20013;&#25552;&#21462;&#20986;&#26469;&#20102;&#12290;&#21516;&#26679;&#65292;&#25105;&#20204;&#19981;&#24517;&#25285;&#24515;&#25968;&#25454;&#26159;&#21542;&#20026;&#31354;&#65292;&#22240;&#20026;&#23427;&#24050;&#32463;&#34987;&#26657;&#39564;&#36807;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn215&quot;&gt;&#25105;&#20204;&#31616;&#21333;&#22320;&#20351;&#29992;&#20102;len()&#21644;split()&#30340;&#32452;&#21512;&#26469;&#35745;&#31639;&#21333;&#35789;&#30340;&#25968;&#37327;&#12290; &#22914;&#26524;&#29992;&#25143;&#36755;&#20837;&#23383;&#25968;&#19981;&#36275;&#65292;&#25105;&#20204;&#25243;&#20986;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;forms.ValidationError&lt;/span&gt;&lt;/tt&gt;&#22411;&#24322;&#24120;&#12290;&#36825;&#20010;&#24322;&#24120;&#30340;&#25551;&#36848;&#20250;&#34987;&#20316;&#20026;&#38169;&#35823;&#21015;&#34920;&#20013;&#30340;&#19968;&#39033;&#26174;&#31034;&#32473;&#29992;&#25143;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn216&quot;&gt;&#22312;&#20989;&#25968;&#30340;&#26411;&#23614;&#26174;&#24335;&#22320;&#36820;&#22238;&#23383;&#27573;&#30340;&#20540;&#38750;&#24120;&#37325;&#35201;&#12290; &#25105;&#20204;&#21487;&#20197;&#22312;&#25105;&#20204;&#33258;&#23450;&#20041;&#30340;&#26657;&#39564;&#26041;&#27861;&#20013;&#20462;&#25913;&#23427;&#30340;&#20540;&#65288;&#25110;&#32773;&#25226;&#23427;&#36716;&#25442;&#25104;&#21478;&#19968;&#31181;Python&#31867;&#22411;&#65289;&#12290; &#22914;&#26524;&#25105;&#20204;&#24536;&#35760;&#20102;&#36825;&#19968;&#27493;&#65292;None&#20540;&#23601;&#20250;&#36820;&#22238;&#65292;&#21407;&#22987;&#30340;&#25968;&#25454;&#23601;&#20002;&#22833;&#25481;&#20102;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn217&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&#25351;&#23450;&#26631;&#31614;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn218&quot;&gt;HTML&#34920;&#21333;&#20013;&#33258;&#21160;&#29983;&#25104;&#30340;&#26631;&#31614;&#40664;&#35748;&#26159;&#25353;&#29031;&#35268;&#21017;&#29983;&#25104;&#30340;&#65306;&#29992;&#31354;&#26684;&#20195;&#26367;&#19979;&#21010;&#32447;&#65292;&#39318;&#23383;&#27597;&#22823;&#20889;&#12290;&#22914;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;email&lt;/span&gt;&lt;/tt&gt;&#30340;&#26631;&#31614;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;Email&quot;&lt;/span&gt;&lt;/tt&gt; &#12290;&#65288;&#22909;&#20687;&#22312;&#21738;&#21548;&#21040;&#36807;&#65311; &#26159;&#30340;&#65292;&#21516;&#26679;&#30340;&#36923;&#36753;&#34987;&#29992;&#20110;&#27169;&#22359;&#65288;model&#65289;&#20013;&#23383;&#27573;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_name&lt;/span&gt;&lt;/tt&gt;&#20540;&#12290; &#25105;&#20204;&#22312;&#31532;&#20116;&#31456;&#35848;&#21040;&#36807;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn219&quot;&gt;&#20687;&#22312;&#27169;&#22359;&#20013;&#20570;&#36807;&#30340;&#37027;&#26679;&#65292;&#25105;&#20204;&#21516;&#26679;&#21487;&#20197;&#33258;&#23450;&#20041;&#23383;&#27573;&#30340;&#26631;&#31614;&#12290; &#20165;&#38656;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;label&lt;/span&gt;&lt;/tt&gt;&#65292;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn221&quot;&gt;class ContactForm(forms.Form):
    subject = forms.CharField(max_length=100)
    email = forms.EmailField(required=False, **label=&apos;Your e-mail address&apos;** )
    message = forms.CharField(widget=forms.Textarea)
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn222&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn222&quot;&gt;&#23450;&#21046;Form&#35774;&#35745;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn223&quot;&gt;&#22312;&#19978;&#38754;&#30340;`` contact_form.html`` &#27169;&#26495;&#20013;&#25105;&#20204;&#20351;&#29992;`` {{form.as_table}}`` &#26174;&#31034;&#34920;&#21333;&#65292;&#19981;&#36807;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992;&#20854;&#20182;&#26356;&#31934;&#30830;&#25511;&#21046;&#34920;&#21333;&#26174;&#31034;&#30340;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn224&quot;&gt;&#20462;&#25913;form&#30340;&#26174;&#31034;&#30340;&#26368;&#24555;&#25463;&#30340;&#26041;&#24335;&#26159;&#20351;&#29992;CSS&#12290; &#23588;&#20854;&#26159;&#38169;&#35823;&#21015;&#34920;&#65292;&#21487;&#20197;&#22686;&#24378;&#35270;&#35273;&#25928;&#26524;&#12290;&#33258;&#21160;&#29983;&#25104;&#30340;&#38169;&#35823;&#21015;&#34920;&#31934;&#30830;&#30340;&#20351;&#29992;`` &amp;lt;ul class=&#8221;errorlist&#8221;&amp;gt;``&#65292;&#36825;&#26679;&#65292;&#25105;&#20204;&#23601;&#21487;&#20197;&#38024;&#23545;&#23427;&#20204;&#20351;&#29992;CSS&#12290; &#19979;&#38754;&#30340;CSS&#35753;&#38169;&#35823;&#26356;&#21152;&#37266;&#30446;&#20102;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn226&quot;&gt;&amp;lt;style type=&quot;text/css&quot;&amp;gt;
    ul.errorlist {
        margin: 0;
        padding: 0;
    }
    .errorlist li {
        background-color: red;
        color: white;
        display: block;
        font-size: 10px;
        margin: 0 0 3px;
        padding: 4px 5px;
    }
&amp;lt;/style&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn227&quot;&gt;&#34429;&#28982;&#65292;&#33258;&#21160;&#29983;&#25104;HTML&#26159;&#24456;&#26041;&#20415;&#30340;&#65292;&#20294;&#26159;&#22312;&#26576;&#20123;&#26102;&#20505;&#65292;&#20320;&#20250;&#24819;&#35206;&#30422;&#40664;&#35748;&#30340;&#26174;&#31034;&#12290; {{form.as_table}}&#21644;&#20854;&#23427;&#30340;&#26041;&#27861;&#22312;&#24320;&#21457;&#30340;&#26102;&#20505;&#26159;&#19968;&#20010;&#24555;&#25463;&#30340;&#26041;&#24335;&#65292;form&#30340;&#26174;&#31034;&#26041;&#24335;&#20063;&#21487;&#20197;&#22312;form&#20013;&#34987;&#26041;&#20415;&#22320;&#37325;&#20889;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn228&quot;&gt;&#27599;&#19968;&#20010;&#23383;&#27573;&#37096;&#20214;(&amp;lt;input type=&#8221;text&#8221;&amp;gt;, &amp;lt;select&amp;gt;, &amp;lt;textarea&amp;gt;, &#25110;&#32773;&#31867;&#20284;)&#37117;&#21487;&#20197;&#36890;&#36807;&#35775;&#38382;{{form.&#23383;&#27573;&#21517;}}&#36827;&#34892;&#21333;&#29420;&#30340;&#28210;&#26579;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn230&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Contact us&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Contact us&amp;lt;/h1&amp;gt;

    {% if form.errors %}
        &amp;lt;p style=&quot;color: red;&quot;&amp;gt;
            Please correct the error{{ form.errors|pluralize }} below.
        &amp;lt;/p&amp;gt;
    {% endif %}

    &amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;
        &amp;lt;div class=&quot;field&quot;&amp;gt;
            {{ form.subject.errors }}
            &amp;lt;label for=&quot;id_subject&quot;&amp;gt;Subject:&amp;lt;/label&amp;gt;
            {{ form.subject }}
        &amp;lt;/div&amp;gt;
        &amp;lt;div class=&quot;field&quot;&amp;gt;
            {{ form.email.errors }}
            &amp;lt;label for=&quot;id_email&quot;&amp;gt;Your e-mail address:&amp;lt;/label&amp;gt;
            {{ form.email }}
        &amp;lt;/div&amp;gt;
        &amp;lt;div class=&quot;field&quot;&amp;gt;
            {{ form.message.errors }}
            &amp;lt;label for=&quot;id_message&quot;&amp;gt;Message:&amp;lt;/label&amp;gt;
            {{ form.message }}
        &amp;lt;/div&amp;gt;
        &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn231&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;form.message.errors&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#20250;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;class=&quot;errorlist&quot;&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#37324;&#38754;&#26174;&#31034;&#65292;&#22914;&#26524;&#23383;&#27573;&#26159;&#21512;&#27861;&#30340;&#65292;&#25110;&#32773;form&#27809;&#26377;&#34987;&#32465;&#23450;&#65292;&#23601;&#26174;&#31034;&#19968;&#20010;&#31354;&#23383;&#31526;&#20018;&#12290; &#25105;&#20204;&#36824;&#21487;&#20197;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;form.message.errors&lt;/span&gt;&lt;/tt&gt; &#24403;&#20316;&#19968;&#20010;&#24067;&#23572;&#20540;&#25110;&#32773;&#24403;&#23427;&#26159;list&#22312;&#19978;&#38754;&#20570;&#36845;&#20195;&#65292; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn233&quot;&gt;&amp;lt;div class=&quot;field{% if form.message.errors %} errors{% endif %}&quot;&amp;gt;
    {% if form.message.errors %}
        &amp;lt;ul&amp;gt;
        {% for error in form.message.errors %}
            &amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;{{ error }}&amp;lt;/strong&amp;gt;&amp;lt;/li&amp;gt;
        {% endfor %}
        &amp;lt;/ul&amp;gt;
    {% endif %}
    &amp;lt;label for=&quot;id_message&quot;&amp;gt;Message:&amp;lt;/label&amp;gt;
    {{ form.message }}
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn234&quot;&gt;&#22312;&#26657;&#39564;&#22833;&#36133;&#30340;&#24773;&#20917;&#19979;, &#36825;&#27573;&#20195;&#30721;&#20250;&#22312;&#21253;&#21547;&#38169;&#35823;&#23383;&#27573;&#30340;div&#30340;class&#23646;&#24615;&#20013;&#22686;&#21152;&#19968;&#20010;&#8221;errors&#8221;&#65292;&#22312;&#19968;&#20010;&#26377;&#24207;&#21015;&#34920;&#20013;&#26174;&#31034;&#38169;&#35823;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn235&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn235&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn236&quot;&gt;&#36825;&#19968;&#31456;&#24635;&#32467;&#20102;&#26412;&#20070;&#30340;&#20171;&#32461;&#26448;&#26009;&#65292;&#21363;&#25152;&#35859;&#8220;&#26680;&#24515;&#25945;&#31243;&#8221;&#12290; &#21518;&#38754;&#37096;&#20998;&#65292;&#20174;&#31532;&#20843;&#31456;&#21040;&#31532;&#21313;&#20108;&#31456;&#65292;&#23558;&#35814;&#32454;&#35762;&#36848;&#39640;&#32423;&#65288;&#36827;&#38454;&#65289;&#20351;&#29992;&#65292;&#21253;&#25324;&#22914;&#20309;&#37197;&#32622;&#19968;&#20010;Django&#24212;&#29992;&#31243;&#24207;&#65288;&#31532;&#21313;&#20108;&#31456;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn237&quot;&gt;&#22312;&#23398;&#20064;&#26412;&#20070;&#30340;&#21069;&#38754;&#19971;&#31456;&#21518;&#65292;&#25105;&#20204;&#32456;&#20110;&#23545;&#20110;&#20351;&#29992;Django&#26500;&#24314;&#33258;&#24049;&#30340;&#32593;&#31449;&#24050;&#32463;&#30693;&#36947;&#30340;&#22815;&#22810;&#20102;&#65292; &#26412;&#20070;&#20013;&#21097;&#20313;&#30340;&#26448;&#26009;&#23558;&#22312;&#20320;&#38656;&#35201;&#30340;&#26102;&#20505;&#24110;&#21161;&#20320;&#34917;&#36951;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn238&quot;&gt;&#31532;&#20843;&#31456;&#25105;&#20204;&#23558;&#22238;&#22836;&#12289;&#24182;&#28145;&#20837;&#22320;&#35762;&#35299; &#35270;&#22270;&#21644;URLconfs&#65288;&#31532;&#19977;&#31456;&#24050;&#31616;&#21333;&#20171;&#32461;&#65289;&#12290;&lt;/p&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;Document License`_.&lt;/dt&gt;
&lt;dd&gt;&lt;p class=&quot;first last cn&quot; id=&quot;cn239&quot;&gt;Hosting graciously provided by&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter08</id>
        <title type="html">chapter08</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter08"/>
        <published>2015-02-26T23:26:07+08:00</published>
        <updated>2015-02-26T23:26:07+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;url&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#20843;&#31456;&#65306;&#39640;&#32423;&#35270;&#22270;&#21644;URL&#37197;&#32622;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#22312;&#31532;&#19977;&#31456;&#65292;&#25105;&#20204;&#24050;&#32463;&#23545;&#22522;&#26412;&#30340;Django&#35270;&#22270;&#21644;URL&#37197;&#32622;&#20570;&#20102;&#20171;&#32461;&#12290; &#22312;&#36825;&#19968;&#31456;&#65292;&#23558;&#36827;&#19968;&#27493;&#35828;&#26126;&#26694;&#26550;&#20013;&#36825;&#20004;&#20010;&#37096;&#20998;&#30340;&#39640;&#32423;&#26426;&#33021;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;urlconf&quot;&gt;
&lt;span id=&quot;cn2&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn2&quot;&gt;URLconf &#25216;&#24039;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;URLconf&#27809;&#20160;&#20040;&#29305;&#21035;&#30340;&#65292;&#23601;&#35937; Django &#20013;&#20854;&#23427;&#19996;&#35199;&#19968;&#26679;&#65292;&#23427;&#20204;&#21482;&#26159; Python &#20195;&#30721;&#12290; &#20320;&#21487;&#20197;&#22312;&#20960;&#26041;&#38754;&#20174;&#20013;&#24471;&#21040;&#22909;&#22788;&#65292;&#27491;&#22914;&#19979;&#38754;&#25152;&#25551;&#36848;&#30340;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;streamlining&quot;&gt;
&lt;span id=&quot;cn4&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#27969;&#32447;&#22411;&#21270;(Streamlining)&#20989;&#25968;&#23548;&#20837;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&#30475;&#19979;&#36825;&#20010; URLconf&#65292;&#23427;&#26159;&#24314;&#31435;&#22312;&#31532;&#19977;&#31456;&#30340;&#20363;&#23376;&#19978;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn7&quot;&gt;from django.conf.urls.defaults import *
from mysite.views import hello, current_datetime, hours_ahead

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^hello/$&apos;, hello),
    (r&apos;^time/$&apos;, current_datetime),
    (r&apos;^time/plus/(\d{1,2})/$&apos;, hours_ahead),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#27491;&#22914;&#31532;&#19977;&#31456;&#20013;&#25152;&#35299;&#37322;&#30340;&#65292;&#22312; URLconf &#20013;&#30340;&#27599;&#19968;&#20010;&#20837;&#21475;&#21253;&#25324;&#20102;&#23427;&#25152;&#20851;&#32852;&#30340;&#35270;&#22270;&#20989;&#25968;&#65292;&#30452;&#25509;&#20256;&#20837;&#20102;&#19968;&#20010;&#20989;&#25968;&#23545;&#35937;&#12290; &#36825;&#23601;&#24847;&#21619;&#30528;&#38656;&#35201;&#22312;&#27169;&#22359;&#24320;&#22987;&#22788;&#23548;&#20837;&#35270;&#22270;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#20294;&#38543;&#30528; Django &#24212;&#29992;&#21464;&#24471;&#22797;&#26434;&#65292;&#23427;&#30340; URLconf &#20063;&#22312;&#22686;&#38271;&#65292;&#24182;&#19988;&#32500;&#25252;&#36825;&#20123;&#23548;&#20837;&#21487;&#33021;&#20351;&#24471;&#31649;&#29702;&#21464;&#40635;&#28902;&#12290; (&#23545;&#27599;&#20010;&#26032;&#30340;view&#20989;&#25968;&#65292;&#20320;&#19981;&#24471;&#19981;&#35760;&#20303;&#35201;&#23548;&#20837;&#23427;&#65292;&#24182;&#19988;&#37319;&#29992;&#36825;&#31181;&#26041;&#27861;&#20250;&#20351;&#23548;&#20837;&#35821;&#21477;&#23558;&#21464;&#24471;&#30456;&#24403;&#38271;&#12290;)&#21487;&#20197;&#36890;&#36807;&#23548;&#20837; views &#27169;&#22359;&#26412;&#36523;&#26469;&#36991;&#20813;&#36825;&#20010;&#40635;&#28902;&#12290; &#19979;&#38754;&#20363;&#23376;&#30340;URLconf&#19982;&#21069;&#19968;&#20010;&#31561;&#20215;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn11&quot;&gt;from django.conf.urls.defaults import *
**from mysite import views**

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^hello/$&apos;, **views.hello** ),
    (r&apos;^time/$&apos;, **views.current_datetime** ),
    (r&apos;^time/plus/(d{1,2})/$&apos;, **views.hours_ahead** ),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn12&quot;&gt;Django &#36824;&#25552;&#20379;&#20102;&#21478;&#19968;&#31181;&#26041;&#27861;&#21487;&#20197;&#22312; URLconf &#20013;&#20026;&#26576;&#20010;&#29305;&#21035;&#30340;&#27169;&#24335;&#25351;&#23450;&#35270;&#22270;&#20989;&#25968;&#65306; &#20320;&#21487;&#20197;&#20256;&#20837;&#19968;&#20010;&#21253;&#21547;&#27169;&#22359;&#21517;&#21644;&#20989;&#25968;&#21517;&#30340;&#23383;&#31526;&#20018;&#65292;&#32780;&#19981;&#26159;&#20989;&#25968;&#23545;&#35937;&#26412;&#36523;&#12290;
&#32487;&#32493;&#31034;&#20363;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn14&quot;&gt;from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^hello/$&apos;, **&apos;mysite.views.hello&apos;** ),
    (r&apos;^time/$&apos;, **&apos;mysite.views.current_datetime&apos;** ),
    (r&apos;^time/plus/(d{1,2})/$&apos;, **&apos;mysite.views.hours_ahead&apos;** ),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;(&#27880;&#24847;&#35270;&#22270;&#21517;&#21069;&#21518;&#30340;&#24341;&#21495;&#12290; &#24212;&#35813;&#20351;&#29992;&#24102;&#24341;&#21495;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;mysite.views.current_datetime&apos;&lt;/span&gt;&lt;/tt&gt; &#32780;&#19981;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.views.current_datetime&lt;/span&gt;&lt;/tt&gt; &#12290;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#20351;&#29992;&#36825;&#20010;&#25216;&#26415;&#65292;&#23601;&#19981;&#24517;&#23548;&#20837;&#35270;&#22270;&#20989;&#25968;&#20102;&#65307;Django &#20250;&#22312;&#31532;&#19968;&#27425;&#38656;&#35201;&#23427;&#26102;&#26681;&#25454;&#23383;&#31526;&#20018;&#25152;&#25551;&#36848;&#30340;&#35270;&#22270;&#20989;&#25968;&#30340;&#21517;&#23383;&#21644;&#36335;&#24452;&#65292;&#23548;&#20837;&#21512;&#36866;&#30340;&#35270;&#22270;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#24403;&#20351;&#29992;&#23383;&#31526;&#20018;&#25216;&#26415;&#26102;&#65292;&#20320;&#21487;&#20197;&#37319;&#29992;&#26356;&#31616;&#21270;&#30340;&#26041;&#24335;&#65306;&#25552;&#21462;&#20986;&#19968;&#20010;&#20844;&#20849;&#35270;&#22270;&#21069;&#32512;&#12290;
&#22312;&#25105;&#20204;&#30340;URLconf&#20363;&#23376;&#20013;&#65292;&#27599;&#20010;&#35270;&#22270;&#23383;&#31526;&#20018;&#30340;&#24320;&#22987;&#37096;&#20998;&#37117;&#26159;&lt;a href=&quot;#id1&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id2&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\&#65292;&#36896;&#25104;&#37325;&#22797;&#36755;&#20837;&#12290;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#25226;&#20844;&#20849;&#30340;&#21069;&#32512;&#25552;&#21462;&#20986;&#26469;&#65292;&#20316;&#20026;&#31532;&#19968;&#20010;&#21442;&#25968;&#20256;&#32473;\&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;``&lt;/span&gt;&lt;/tt&gt;&#20989;&#25968;&#65306;&lt;/p&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id1&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 99); &lt;em&gt;&lt;a href=&quot;#id2&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn17&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn19&quot;&gt;from django.conf.urls.defaults import *

urlpatterns = patterns(**&apos;mysite.views&apos;** ,
    (r&apos;^hello/$&apos;, **&apos;hello&apos;** ),
    (r&apos;^time/$&apos;, **&apos;current_datetime&apos;** ),
    (r&apos;^time/plus/(d{1,2})/$&apos;, **&apos;hours_ahead&apos;** ),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#27880;&#24847;&#26082;&#19981;&#35201;&#22312;&#21069;&#32512;&#21518;&#38754;&#36319;&#30528;&#19968;&#20010;&#28857;&#21495;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;/tt&gt; )&#65292;&#20063;&#19981;&#35201;&#22312;&#35270;&#22270;&#23383;&#31526;&#20018;&#21069;&#38754;&#25918;&#19968;&#20010;&#28857;&#21495;&#12290; Django &#20250;&#33258;&#21160;&#22788;&#29702;&#23427;&#20204;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#29282;&#35760;&#36825;&#20004;&#31181;&#26041;&#27861;&#65292;&#21738;&#31181;&#26356;&#22909;&#19968;&#20123;&#21602;&#65311; &#36825;&#21462;&#20915;&#20110;&#20320;&#30340;&#20010;&#20154;&#32534;&#30721;&#20064;&#24815;&#21644;&#38656;&#35201;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&#23383;&#31526;&#20018;&#26041;&#27861;&#30340;&#22909;&#22788;&#22914;&#19979;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn23&quot;&gt;&#26356;&#32039;&#20945;&#65292;&#22240;&#20026;&#19981;&#38656;&#35201;&#20320;&#23548;&#20837;&#35270;&#22270;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn24&quot;&gt;&#22914;&#26524;&#20320;&#30340;&#35270;&#22270;&#20989;&#25968;&#23384;&#22312;&#20110;&#20960;&#20010;&#19981;&#21516;&#30340; Python &#27169;&#22359;&#30340;&#35805;&#65292;&#23427;&#21487;&#20197;&#20351;&#24471; URLconf &#26356;&#26131;&#35835;&#21644;&#31649;&#29702;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#20989;&#25968;&#23545;&#35937;&#26041;&#27861;&#30340;&#22909;&#22788;&#22914;&#19979;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn26&quot;&gt;&#26356;&#23481;&#26131;&#23545;&#35270;&#22270;&#20989;&#25968;&#36827;&#34892;&#21253;&#35013;(wrap)&#12290; &#21442;&#35265;&#26412;&#31456;&#21518;&#38754;&#30340;&#12298;&#21253;&#35013;&#35270;&#22270;&#20989;&#25968;&#12299;&#19968;&#33410;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn27&quot;&gt;&#26356; Pythonic&#65292;&#23601;&#26159;&#35828;&#65292;&#26356;&#31526;&#21512; Python &#30340;&#20256;&#32479;&#65292;&#22914;&#25226;&#20989;&#25968;&#24403;&#25104;&#23545;&#35937;&#20256;&#36882;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&#20004;&#20010;&#26041;&#27861;&#37117;&#26159;&#26377;&#25928;&#30340;&#65292;&#29978;&#33267;&#20320;&#21487;&#20197;&#22312;&#21516;&#19968;&#20010; URLconf &#20013;&#28151;&#29992;&#23427;&#20204;&#12290; &#20915;&#23450;&#26435;&#22312;&#20320;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn29&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#20351;&#29992;&#22810;&#20010;&#35270;&#22270;&#21069;&#32512;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#22312;&#23454;&#36341;&#20013;&#65292;&#22914;&#26524;&#20320;&#20351;&#29992;&#23383;&#31526;&#20018;&#25216;&#26415;&#65292;&#29305;&#21035;&#26159;&#24403;&#20320;&#30340; URLconf &#20013;&#27809;&#26377;&#19968;&#20010;&#20844;&#20849;&#21069;&#32512;&#26102;&#65292;&#20320;&#26368;&#32456;&#21487;&#33021;&#28151;&#21512;&#35270;&#22270;&#12290; &#28982;&#32780;&#65292;&#20320;&#20173;&#28982;&#21487;&#20197;&#21033;&#29992;&#35270;&#22270;&#21069;&#32512;&#30340;&#31616;&#20415;&#26041;&#24335;&#26469;&#20943;&#23569;&#37325;&#22797;&#12290; &#21482;&#35201;&#22686;&#21152;&#22810;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;patterns()&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#35937;&#36825;&#26679;:&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#26087;&#30340;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn33&quot;&gt;from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^hello/$&apos;, &apos;mysite.views.hello&apos;),
    (r&apos;^time/$&apos;, &apos;mysite.views.current_datetime&apos;),
    (r&apos;^time/plus/(\d{1,2})/$&apos;, &apos;mysite.views.hours_ahead&apos;),
    (r&apos;^tag/(\w+)/$&apos;, &apos;weblog.views.tag&apos;),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#26032;&#30340;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn36&quot;&gt;from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;mysite.views&apos;,
    (r&apos;^hello/$&apos;, &apos;hello&apos;),
    (r&apos;^time/$&apos;, &apos;current_datetime&apos;),
    (r&apos;^time/plus/(\d{1,2})/$&apos;, &apos;hours_ahead&apos;),
)

urlpatterns += patterns(&apos;weblog.views&apos;,
    (r&apos;^tag/(\w+)/$&apos;, &apos;tag&apos;),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#25972;&#20010;&#26694;&#26550;&#20851;&#27880;&#30340;&#26159;&#23384;&#22312;&#19968;&#20010;&#21517;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urlpatterns&lt;/span&gt;&lt;/tt&gt; &#30340;&#27169;&#22359;&#32423;&#21035;&#30340;&#21464;&#37327;&#12290;&#22914;&#19978;&#20363;&#65292;&#36825;&#20010;&#21464;&#37327;&#21487;&#20197;&#21160;&#24577;&#29983;&#25104;&#12290; &#36825;&#37324;&#25105;&#20204;&#35201;&#29305;&#21035;&#35828;&#26126;&#19968;&#19979;&#65292;patterns()&#36820;&#22238;&#30340;&#23545;&#35937;&#26159;&#21487;&#30456;&#21152;&#30340;&#65292;&#36825;&#20010;&#29305;&#24615;&#21487;&#33021;&#26159;&#22823;&#23478;&#27809;&#26377;&#24819;&#21040;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn38&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#35843;&#35797;&#27169;&#24335;&#20013;&#30340;&#29305;&#20363;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&#35828;&#21040;&#21160;&#24577;&#26500;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;urlpatterns&lt;/span&gt;&lt;/tt&gt;&#65292;&#20320;&#21487;&#33021;&#24819;&#21033;&#29992;&#36825;&#19968;&#25216;&#26415;&#65292;&#22312; Django &#30340;&#35843;&#35797;&#27169;&#24335;&#19979;&#20462;&#25913; URLconf &#30340;&#34892;&#20026;&#12290; &#20026;&#20102;&#20570;&#21040;&#36825;&#19968;&#28857;&#65292;&#21482;&#35201;&#22312;&#36816;&#34892;&#26102;&#26816;&#26597; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#37197;&#32622;&#39033;&#30340;&#20540;&#21363;&#21487;&#65292;&#22914;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn41&quot;&gt;from django.conf import settings
from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^$&apos;, views.homepage),
    (r&apos;^(\d{4})/([a-z]{3})/$&apos;, views.archive_month),
)

if settings.DEBUG:
    urlpatterns += patterns(&apos;&apos;,
        (r&apos;^debuginfo/$&apos;, views.debug),
    )
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;URL&#38142;&#25509;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/debuginfo/&lt;/span&gt;&lt;/tt&gt; &#21482;&#22312;&#20320;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#37197;&#32622;&#39033;&#35774;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#26102;&#25165;&#26377;&#25928;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn43&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&#20351;&#29992;&#21629;&#21517;&#32452;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#22312;&#30446;&#21069;&#20026;&#27490;&#30340;&#25152;&#26377; URLconf &#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#20351;&#29992;&#31616;&#21333;&#30340;&lt;em&gt;&#26080;&#21629;&#21517;&lt;/em&gt; &#27491;&#21017;&#34920;&#36798;&#24335;&#32452;&#65292;&#21363;&#65292;&#22312;&#25105;&#20204;&#24819;&#35201;&#25429;&#33719;&#30340;URL&#37096;&#20998;&#19978;&#21152;&#19978;&#23567;&#25324;&#21495;&#65292;Django &#20250;&#23558;&#25429;&#33719;&#30340;&#25991;&#26412;&#20316;&#20026;&#20301;&#32622;&#21442;&#25968;&#20256;&#36882;&#32473;&#35270;&#22270;&#20989;&#25968;&#12290; &#22312;&#26356;&#39640;&#32423;&#30340;&#29992;&#27861;&#20013;&#65292;&#36824;&#21487;&#20197;&#20351;&#29992; &lt;em&gt;&#21629;&#21517;&lt;/em&gt; &#27491;&#21017;&#34920;&#36798;&#24335;&#32452;&#26469;&#25429;&#33719;URL&#65292;&#24182;&#19988;&#23558;&#20854;&#20316;&#20026; &lt;em&gt;&#20851;&#38190;&#23383;&lt;/em&gt; &#21442;&#25968;&#20256;&#32473;&#35270;&#22270;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#20851;&#38190;&#23383;&#21442;&#25968; &#23545;&#27604; &#20301;&#32622;&#21442;&#25968;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#19968;&#20010; Python &#20989;&#25968;&#21487;&#20197;&#20351;&#29992;&#20851;&#38190;&#23383;&#21442;&#25968;&#25110;&#20301;&#32622;&#21442;&#25968;&#26469;&#35843;&#29992;&#65292;&#22312;&#26576;&#20123;&#24773;&#20917;&#19979;&#65292;&#21487;&#20197;&#21516;&#26102;&#36827;&#34892;&#20351;&#29992;&#12290; &#22312;&#20851;&#38190;&#23383;&#21442;&#25968;&#35843;&#29992;&#20013;&#65292;&#20320;&#35201;&#25351;&#23450;&#21442;&#25968;&#30340;&#21517;&#23383;&#21644;&#20256;&#20837;&#30340;&#20540;&#12290; &#22312;&#20301;&#32622;&#21442;&#25968;&#35843;&#29992;&#20013;&#65292;&#20320;&#21482;&#38656;&#20256;&#20837;&#21442;&#25968;&#65292;&#19981;&#38656;&#35201;&#26126;&#30830;&#25351;&#26126;&#21738;&#20010;&#21442;&#25968;&#19982;&#21738;&#20010;&#20540;&#23545;&#24212;&#65292;&#23427;&#20204;&#30340;&#23545;&#24212;&#20851;&#31995;&#38544;&#21547;&#22312;&#21442;&#25968;&#30340;&#39034;&#24207;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#20363;&#22914;&#65292;&#32771;&#34385;&#36825;&#20010;&#31616;&#21333;&#30340;&#20989;&#25968;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn49&quot;&gt;def sell(item, price, quantity):
    print &quot;Selling %s unit(s) of %s at %s&quot; % (quantity, item, price)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#20026;&#20102;&#20351;&#29992;&#20301;&#32622;&#21442;&#25968;&#26469;&#35843;&#29992;&#23427;&#65292;&#20320;&#35201;&#25353;&#29031;&#22312;&#20989;&#25968;&#23450;&#20041;&#20013;&#30340;&#39034;&#24207;&#26469;&#25351;&#23450;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn52&quot;&gt;sell(&apos;Socks&apos;, &apos;$2.50&apos;, 6)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#20026;&#20102;&#20351;&#29992;&#20851;&#38190;&#23383;&#21442;&#25968;&#26469;&#35843;&#29992;&#23427;&#65292;&#20320;&#35201;&#25351;&#23450;&#21442;&#25968;&#21517;&#21644;&#20540;&#12290; &#19979;&#38754;&#30340;&#35821;&#21477;&#26159;&#31561;&#20215;&#30340;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn55&quot;&gt;sell(item=&apos;Socks&apos;, price=&apos;$2.50&apos;, quantity=6)
sell(item=&apos;Socks&apos;, quantity=6, price=&apos;$2.50&apos;)
sell(price=&apos;$2.50&apos;, item=&apos;Socks&apos;, quantity=6)
sell(price=&apos;$2.50&apos;, quantity=6, item=&apos;Socks&apos;)
sell(quantity=6, item=&apos;Socks&apos;, price=&apos;$2.50&apos;)
sell(quantity=6, price=&apos;$2.50&apos;, item=&apos;Socks&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#26368;&#21518;&#65292;&#20320;&#21487;&#20197;&#28151;&#21512;&#20851;&#38190;&#23383;&#21644;&#20301;&#32622;&#21442;&#25968;&#65292;&#21482;&#35201;&#25152;&#26377;&#30340;&#20301;&#32622;&#21442;&#25968;&#21015;&#22312;&#20851;&#38190;&#23383;&#21442;&#25968;&#20043;&#21069;&#12290; &#19979;&#38754;&#30340;&#35821;&#21477;&#19982;&#21069;&#38754;&#30340;&#20363;&#23376;&#26159;&#31561;&#20215;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn58&quot;&gt;sell(&apos;Socks&apos;, &apos;$2.50&apos;, quantity=6)
sell(&apos;Socks&apos;, price=&apos;$2.50&apos;, quantity=6)
sell(&apos;Socks&apos;, quantity=6, price=&apos;$2.50&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#22312; Python &#27491;&#21017;&#34920;&#36798;&#24335;&#20013;&#65292;&#21629;&#21517;&#30340;&#27491;&#21017;&#34920;&#36798;&#24335;&#32452;&#30340;&#35821;&#27861;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;(?P&amp;lt;name&amp;gt;pattern)&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#37324; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt; &#26159;&#32452;&#30340;&#21517;&#23383;&#65292;&#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pattern&lt;/span&gt;&lt;/tt&gt; &#26159;&#21305;&#37197;&#30340;&#26576;&#20010;&#27169;&#24335;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20010;&#20351;&#29992;&#26080;&#21517;&#32452;&#30340; URLconf &#30340;&#20363;&#23376;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn62&quot;&gt;from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^articles/(\d{4})/$&apos;, views.year_archive),
    (r&apos;^articles/(\d{4})/(\d{2})/$&apos;, views.month_archive),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#19979;&#38754;&#26159;&#30456;&#21516;&#30340; URLconf&#65292;&#20351;&#29992;&#21629;&#21517;&#32452;&#36827;&#34892;&#20102;&#37325;&#20889;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn65&quot;&gt;from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^articles/(?P&amp;lt;year&amp;gt;\d{4})/$&apos;, views.year_archive),
    (r&apos;^articles/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;month&amp;gt;\d{2})/$&apos;, views.month_archive),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn66&quot;&gt;&#36825;&#27573;&#20195;&#30721;&#21644;&#21069;&#38754;&#30340;&#21151;&#33021;&#23436;&#20840;&#19968;&#26679;&#65292;&#21482;&#26377;&#19968;&#20010;&#32454;&#24494;&#30340;&#24046;&#21035;&#65306; &#21462;&#30340;&#20540;&#26159;&#20197;&#20851;&#38190;&#23383;&#21442;&#25968;&#30340;&#26041;&#24335;&#32780;&#19981;&#26159;&#20197;&#20301;&#32622;&#21442;&#25968;&#30340;&#26041;&#24335;&#20256;&#36882;&#32473;&#35270;&#22270;&#20989;&#25968;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&#20363;&#22914;&#65292;&#22914;&#26524;&#19981;&#24102;&#21629;&#21517;&#32452;&#65292;&#35831;&#27714; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/articles/2006/03/&lt;/span&gt;&lt;/tt&gt; &#23558;&#20250;&#31561;&#21516;&#20110;&#36825;&#26679;&#30340;&#20989;&#25968;&#35843;&#29992;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn69&quot;&gt;month_archive(request, &apos;2006&apos;, &apos;03&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#32780;&#24102;&#21629;&#21517;&#32452;&#65292;&#21516;&#26679;&#30340;&#35831;&#27714;&#23601;&#20250;&#21464;&#25104;&#36825;&#26679;&#30340;&#20989;&#25968;&#35843;&#29992;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn72&quot;&gt;month_archive(request, year=&apos;2006&apos;, month=&apos;03&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&#20351;&#29992;&#21629;&#21517;&#32452;&#21487;&#20197;&#35753;&#20320;&#30340;URLconfs&#26356;&#21152;&#28165;&#26224;&#65292;&#20943;&#23569;&#25630;&#28151;&#21442;&#25968;&#27425;&#24207;&#30340;&#28508;&#22312;BUG&#65292;&#36824;&#21487;&#20197;&#35753;&#20320;&#22312;&#20989;&#25968;&#23450;&#20041;&#20013;&#23545;&#21442;&#25968;&#37325;&#26032;&#25490;&#24207;&#12290; &#25509;&#30528;&#19978;&#38754;&#36825;&#20010;&#20363;&#23376;&#65292;&#22914;&#26524;&#25105;&#20204;&#24819;&#20462;&#25913;URL&#25226;&#26376;&#20221;&#25918;&#21040; &#24180;&#20221;&#30340; &lt;em&gt;&#21069;&#38754;&lt;/em&gt; &#65292;&#32780;&#19981;&#20351;&#29992;&#21629;&#21517;&#32452;&#30340;&#35805;&#65292;&#25105;&#20204;&#23601;&#19981;&#24471;&#19981;&#21435;&#20462;&#25913;&#35270;&#22270; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;month_archive&lt;/span&gt;&lt;/tt&gt; &#30340;&#21442;&#25968;&#27425;&#24207;&#12290; &#22914;&#26524;&#25105;&#20204;&#20351;&#29992;&#21629;&#21517;&#32452;&#30340;&#35805;&#65292;&#20462;&#25913;URL&#37324;&#25552;&#21462;&#21442;&#25968;&#30340;&#27425;&#24207;&#23545;&#35270;&#22270;&#27809;&#26377;&#24433;&#21709;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#24403;&#28982;&#65292;&#21629;&#21517;&#32452;&#30340;&#20195;&#20215;&#23601;&#26159;&#22833;&#21435;&#20102;&#31616;&#27905;&#24615;&#65306; &#19968;&#20123;&#24320;&#21457;&#32773;&#35273;&#24471;&#21629;&#21517;&#32452;&#30340;&#35821;&#27861;&#19985;&#38475;&#21644;&#26174;&#24471;&#20887;&#20313;&#12290; &#21629;&#21517;&#32452;&#30340;&#21478;&#19968;&#20010;&#22909;&#22788;&#23601;&#26159;&#21487;&#35835;&#24615;&#24378;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn75&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#29702;&#35299;&#21305;&#37197;/&#20998;&#32452;&#31639;&#27861;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#38656;&#35201;&#27880;&#24847;&#30340;&#26159;&#22914;&#26524;&#22312;URLconf&#20013;&#20351;&#29992;&#21629;&#21517;&#32452;&#65292;&#37027;&#20040;&#21629;&#21517;&#32452;&#21644;&#38750;&#21629;&#21517;&#32452;&#26159;&#19981;&#33021;&#21516;&#26102;&#23384;&#22312;&#20110;&#21516;&#19968;&#20010;URLconf&#30340;&#27169;&#24335;&#20013;&#30340;&#12290; &#22914;&#26524;&#20320;&#36825;&#26679;&#20570;&#65292;Django&#19981;&#20250;&#25243;&#20986;&#20219;&#20309;&#38169;&#35823;&#65292;&#20294;&#20320;&#21487;&#33021;&#20250;&#21457;&#29616;&#20320;&#30340;URL&#24182;&#27809;&#26377;&#20687;&#20320;&#39044;&#24819;&#30340;&#37027;&#26679;&#21305;&#37197;&#27491;&#30830;&#12290; &#20855;&#20307;&#22320;&#65292;&#20197;&#19979;&#26159;URLconf&#35299;&#37322;&#22120;&#26377;&#20851;&#27491;&#21017;&#34920;&#36798;&#24335;&#20013;&#21629;&#21517;&#32452;&#21644; &#38750;&#21629;&#21517;&#32452;&#25152;&#36981;&#24490;&#30340;&#31639;&#27861;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn77&quot;&gt;&#22914;&#26524;&#26377;&#20219;&#20309;&#21629;&#21517;&#30340;&#32452;&#65292;Django&#20250;&#24573;&#30053;&#38750;&#21629;&#21517;&#32452;&#32780;&#30452;&#25509;&#20351;&#29992;&#21629;&#21517;&#32452;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn78&quot;&gt;&#21542;&#21017;&#65292;Django&#20250;&#25226;&#25152;&#26377;&#38750;&#21629;&#21517;&#32452;&#20197;&#20301;&#32622;&#21442;&#25968;&#30340;&#24418;&#24335;&#20256;&#36882;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn79&quot;&gt;&#22312;&#20197;&#19978;&#30340;&#20004;&#31181;&#24773;&#20917;&#65292;Django&#21516;&#26102;&#20250;&#20197;&#20851;&#38190;&#23383;&#21442;&#25968;&#30340;&#26041;&#24335;&#20256;&#36882;&#19968;&#20123;&#39069;&#22806;&#21442;&#25968;&#12290; &#26356;&#20855;&#20307;&#30340;&#20449;&#24687;&#21487;&#21442;&#32771;&#19979;&#19968;&#33410;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn80&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#20256;&#36882;&#39069;&#22806;&#30340;&#21442;&#25968;&#21040;&#35270;&#22270;&#20989;&#25968;&#20013;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#26377;&#26102;&#20320;&#20250;&#21457;&#29616;&#20320;&#20889;&#30340;&#35270;&#22270;&#20989;&#25968;&#26159;&#21313;&#20998;&#31867;&#20284;&#30340;&#65292;&#21482;&#26377;&#19968;&#28857;&#28857;&#30340;&#19981;&#21516;&#12290; &#27604;&#22914;&#35828;&#65292;&#20320;&#26377;&#20004;&#20010;&#35270;&#22270;&#65292;&#23427;&#20204;&#30340;&#20869;&#23481;&#26159;&#19968;&#33268;&#30340;&#65292;&#38500;&#20102;&#23427;&#20204;&#25152;&#29992;&#30340;&#27169;&#26495;&#19981;&#22826;&#19968;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn83&quot;&gt;# urls.py

from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^foo/$&apos;, views.foo_view),
    (r&apos;^bar/$&apos;, views.bar_view),
)

# views.py

from django.shortcuts import render_to_response
from mysite.models import MyModel

def foo_view(request):
    m_list = MyModel.objects.filter(is_new=True)
    return render_to_response(&apos;template1.html&apos;, {&apos;m_list&apos;: m_list})

def bar_view(request):
    m_list = MyModel.objects.filter(is_new=True)
    return render_to_response(&apos;template2.html&apos;, {&apos;m_list&apos;: m_list})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#25105;&#20204;&#22312;&#36825;&#20195;&#30721;&#37324;&#38754;&#20570;&#20102;&#37325;&#22797;&#30340;&#24037;&#20316;&#65292;&#19981;&#22815;&#31616;&#32451;&#12290; &#36215;&#21021;&#20320;&#21487;&#33021;&#20250;&#24819;&#65292;&#36890;&#36807;&#23545;&#20004;&#20010;URL&#37117;&#20351;&#29992;&#21516;&#26679;&#30340;&#35270;&#22270;&#65292;&#22312;URL&#20013;&#20351;&#29992;&#25324;&#21495;&#25429;&#25417;&#35831;&#27714;&#65292;&#28982;&#21518;&#22312;&#35270;&#22270;&#20013;&#26816;&#26597;&#24182;&#20915;&#23450;&#20351;&#29992;&#21738;&#20010;&#27169;&#26495;&#26469;&#21435;&#38500;&#20195;&#30721;&#30340;&#20887;&#20313;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn86&quot;&gt;# urls.py

from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^(foo)/$&apos;, views.foobar_view),
    (r&apos;^(bar)/$&apos;, views.foobar_view),
)

# views.py

from django.shortcuts import render_to_response
from mysite.models import MyModel

def foobar_view(request, url):
    m_list = MyModel.objects.filter(is_new=True)
    if url == &apos;foo&apos;:
        template_name = &apos;template1.html&apos;
    elif url == &apos;bar&apos;:
        template_name = &apos;template2.html&apos;
    return render_to_response(template_name, {&apos;m_list&apos;: m_list})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#36825;&#31181;&#35299;&#20915;&#26041;&#26696;&#30340;&#38382;&#39064;&#36824;&#26159;&#32769;&#32570;&#28857;&#65292;&#23601;&#26159;&#25226;&#20320;&#30340;URL&#32806;&#21512;&#36827;&#20320;&#30340;&#20195;&#30721;&#37324;&#38754;&#20102;&#12290; &#22914;&#26524;&#20320;&#25171;&#31639;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/foo/&lt;/span&gt;&lt;/tt&gt; &#25913;&#25104; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/fooey/&lt;/span&gt;&lt;/tt&gt; &#30340;&#35805;&#65292;&#37027;&#20040;&#20320;&#23601;&#24471;&#35760;&#20303;&#35201;&#21435;&#25913;&#21464;&#35270;&#22270;&#37324;&#38754;&#30340;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#23545;&#19968;&#20010;&#21487;&#36873;URL&#37197;&#32622;&#21442;&#25968;&#30340;&#20248;&#38597;&#35299;&#20915;&#26041;&#27861;&#65306; URLconf&#37324;&#38754;&#30340;&#27599;&#19968;&#20010;&#27169;&#24335;&#37117;&#21487;&#20197;&#21253;&#21547;&#31532;&#19977;&#20010;&#25968;&#25454;&#65306; &#19968;&#20010;&#20851;&#38190;&#23383;&#21442;&#25968;&#30340;&#23383;&#20856;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#26377;&#20102;&#36825;&#20010;&#27010;&#24565;&#20197;&#21518;&#65292;&#25105;&#20204;&#23601;&#21487;&#20197;&#25226;&#25105;&#20204;&#29616;&#22312;&#30340;&#20363;&#23376;&#25913;&#20889;&#25104;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn91&quot;&gt;# urls.py

from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^foo/$&apos;, views.foobar_view, {&apos;template_name&apos;: &apos;template1.html&apos;}),
    (r&apos;^bar/$&apos;, views.foobar_view, {&apos;template_name&apos;: &apos;template2.html&apos;}),
)

# views.py

from django.shortcuts import render_to_response
from mysite.models import MyModel

def foobar_view(request, template_name):
    m_list = MyModel.objects.filter(is_new=True)
    return render_to_response(template_name, {&apos;m_list&apos;: m_list})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#22914;&#20320;&#25152;&#35265;&#65292;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;URLconf&#25351;&#23450;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_name&lt;/span&gt;&lt;/tt&gt; &#12290; &#32780;&#35270;&#22270;&#20989;&#25968;&#20250;&#25226;&#23427;&#24403;&#25104;&#21478;&#19968;&#20010;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&#36825;&#31181;&#20351;&#29992;&#39069;&#22806;&#30340;URLconf&#21442;&#25968;&#30340;&#25216;&#26415;&#20197;&#26368;&#23567;&#30340;&#20195;&#20215;&#32473;&#20320;&#25552;&#20379;&#20102;&#21521;&#35270;&#22270;&#20989;&#25968;&#20256;&#36882;&#39069;&#22806;&#20449;&#24687;&#30340;&#19968;&#20010;&#22909;&#26041;&#27861;&#12290; &#27491;&#22240;&#22914;&#27492;&#65292;&#36825;&#25216;&#26415;&#24050;&#34987;&#24456;&#22810;Django&#30340;&#25414;&#32465;&#24212;&#29992;&#20351;&#29992;&#65292;&#20854;&#20013;&#20197;&#25105;&#20204;&#23558;&#22312;&#31532;11&#31456;&#35752;&#35770;&#30340;&#36890;&#29992;&#35270;&#22270;&#31995;&#32479;&#26368;&#20026;&#26126;&#26174;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&#19979;&#38754;&#30340;&#20960;&#33410;&#37324;&#38754;&#26377;&#19968;&#20123;&#20851;&#20110;&#20320;&#21487;&#20197;&#24590;&#26679;&#25226;&#39069;&#22806;URLconf&#21442;&#25968;&#25216;&#26415;&#24212;&#29992;&#21040;&#20320;&#33258;&#24049;&#30340;&#24037;&#31243;&#30340;&#24314;&#35758;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn95&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#20266;&#36896;&#25429;&#25417;&#21040;&#30340;URLconf&#20540;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#27604;&#22914;&#35828;&#20320;&#26377;&#21305;&#37197;&#26576;&#20010;&#27169;&#24335;&#30340;&#19968;&#22534;&#35270;&#22270;&#65292;&#20197;&#21450;&#19968;&#20010;&#24182;&#19981;&#21305;&#37197;&#36825;&#20010;&#27169;&#24335;&#20294;&#35270;&#22270;&#36923;&#36753;&#26159;&#19968;&#26679;&#30340;URL&#12290; &#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;&#21521;&#21516;&#19968;&#20010;&#35270;&#22270;&#20256;&#36882;&#39069;&#22806;URLconf&#21442;&#25968;&#26469;&#20266;&#36896;URL&#20540;&#30340;&#25429;&#25417;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#20363;&#22914;&#65292;&#20320;&#21487;&#33021;&#26377;&#19968;&#20010;&#26174;&#31034;&#26576;&#19968;&#20010;&#29305;&#23450;&#26085;&#23376;&#30340;&#26576;&#20123;&#25968;&#25454;&#30340;&#24212;&#29992;&#65292;URL&#31867;&#20284;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn99&quot;&gt;/mydata/jan/01/
/mydata/jan/02/
/mydata/jan/03/
# ...
/mydata/dec/30/
/mydata/dec/31/
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#36825;&#22826;&#31616;&#21333;&#20102;&#65292;&#20320;&#21487;&#20197;&#22312;&#19968;&#20010;URLconf&#20013;&#25429;&#25417;&#36825;&#20123;&#20540;&#65292;&#20687;&#36825;&#26679;&#65288;&#20351;&#29992;&#21629;&#21517;&#32452;&#30340;&#26041;&#27861;&#65289;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn102&quot;&gt;urlpatterns = patterns(&apos;&apos;,
    (r&apos;^mydata/(?P&amp;lt;month&amp;gt;\w{3})/(?P&amp;lt;day&amp;gt;\d\d)/$&apos;, views.my_view),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#28982;&#21518;&#35270;&#22270;&#20989;&#25968;&#30340;&#21407;&#22411;&#30475;&#36215;&#26469;&#20250;&#26159;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn105&quot;&gt;def my_view(request, month, day):
    # ....
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#36825;&#31181;&#35299;&#20915;&#26041;&#26696;&#24456;&#30452;&#25509;&#65292;&#27809;&#26377;&#29992;&#21040;&#20160;&#20040;&#20320;&#27809;&#35265;&#36807;&#30340;&#25216;&#26415;&#12290; &#24403;&#20320;&#24819;&#28155;&#21152;&#21478;&#22806;&#19968;&#20010;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;my_view&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#20294;&#19981;&#21253;&#21547;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;month&lt;/span&gt;&lt;/tt&gt;&#21644;/&#25110;&#32773;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;day&lt;/span&gt;&lt;/tt&gt;&#30340;URL&#26102;&#65292;&#38382;&#39064;&#23601;&#20986;&#29616;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#27604;&#22914;&#20320;&#21487;&#33021;&#20250;&#24819;&#22686;&#21152;&#36825;&#26679;&#19968;&#20010;URL&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/mydata/birthday/&lt;/span&gt;&lt;/tt&gt; &#65292; &#36825;&#20010;URL&#31561;&#20215;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/mydata/jan/06/&lt;/span&gt;&lt;/tt&gt; &#12290;&#36825;&#26102;&#20320;&#21487;&#20197;&#36825;&#26679;&#21033;&#29992;&#39069;&#22806;URLconf&#21442;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn109&quot;&gt;urlpatterns = patterns(&apos;&apos;,
    (r&apos;^mydata/birthday/$&apos;, views.my_view, {&apos;month&apos;: &apos;jan&apos;, &apos;day&apos;: &apos;06&apos;}),
    (r&apos;^mydata/(?P&amp;lt;month&amp;gt;\w{3})/(?P&amp;lt;day&amp;gt;\d\d)/$&apos;, views.my_view),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&#22312;&#36825;&#37324;&#26368;&#24069;&#30340;&#22320;&#26041;&#33707;&#36807;&#20110;&#20320;&#26681;&#26412;&#19981;&#29992;&#25913;&#21464;&#20320;&#30340;&#35270;&#22270;&#20989;&#25968;&#12290; &#35270;&#22270;&#20989;&#25968;&#21482;&#20250;&#20851;&#24515;&#23427; &lt;em&gt;&#33719;&#24471;&lt;/em&gt; &#20102; &#21442;&#25968;&#65292;&#23427;&#19981;&#20250;&#21435;&#31649;&#36825;&#20123;&#21442;&#25968;&#21040;&#24213;&#26159;&#25429;&#25417;&#22238;&#26469;&#30340;&#36824;&#26159;&#34987;&#39069;&#22806;&#25552;&#20379;&#30340;&#12290;month&#21644;day&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn111&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&#21019;&#24314;&#19968;&#20010;&#36890;&#29992;&#35270;&#22270;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&#25277;&#21462;&#20986;&#25105;&#20204;&#20195;&#30721;&#20013;&#20849;&#24615;&#30340;&#19996;&#35199;&#26159;&#19968;&#20010;&#24456;&#22909;&#30340;&#32534;&#31243;&#20064;&#24815;&#12290; &#27604;&#22914;&#65292;&#20687;&#20197;&#19979;&#30340;&#20004;&#20010;Python&#20989;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn114&quot;&gt;def say_hello(person_name):
    print &apos;Hello, %s&apos; % person_name

def say_goodbye(person_name):
    print &apos;Goodbye, %s&apos; % person_name
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#25226;&#38382;&#20505;&#35821;&#25552;&#21462;&#20986;&#26469;&#21464;&#25104;&#19968;&#20010;&#21442;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn117&quot;&gt;def greet(person_name, greeting):
    print &apos;%s, %s&apos; % (greeting, person_name)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&#36890;&#36807;&#20351;&#29992;&#39069;&#22806;&#30340;URLconf&#21442;&#25968;&#65292;&#20320;&#21487;&#20197;&#25226;&#21516;&#26679;&#30340;&#24605;&#24819;&#24212;&#29992;&#21040;Django&#30340;&#35270;&#22270;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#20102;&#35299;&#36825;&#20010;&#20197;&#21518;&#65292;&#20320;&#21487;&#20197;&#24320;&#22987;&#21019;&#20316;&#39640;&#25277;&#35937;&#30340;&#35270;&#22270;&#12290; &#26356;&#20855;&#20307;&#22320;&#35828;&#65292;&#27604;&#22914;&#36825;&#20010;&#35270;&#22270;&#26174;&#31034;&#19968;&#31995;&#21015;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Event&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#37027;&#20010;&#35270;&#22270;&#26174;&#31034;&#19968;&#31995;&#21015;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BlogEntry&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#24182;&#24847;&#35782;&#21040;&#23427;&#20204;&#37117;&#26159;&#19968;&#20010;&#29992;&#26469;&#26174;&#31034;&#19968;&#31995;&#21015;&#23545;&#35937;&#30340;&#35270;&#22270;&#30340;&#29305;&#20363;&#65292;&#32780;&#23545;&#35937;&#30340;&#31867;&#22411;&#20854;&#23454;&#23601;&#26159;&#19968;&#20010;&#21464;&#37327;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn120&quot;&gt;&#20197;&#36825;&#27573;&#20195;&#30721;&#20316;&#20026;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn122&quot;&gt;# urls.py

from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^events/$&apos;, views.event_list),
    (r&apos;^blog/entries/$&apos;, views.entry_list),
)

# views.py

from django.shortcuts import render_to_response
from mysite.models import Event, BlogEntry

def event_list(request):
    obj_list = Event.objects.all()
    return render_to_response(&apos;mysite/event_list.html&apos;, {&apos;event_list&apos;: obj_list})

def entry_list(request):
    obj_list = BlogEntry.objects.all()
    return render_to_response(&apos;mysite/blogentry_list.html&apos;, {&apos;entry_list&apos;: obj_list})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&#36825;&#20004;&#20010;&#35270;&#22270;&#20570;&#30340;&#20107;&#24773;&#23454;&#36136;&#19978;&#26159;&#19968;&#26679;&#30340;&#65306; &#26174;&#31034;&#19968;&#31995;&#21015;&#30340;&#23545;&#35937;&#12290; &#35753;&#25105;&#20204;&#25226;&#23427;&#20204;&#26174;&#31034;&#30340;&#23545;&#35937;&#30340;&#31867;&#22411;&#25277;&#35937;&#20986;&#26469;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn125&quot;&gt;# urls.py

from django.conf.urls.defaults import *
from mysite import models, views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^events/$&apos;, views.object_list, {&apos;model&apos;: models.Event}),
    (r&apos;^blog/entries/$&apos;, views.object_list, {&apos;model&apos;: models.BlogEntry}),
)

# views.py

from django.shortcuts import render_to_response

def object_list(request, model):
    obj_list = model.objects.all()
    template_name = &apos;mysite/%s_list.html&apos; % model.__name__.lower()
    return render_to_response(template_name, {&apos;object_list&apos;: obj_list})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn126&quot;&gt;&#23601;&#36825;&#26679;&#23567;&#23567;&#30340;&#25913;&#21160;&#65292;&#25105;&#20204;&#31361;&#28982;&#21457;&#29616;&#25105;&#20204;&#26377;&#20102;&#19968;&#20010;&#21487;&#22797;&#29992;&#30340;&#65292;&#27169;&#22411;&#26080;&#20851;&#30340;&#35270;&#22270;&#65281; &#20174;&#29616;&#22312;&#24320;&#22987;&#65292;&#24403;&#25105;&#20204;&#38656;&#35201;&#19968;&#20010;&#35270;&#22270;&#26469;&#26174;&#31034;&#19968;&#31995;&#21015;&#30340;&#23545;&#35937;&#26102;&#65292;&#25105;&#20204;&#21487;&#20197;&#31616;&#31616;&#21333;&#21333;&#30340;&#37325;&#29992;&#36825;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;object_list&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#65292;&#32780;&#26080;&#39035;&#21478;&#22806;&#20889;&#35270;&#22270;&#20195;&#30721;&#20102;&#12290; &#20197;&#19979;&#26159;&#25105;&#20204;&#20570;&#36807;&#30340;&#20107;&#24773;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn127&quot;&gt;&#25105;&#20204;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;model&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#30452;&#25509;&#20256;&#36882;&#20102;&#27169;&#22411;&#31867;&#12290; &#39069;&#22806;URLconf&#21442;&#25968;&#30340;&#23383;&#20856;&#26159;&#21487;&#20197;&#20256;&#36882;&#20219;&#20309;&#31867;&#22411;&#30340;&#23545;&#35937;&#65292;&#32780;&#19981;&#20165;&#20165;&#21482;&#26159;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn128&quot;&gt;&#36825;&#19968;&#34892;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;model.objects.all()&lt;/span&gt;&lt;/tt&gt; &#26159; &lt;em&gt;&#40493;&#23376;&#30028;&#23450;&lt;/em&gt; &#65288;&#21407;&#25991;&#65306;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn129&quot;&gt;&#25105;&#20204;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;model.__name__.lower()&lt;/span&gt;&lt;/tt&gt; &#26469;&#20915;&#23450;&#27169;&#26495;&#30340;&#21517;&#23383;&#12290; &#27599;&#20010;Python&#30340;&#31867;&#37117;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__name__&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;&#36820;&#22238;&#31867;&#21517;&#12290; &#36825;&#29305;&#24615;&#22312;&#24403;&#25105;&#20204;&#30452;&#21040;&#36816;&#34892;&#26102;&#21051;&#25165;&#30693;&#36947;&#23545;&#35937;&#31867;&#22411;&#30340;&#36825;&#31181;&#24773;&#20917;&#19979;&#24456;&#26377;&#29992;&#12290; &#27604;&#22914;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BlogEntry&lt;/span&gt;&lt;/tt&gt; &#31867;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__name__&lt;/span&gt;&lt;/tt&gt; &#23601;&#26159;&#23383;&#31526;&#20018; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;BlogEntry&apos;&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn130&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#19982;&#21069;&#38754;&#30340;&#20363;&#23376;&#31245;&#26377;&#19981;&#21516;&#65292;&#25105;&#20204;&#20256;&#36882;&#20102;&#19968;&#20010;&#36890;&#29992;&#30340;&#21464;&#37327;&#21517;&#32473;&#27169;&#26495;&#12290; &#24403;&#28982;&#25105;&#20204;&#21487;&#20197;&#36731;&#26131;&#30340;&#25226;&#36825;&#20010;&#21464;&#37327;&#21517;&#25913;&#25104; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blogentry_list&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;event_list&lt;/span&gt;&lt;/tt&gt; &#65292;&#19981;&#36807;&#25105;&#20204;&#25171;&#31639;&#25226;&#36825;&#24403;&#20316;&#32451;&#20064;&#30041;&#32473;&#35835;&#32773;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#22240;&#20026;&#25968;&#25454;&#24211;&#39537;&#21160;&#30340;&#32593;&#31449;&#37117;&#26377;&#19968;&#20123;&#36890;&#29992;&#30340;&#27169;&#24335;&#65292;Django&#25552;&#20379;&#20102;&#19968;&#20010;&#36890;&#29992;&#35270;&#22270;&#30340;&#38598;&#21512;&#65292;&#20351;&#29992;&#23427;&#21487;&#20197;&#33410;&#30465;&#20320;&#30340;&#26102;&#38388;&#12290; &#25105;&#20204;&#23558;&#20250;&#22312;&#19979;&#19968;&#31456;&#35762;&#35762;Django&#30340;&#20869;&#32622;&#36890;&#29992;&#35270;&#22270;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn132&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&#25552;&#20379;&#35270;&#22270;&#37197;&#32622;&#36873;&#39033;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#22914;&#26524;&#20320;&#21457;&#24067;&#19968;&#20010;Django&#30340;&#24212;&#29992;&#65292;&#20320;&#30340;&#29992;&#25143;&#21487;&#33021;&#20250;&#24076;&#26395;&#37197;&#32622;&#19978;&#33021;&#26377;&#20123;&#33258;&#30001;&#24230;&#12290; &#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#20026;&#20320;&#35748;&#20026;&#29992;&#25143;&#21487;&#33021;&#24076;&#26395;&#25913;&#21464;&#30340;&#37197;&#32622;&#36873;&#39033;&#28155;&#21152;&#19968;&#20123;&#38057;&#23376;&#21040;&#20320;&#30340;&#35270;&#22270;&#20013;&#20250;&#26159;&#19968;&#20010;&#24456;&#22909;&#30340;&#20027;&#24847;&#12290; &#20320;&#21487;&#20197;&#29992;&#39069;&#22806;URLconf&#21442;&#25968;&#23454;&#29616;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn134&quot;&gt;&#19968;&#20010;&#24212;&#29992;&#20013;&#27604;&#36739;&#24120;&#35265;&#30340;&#21487;&#20379;&#37197;&#32622;&#20195;&#30721;&#26159;&#27169;&#26495;&#21517;&#23383;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn136&quot;&gt;def my_view(request, template_name):
    var = do_something()
    return render_to_response(template_name, {&apos;var&apos;: var})
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn137&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn137&quot;&gt;&#20102;&#35299;&#25429;&#25417;&#20540;&#21644;&#39069;&#22806;&#21442;&#25968;&#20043;&#38388;&#30340;&#20248;&#20808;&#32423; &#39069;&#22806;&#30340;&#36873;&#39033;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#24403;&#20914;&#31361;&#20986;&#29616;&#30340;&#26102;&#20505;&#65292;&#39069;&#22806;URLconf&#21442;&#25968;&#20248;&#20808;&#20110;&#25429;&#25417;&#20540;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;&#22914;&#26524;URLconf&#25429;&#25417;&#21040;&#30340;&#19968;&#20010;&#21629;&#21517;&#32452;&#21464;&#37327;&#21644;&#19968;&#20010;&#39069;&#22806;URLconf&#21442;&#25968;&#21253;&#21547;&#30340;&#21464;&#37327;&#21516;&#21517;&#26102;&#65292;&#39069;&#22806;URLconf&#21442;&#25968;&#30340;&#20540;&#20250;&#34987;&#20351;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&#20363;&#22914;&#65292;&#19979;&#38754;&#36825;&#20010;URLconf&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn141&quot;&gt;from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^mydata/(?P&amp;lt;id&amp;gt;\d+)/$&apos;, views.my_view, {&apos;id&apos;: 3}),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#36825;&#37324;&#65292;&#27491;&#21017;&#34920;&#36798;&#24335;&#21644;&#39069;&#22806;&#23383;&#20856;&#37117;&#21253;&#21547;&#20102;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;id&lt;/span&gt;&lt;/tt&gt; &#12290;&#30828;&#32534;&#30721;&#30340;&#65288;&#39069;&#22806;&#23383;&#20856;&#30340;&#65289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;id&lt;/span&gt;&lt;/tt&gt; &#23558;&#20248;&#20808;&#20351;&#29992;&#12290; &#23601;&#26159;&#35828;&#20219;&#20309;&#35831;&#27714;&#65288;&#27604;&#22914;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/mydata/2/&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/mydata/432432/&lt;/span&gt;&lt;/tt&gt; &#65289;&#37117;&#20250;&#20316; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;id&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;3&lt;/span&gt;&lt;/tt&gt; &#23545;&#24453;&#65292;&#19981;&#31649;URL&#37324;&#38754;&#33021;&#25429;&#25417;&#21040;&#20160;&#20040;&#26679;&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn143&quot;&gt;&#32874;&#26126;&#30340;&#35835;&#32773;&#20250;&#21457;&#29616;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#22312;&#27491;&#21017;&#34920;&#36798;&#24335;&#37324;&#38754;&#20889;&#19978;&#25429;&#25417;&#26159;&#28010;&#36153;&#26102;&#38388;&#30340;&#65292;&#22240;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;id&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#24635;&#26159;&#20250;&#34987;&#23383;&#20856;&#20013;&#30340;&#20540;&#35206;&#30422;&#12290; &#27809;&#38169;&#65292;&#25105;&#20204;&#35828;&#36825;&#20010;&#30340;&#30446;&#30340;&#21482;&#26159;&#20026;&#20102;&#35753;&#20320;&#19981;&#35201;&#29359;&#36825;&#26679;&#30340;&#38169;&#35823;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn144&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn144&quot;&gt;&#20351;&#29992;&#32570;&#30465;&#35270;&#22270;&#21442;&#25968;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn145&quot;&gt;&#21478;&#22806;&#19968;&#20010;&#26041;&#20415;&#30340;&#29305;&#24615;&#26159;&#20320;&#21487;&#20197;&#32473;&#19968;&#20010;&#35270;&#22270;&#25351;&#23450;&#40664;&#35748;&#30340;&#21442;&#25968;&#12290; &#36825;&#26679;&#65292;&#24403;&#27809;&#26377;&#32473;&#36825;&#20010;&#21442;&#25968;&#36171;&#20540;&#30340;&#26102;&#20505;&#23558;&#20250;&#20351;&#29992;&#40664;&#35748;&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn146&quot;&gt;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn148&quot;&gt;# urls.py

from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^blog/$&apos;, views.page),
    (r&apos;^blog/page(?P&amp;lt;num&amp;gt;\d+)/$&apos;, views.page),
)

# views.py

def page(request, num=&apos;1&apos;):
    # Output the appropriate page of blog entries, according to num.
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&#22312;&#36825;&#37324;&#65292;&#20004;&#20010;URL&#34920;&#36798;&#24335;&#37117;&#25351;&#21521;&#20102;&#21516;&#19968;&#20010;&#35270;&#22270; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;views.page&lt;/span&gt;&lt;/tt&gt; &#65292;&#20294;&#26159;&#31532;&#19968;&#20010;&#34920;&#36798;&#24335;&#27809;&#26377;&#20256;&#36882;&#20219;&#20309;&#21442;&#25968;&#12290; &#22914;&#26524;&#21305;&#37197;&#21040;&#20102;&#31532;&#19968;&#20010;&#26679;&#24335;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;page()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#23558;&#20250;&#23545;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;num&lt;/span&gt;&lt;/tt&gt; &#20351;&#29992;&#40664;&#35748;&#20540; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;/tt&gt; &#65292;&#22914;&#26524;&#31532;&#20108;&#20010;&#34920;&#36798;&#24335;&#21305;&#37197;&#25104;&#21151;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;page()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#23558;&#20351;&#29992;&#27491;&#21017;&#34920;&#36798;&#24335;&#20256;&#36882;&#36807;&#26469;&#30340;num&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn150&quot;&gt;&#65288;&#27880;&#65306;&#25105;&#20204;&#24050;&#32463;&#27880;&#24847;&#21040;&#35774;&#32622;&#40664;&#35748;&#21442;&#25968;&#20540;&#26159;&#23383;&#31526;&#20018; `` &#8216;1&#8217;`` &#65292;&#19981;&#26159;&#25972;&#25968;`` 1`` &#12290;&#20026;&#20102;&#20445;&#25345;&#19968;&#33268;&#65292;&#22240;&#20026;&#25429;&#25417;&#32473;`` num`` &#30340;&#20540;&#24635;&#26159;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn151&quot;&gt;&#23601;&#20687;&#21069;&#38754;&#35299;&#37322;&#30340;&#19968;&#26679;&#65292;&#36825;&#31181;&#25216;&#26415;&#19982;&#37197;&#32622;&#36873;&#39033;&#30340;&#32852;&#29992;&#26159;&#24456;&#26222;&#36941;&#30340;&#12290; &#20197;&#19979;&#36825;&#20010;&#20363;&#23376;&#27604;&#25552;&#20379;&#35270;&#22270;&#37197;&#32622;&#36873;&#39033;&#19968;&#33410;&#20013;&#30340;&#20363;&#23376;&#26377;&#20123;&#35768;&#30340;&#25913;&#36827;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn153&quot;&gt;def my_view(request, template_name=&apos;mysite/my_view.html&apos;):
    var = do_something()
    return render_to_response(template_name, {&apos;var&apos;: var})
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn154&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&#29305;&#27530;&#24773;&#20917;&#19979;&#30340;&#35270;&#22270;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&#26377;&#26102;&#20320;&#26377;&#19968;&#20010;&#27169;&#24335;&#26469;&#22788;&#29702;&#22312;&#20320;&#30340;URLconf&#20013;&#30340;&#19968;&#31995;&#21015;URL&#65292;&#20294;&#26159;&#26377;&#26102;&#20505;&#38656;&#35201;&#29305;&#21035;&#22788;&#29702;&#20854;&#20013;&#30340;&#26576;&#20010;URL&#12290; &#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#35201;&#20351;&#29992;&#23558;URLconf&#20013;&#25226;&#29305;&#27530;&#24773;&#20917;&#25918;&#22312;&#39318;&#20301;&#30340;&#32447;&#24615;&#22788;&#29702;&#26041;&#24335; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn156&quot;&gt;&#27604;&#26041;&#35828;&#65292;&#20320;&#21487;&#20197;&#32771;&#34385;&#36890;&#36807;&#19979;&#38754;&#36825;&#20010;URLpattern&#25152;&#25551;&#36848;&#30340;&#26041;&#24335;&#26469;&#21521;Django&#30340;&#31649;&#29702;&#31449;&#28857;&#28155;&#21152;&#19968;&#20010;&#30446;&#26631;&#39029;&#38754;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn158&quot;&gt;urlpatterns = patterns(&apos;&apos;,
    # ...
    (&apos;^([^/]+)/([^/]+)/add/$&apos;, views.add_stage),
    # ...
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&#36825;&#23558;&#21305;&#37197;&#20687; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/myblog/entries/add/&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/auth/groups/add/&lt;/span&gt;&lt;/tt&gt; &#36825;&#26679;&#30340;URL &#12290;&#28982;&#32780;&#65292;&#23545;&#20110;&#29992;&#25143;&#23545;&#35937;&#30340;&#28155;&#21152;&#39029;&#38754;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/auth/user/add/&lt;/span&gt;&lt;/tt&gt; &#65289;&#26159;&#20010;&#29305;&#27530;&#24773;&#20917;&#65292;&#22240;&#20026;&#23427;&#19981;&#20250;&#26174;&#31034;&#25152;&#26377;&#30340;&#34920;&#21333;&#22495;&#65292;&#23427;&#26174;&#31034;&#20004;&#20010;&#23494;&#30721;&#22495;&#31561;&#31561;&#12290; &#25105;&#20204; &lt;em&gt;&#21487;&#20197;&lt;/em&gt; &#22312;&#35270;&#22270;&#20013;&#29305;&#21035;&#25351;&#20986;&#20197;&#35299;&#20915;&#36825;&#31181;&#24773;&#20917;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn161&quot;&gt;def add_stage(request, app_label, model_name):
    if app_label == &apos;auth&apos; and model_name == &apos;user&apos;:
        # do special-case code
    else:
        # do normal code
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#19981;&#36807;&#65292;&#23601;&#22914;&#25105;&#20204;&#22810;&#27425;&#22312;&#36825;&#31456;&#25552;&#21040;&#30340;&#65292;&#36825;&#26679;&#20570;&#24182;&#19981;&#20248;&#38597;&#65306; &#22240;&#20026;&#23427;&#25226;URL&#36923;&#36753;&#25918;&#22312;&#20102;&#35270;&#22270;&#20013;&#12290; &#26356;&#20248;&#38597;&#30340;&#35299;&#20915;&#26041;&#27861;&#26159;&#65292;&#25105;&#20204;&#35201;&#21033;&#29992;URLconf&#20174;&#39030;&#21521;&#19979;&#30340;&#35299;&#26512;&#39034;&#24207;&#36825;&#20010;&#29305;&#28857;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn164&quot;&gt;urlpatterns = patterns(&apos;&apos;,
    # ...
    (&apos;^auth/user/add/$&apos;, views.user_add_stage),
    (&apos;^([^/]+)/([^/]+)/add/$&apos;, views.add_stage),
    # ...
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#35937; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/auth/user/add/&lt;/span&gt;&lt;/tt&gt; &#30340;&#35831;&#27714;&#23558;&#20250;&#34987; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user_add_stage&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#22788;&#29702;&#12290;
&#23613;&#31649;URL&#20063;&#21305;&#37197;&#31532;&#20108;&#31181;&#27169;&#24335;&#65292;&#23427;&#20250;&#20808;&#21305;&#37197;&#19978;&#38754;&#30340;&#27169;&#24335;&#12290; &#65288;&#36825;&#26159;&#30701;&#36335;&#36923;&#36753;&#12290;&#65289;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn166&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn166&quot;&gt;&#20174;URL&#20013;&#25429;&#33719;&#25991;&#26412;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn167&quot;&gt;&#27599;&#20010;&#34987;&#25429;&#33719;&#30340;&#21442;&#25968;&#23558;&#34987;&#20316;&#20026;&#32431;Python&#23383;&#31526;&#20018;&#26469;&#21457;&#36865;&#65292;&#32780;&#19981;&#31649;&#27491;&#21017;&#34920;&#36798;&#24335;&#20013;&#30340;&#26684;&#24335;&#12290; &#20030;&#20010;&#20363;&#23376;&#65292;&#22312;&#36825;&#34892;URLConf&#20013;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn169&quot;&gt;(r&apos;^articles/(?P&amp;lt;year&amp;gt;\d{4})/$&apos;, views.year_archive),
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn170&quot;&gt;&#23613;&#31649; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\d{4}&lt;/span&gt;&lt;/tt&gt; &#23558;&#21482;&#21305;&#37197;&#25972;&#25968;&#30340;&#23383;&#31526;&#20018;&#65292;&#20294;&#26159;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;year&lt;/span&gt;&lt;/tt&gt; &#26159;&#20316;&#20026;&#23383;&#31526;&#20018;&#20256;&#33267; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;views.year_archive()&lt;/span&gt;&lt;/tt&gt; &#30340;&#65292;&#32780;&#19981;&#26159;&#25972;&#22411;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn171&quot;&gt;&#24403;&#20320;&#22312;&#20889;&#35270;&#22270;&#20195;&#30721;&#26102;&#35760;&#20303;&#36825;&#28857;&#24456;&#37325;&#35201;&#65292;&#35768;&#22810;Python&#20869;&#24314;&#30340;&#26041;&#27861;&#23545;&#20110;&#25509;&#21463;&#30340;&#23545;&#35937;&#30340;&#31867;&#22411;&#24456;&#35762;&#31350;&#12290; &#35768;&#22810;&#20869;&#32622;Python&#20989;&#25968;&#26159;&#25361;&#21076;&#30340;&#65288;&#36825;&#26159;&#29702;&#25152;&#24403;&#28982;&#30340;&#65289;&#21482;&#25509;&#21463;&#29305;&#23450;&#31867;&#22411;&#30340;&#23545;&#35937;&#12290; &#19968;&#20010;&#20856;&#22411;&#30340;&#30340;&#38169;&#35823;&#23601;&#26159;&#29992;&#23383;&#31526;&#20018;&#20540;&#32780;&#19981;&#26159;&#25972;&#25968;&#20540;&#26469;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime.date&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn173&quot;&gt;&amp;gt;&amp;gt;&amp;gt; import datetime
&amp;gt;&amp;gt;&amp;gt; datetime.date(&apos;1993&apos;, &apos;7&apos;, &apos;9&apos;)
Traceback (most recent call last):
    ...
TypeError: an integer is required
&amp;gt;&amp;gt;&amp;gt; datetime.date(1993, 7, 9)
datetime.date(1993, 7, 9)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#22238;&#21040;URLconf&#21644;&#35270;&#22270;&#22788;&#65292;&#38169;&#35823;&#30475;&#36215;&#26469;&#24456;&#21487;&#33021;&#26159;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn176&quot;&gt;# urls.py

from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^articles/(\d{4})/(\d{2})/(\d{2})/$&apos;, views.day_archive),
)

# views.py

import datetime

def day_archive(request, year, month, day):
    # The following statement raises a TypeError!
    date = datetime.date(year, month, day)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn177&quot;&gt;&#22240;&#27492;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;day_archive()&lt;/span&gt;&lt;/tt&gt; &#24212;&#35813;&#36825;&#26679;&#20889;&#25165;&#26159;&#27491;&#30830;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn179&quot;&gt;def day_archive(request, year, month, day):
    date = datetime.date(int(year), int(month), int(day))
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;&#27880;&#24847;&#65292;&#24403;&#20320;&#20256;&#36882;&#20102;&#19968;&#20010;&#24182;&#19981;&#23436;&#20840;&#21253;&#21547;&#25968;&#23383;&#30340;&#23383;&#31526;&#20018;&#26102;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;int()&lt;/span&gt;&lt;/tt&gt; &#20250;&#25243;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ValueError&lt;/span&gt;&lt;/tt&gt; &#30340;&#24322;&#24120;&#65292;&#19981;&#36807;&#25105;&#20204;&#24050;&#32463;&#36991;&#20813;&#20102;&#36825;&#20010;&#38169;&#35823;&#65292;&#22240;&#20026;&#22312;URLconf&#30340;&#27491;&#21017;&#34920;&#36798;&#24335;&#20013;&#24050;&#32463;&#30830;&#20445;&#21482;&#26377;&#21253;&#21547;&#25968;&#23383;&#30340;&#23383;&#31526;&#20018;&#25165;&#20250;&#20256;&#21040;&#36825;&#20010;&#35270;&#22270;&#20989;&#25968;&#20013;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id15&quot;&gt;
&lt;span id=&quot;cn181&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn181&quot;&gt;&#20915;&#23450;URLconf&#25628;&#32034;&#30340;&#19996;&#35199;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn182&quot;&gt;&#24403;&#19968;&#20010;&#35831;&#27714;&#36827;&#26469;&#26102;&#65292;Django&#35797;&#30528;&#23558;&#35831;&#27714;&#30340;URL&#20316;&#20026;&#19968;&#20010;&#26222;&#36890;Python&#23383;&#31526;&#20018;&#36827;&#34892;URLconf&#27169;&#24335;&#21305;&#37197;&#65288;&#32780;&#19981;&#26159;&#20316;&#20026;&#19968;&#20010;Unicode&#23383;&#31526;&#20018;&#65289;&#12290; &#36825;&#24182;&#19981;&#21253;&#25324; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#25110;&#22495;&#21517;&#12290; &#23427;&#20063;&#19981;&#21253;&#25324;&#31532;&#19968;&#20010;&#26012;&#26464;&#65292;&#22240;&#20026;&#27599;&#20010;URL&#24517;&#23450;&#26377;&#19968;&#20010;&#26012;&#26464;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn183&quot;&gt;&#20363;&#22914;&#65292;&#22312;&#21521; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://www.example.com/myapp/&lt;/span&gt;&lt;/tt&gt; &#30340;&#35831;&#27714;&#20013;&#65292;Django&#23558;&#35797;&#30528;&#21435;&#21305;&#37197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;myapp/&lt;/span&gt;&lt;/tt&gt; &#12290;&#22312;&#21521; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://www.example.com/myapp/?page=3&lt;/span&gt;&lt;/tt&gt; &#30340;&#35831;&#27714;&#20013;&#65292;Django&#21516;&#26679;&#20250;&#21435;&#21305;&#37197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;myapp/&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn184&quot;&gt;&#22312;&#35299;&#26512;URLconf&#26102;&#65292;&#35831;&#27714;&#26041;&#27861;&#65288;&#20363;&#22914;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HEAD&lt;/span&gt;&lt;/tt&gt; &#65289;&#24182; &lt;em&gt;&#19981;&#20250;&lt;/em&gt; &#34987;&#32771;&#34385;&#12290;
&#25442;&#32780;&#35328;&#20043;&#65292;&#23545;&#20110;&#30456;&#21516;&#30340;URL&#30340;&#25152;&#26377;&#35831;&#27714;&#26041;&#27861;&#23558;&#34987;&#23548;&#21521;&#21040;&#30456;&#21516;&#30340;&#20989;&#25968;&#20013;&#12290; &#22240;&#27492;&#26681;&#25454;&#35831;&#27714;&#26041;&#27861;&#26469;&#22788;&#29702;&#20998;&#25903;&#26159;&#35270;&#22270;&#20989;&#25968;&#30340;&#36131;&#20219;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id16&quot;&gt;
&lt;span id=&quot;cn185&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#35270;&#22270;&#20989;&#25968;&#30340;&#39640;&#32423;&#27010;&#24565;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#35828;&#21040;&#20851;&#20110;&#35831;&#27714;&#26041;&#27861;&#30340;&#20998;&#25903;&#65292;&#35753;&#25105;&#20204;&#26469;&#30475;&#19968;&#19979;&#21487;&#20197;&#29992;&#20160;&#20040;&#22909;&#30340;&#26041;&#27861;&#26469;&#23454;&#29616;&#23427;&#12290; &#32771;&#34385;&#36825;&#20010; URLconf/view &#35774;&#35745;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn188&quot;&gt;# urls.py

from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    # ...
    (r&apos;^somepage/$&apos;, views.some_page),
    # ...
)

# views.py

from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render_to_response

def some_page(request):
    if request.method == &apos;POST&apos;:
        do_something_for_post()
        return HttpResponseRedirect(&apos;/someurl/&apos;)
    elif request.method == &apos;GET&apos;:
        do_something_for_get()
        return render_to_response(&apos;page.html&apos;)
    else:
        raise Http404()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn189&quot;&gt;&#22312;&#36825;&#20010;&#31034;&#20363;&#20013;&#65292;`` some_page()`` &#35270;&#22270;&#20989;&#25968;&#23545;`` POST`` &#21644;`` GET`` &#36825;&#20004;&#31181;&#35831;&#27714;&#26041;&#27861;&#30340;&#22788;&#29702;&#23436;&#20840;&#19981;&#21516;&#12290; &#23427;&#20204;&#21807;&#19968;&#30340;&#20849;&#21516;&#28857;&#26159;&#20849;&#20139;&#19968;&#20010;URL&#22320;&#22336;&#65306; `` /somepage/.``&#27491;&#22914;&#22823;&#23478;&#25152;&#30475;&#21040;&#30340;&#65292;&#22312;&#21516;&#19968;&#20010;&#35270;&#22270;&#20989;&#25968;&#20013;&#23545;`` POST`` &#21644;`` GET`` &#36827;&#34892;&#22788;&#29702;&#26159;&#19968;&#31181;&#24456;&#21021;&#32423;&#20063;&#24456;&#31895;&#31961;&#30340;&#20570;&#27861;&#12290; &#19968;&#20010;&#27604;&#36739;&#22909;&#30340;&#35774;&#35745;&#20064;&#24815;&#24212;&#35813;&#26159;&#65292;&#29992;&#20004;&#20010;&#20998;&#24320;&#30340;&#35270;&#22270;&#20989;&#25968;&#8212;&#8212;&#19968;&#20010;&#22788;&#29702;`` POST`` &#35831;&#27714;&#65292;&#21478;&#19968;&#20010;&#22788;&#29702;`` GET`` &#35831;&#27714;&#65292;&#28982;&#21518;&#22312;&#30456;&#24212;&#30340;&#22320;&#26041;&#20998;&#21035;&#36827;&#34892;&#35843;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#20687;&#36825;&#26679;&#20570;&#65306;&#20808;&#20889;&#19968;&#20010;&#35270;&#22270;&#20989;&#25968;&#28982;&#21518;&#30001;&#23427;&#26469;&#20855;&#20307;&#20998;&#27966;&#20854;&#23427;&#30340;&#35270;&#22270;&#65292;&#22312;&#20043;&#21069;&#25110;&#20043;&#21518;&#21487;&#20197;&#25191;&#34892;&#19968;&#20123;&#25105;&#20204;&#33258;&#23450;&#30340;&#31243;&#24207;&#36923;&#36753;&#12290; &#19979;&#36793;&#30340;&#31034;&#20363;&#23637;&#31034;&#20102;&#36825;&#20010;&#25216;&#26415;&#26159;&#22914;&#20309;&#24110;&#25105;&#20204;&#25913;&#36827;&#21069;&#36793;&#37027;&#20010;&#31616;&#21333;&#30340;`` some_page()`` &#35270;&#22270;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn192&quot;&gt;# views.py

from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render_to_response

def method_splitter(request, GET=None, POST=None):
    if request.method == &apos;GET&apos; and GET is not None:
        return GET(request)
    elif request.method == &apos;POST&apos; and POST is not None:
        return POST(request)
    raise Http404

def some_page_get(request):
    assert request.method == &apos;GET&apos;
    do_something_for_get()
    return render_to_response(&apos;page.html&apos;)

def some_page_post(request):
    assert request.method == &apos;POST&apos;
    do_something_for_post()
    return HttpResponseRedirect(&apos;/someurl/&apos;)

# urls.py

from django.conf.urls.defaults import *
from mysite import views

urlpatterns = patterns(&apos;&apos;,
    # ...
    (r&apos;^somepage/$&apos;, views.method_splitter, {&apos;GET&apos;: views.some_page_get, &apos;POST&apos;: views.some_page_post}),
    # ...
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&#35753;&#25105;&#20204;&#20174;&#22836;&#30475;&#19968;&#19979;&#20195;&#30721;&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn194&quot;&gt;&#25105;&#20204;&#20889;&#20102;&#19968;&#20010;&#26032;&#30340;&#35270;&#22270;&#65292;`` method_splitter()`` &#65292;&#23427;&#26681;&#25454;`` request.method`` &#36820;&#22238;&#30340;&#20540;&#26469;&#35843;&#29992;&#30456;&#24212;&#30340;&#35270;&#22270;&#12290;&#21487;&#20197;&#30475;&#21040;&#23427;&#24102;&#26377;&#20004;&#20010;&#20851;&#38190;&#21442;&#25968;&#65292;`` GET`` &#21644;`` POST`` &#65292;&#20063;&#35768;&#24212;&#35813;&#26159;* &#35270;&#22270;&#20989;&#25968;* &#12290;&#22914;&#26524;`` request.method`` &#36820;&#22238;`` GET`` &#65292;&#37027;&#23427;&#23601;&#20250;&#33258;&#21160;&#35843;&#29992;`` GET`` &#35270;&#22270;&#12290; &#22914;&#26524;`` request.method`` &#36820;&#22238;&#30340;&#26159;`` POST`` &#65292;&#37027;&#23427;&#35843;&#29992;&#30340;&#23601;&#26159;`` POST`` &#35270;&#22270;&#12290; &#22914;&#26524;`` request.method`` &#36820;&#22238;&#30340;&#26159;&#20854;&#23427;&#20540;&#65288;&#22914;&#65306;`` HEAD`` &#65289;&#65292;&#25110;&#32773;&#26159;&#27809;&#26377;&#25226;`` GET`` &#25110;`` POST`` &#25552;&#20132;&#32473;&#27492;&#20989;&#25968;&#65292;&#37027;&#23427;&#23601;&#20250;&#25243;&#20986;&#19968;&#20010;`` Http404`` &#38169;&#35823;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn195&quot;&gt;&#22312;URLconf&#20013;&#65292;&#25105;&#20204;&#25226;`` /somepage/`` &#25351;&#21040;`` method_splitter()`` &#20989;&#25968;&#65292;&#24182;&#25226;&#35270;&#22270;&#20989;&#25968;&#39069;&#22806;&#38656;&#35201;&#29992;&#21040;&#30340;`` GET`` &#21644;`` POST`` &#21442;&#25968;&#20256;&#36882;&#32473;&#23427;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn196&quot;&gt;&#26368;&#32456;&#65292;&#25105;&#20204;&#25226;`` some_page()`` &#35270;&#22270;&#20998;&#35299;&#21040;&#20004;&#20010;&#35270;&#22270;&#20989;&#25968;&#20013;`` some_page_get()`` &#21644;`` some_page_post()`` &#12290;&#36825;&#27604;&#25226;&#25152;&#26377;&#36923;&#36753;&#37117;&#25380;&#21040;&#19968;&#20010;&#21333;&#19968;&#35270;&#22270;&#30340;&#20570;&#27861;&#35201;&#20248;&#38597;&#24471;&#22810;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&#27880;&#24847;&#65292;&#22312;&#25216;&#26415;&#19978;&#36825;&#20123;&#35270;&#22270;&#20989;&#25968;&#23601;&#19981;&#29992;&#20877;&#21435;&#26816;&#26597;`` request.method`` &#20102;&#65292;&#22240;&#20026;`` method_splitter()`` &#24050;&#32463;&#26367;&#23427;&#20204;&#20570;&#20102;&#12290; &#65288;&#27604;&#22914;&#65292;`` some_page_post()`` &#34987;&#35843;&#29992;&#30340;&#26102;&#20505;&#65292;&#25105;&#20204;&#21487;&#20197;&#30830;&#20449;`` request.method`` &#36820;&#22238;&#30340;&#20540;&#26159;`` post`` &#12290;&#65289;&#24403;&#28982;&#65292;&#36825;&#26679;&#20570;&#19981;&#27490;&#26356;&#23433;&#20840;&#20063;&#33021;&#26356;&#22909;&#30340;&#23558;&#20195;&#30721;&#25991;&#26723;&#21270;&#65292;&#36825;&#37324;&#25105;&#20204;&#20570;&#20102;&#19968;&#20010;&#20551;&#23450;&#65292;&#23601;&#26159;`` request.method`` &#33021;&#35937;&#25105;&#20204;&#25152;&#26399;&#26395;&#30340;&#37027;&#26679;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&#29616;&#22312;&#25105;&#20204;&#23601;&#25317;&#26377;&#20102;&#19968;&#20010;&#19981;&#38169;&#30340;&#65292;&#21487;&#20197;&#36890;&#29992;&#30340;&#35270;&#22270;&#20989;&#25968;&#20102;&#65292;&#37324;&#36793;&#23553;&#35013;&#30528;&#30001;`` request.method`` &#30340;&#36820;&#22238;&#20540;&#26469;&#20998;&#27966;&#19981;&#21516;&#30340;&#35270;&#22270;&#30340;&#31243;&#24207;&#12290;&#20851;&#20110;`` method_splitter()`` &#23601;&#19981;&#35828;&#20160;&#20040;&#20102;&#65292;&#24403;&#28982;&#65292;&#25105;&#20204;&#21487;&#20197;&#25226;&#23427;&#20204;&#37325;&#29992;&#21040;&#20854;&#23427;&#39033;&#30446;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&#28982;&#32780;&#65292;&#24403;&#25105;&#20204;&#20570;&#21040;&#36825;&#19968;&#27493;&#26102;&#65292;&#25105;&#20204;&#20173;&#28982;&#21487;&#20197;&#25913;&#36827;`` method_splitter`` &#12290;&#20174;&#20195;&#30721;&#25105;&#20204;&#21487;&#20197;&#30475;&#21040;&#65292;&#23427;&#20551;&#35774;`` Get`` &#21644;`` POST`` &#35270;&#22270;&#38500;&#20102;`` request`` &#20043;&#22806;&#19981;&#38656;&#35201;&#20219;&#20309;&#20854;&#20182;&#30340;&#21442;&#25968;&#12290;&#37027;&#20040;&#65292;&#20551;&#22914;&#25105;&#20204;&#24819;&#35201;&#20351;&#29992;`` method_splitter`` &#19982;&#37027;&#31181;&#20250;&#20174;URL&#37324;&#25429;&#25417;&#23383;&#31526;&#65292;&#25110;&#32773;&#20250;&#25509;&#25910;&#19968;&#20123;&#21487;&#36873;&#21442;&#25968;&#30340;&#35270;&#22270;&#19968;&#36215;&#24037;&#20316;&#26102;&#35813;&#24590;&#20040;&#21150;&#21602;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&#20026;&#20102;&#23454;&#29616;&#36825;&#20010;&#65292;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992;Python&#20013;&#19968;&#20010;&#20248;&#38597;&#30340;&#29305;&#24615; &#24102;&#26143;&#21495;&#30340;&#21487;&#21464;&#21442;&#25968; &#25105;&#20204;&#20808;&#23637;&#31034;&#36825;&#20123;&#20363;&#23376;&#65292;&#25509;&#30528;&#20877;&#36827;&#34892;&#35299;&#37322;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn202&quot;&gt;def method_splitter(request, *args, **kwargs):
    get_view = kwargs.pop(&apos;GET&apos;, None)
    post_view = kwargs.pop(&apos;POST&apos;, None)
    if request.method == &apos;GET&apos; and get_view is not None:
        return get_view(request, *args, **kwargs)
    elif request.method == &apos;POST&apos; and post_view is not None:
        return post_view(request, *args, **kwargs)
    raise Http404
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn203&quot;&gt;&#36825;&#37324;,&#25105;&#20204;&#37325;&#26500;method_splitter(),&#21435;&#25481;&#20102;GET&#21644;POST&#20004;&#20010;&#20851;&#38190;&#23383;&#21442;&#25968;,&#25913;&#32780;&#25903;&#25345;&#20351;&#29992;*args&#21644;&#21644;**kwargs(&#27880;&#24847;*&#21495;) &#36825;&#26159;&#19968;&#20010;Python&#29305;&#24615;&#65292;&#20801;&#35768;&#20989;&#25968;&#25509;&#21463;&#21160;&#24577;&#30340;&#12289;&#21487;&#21464;&#25968;&#37327;&#30340;&#12289;&#21442;&#25968;&#21517;&#21482;&#22312;&#36816;&#34892;&#26102;&#21487;&#30693;&#30340;&#21442;&#25968;&#12290; &#22914;&#26524;&#20320;&#22312;&#20989;&#25968;&#23450;&#20041;&#26102;,&#21482;&#22312;&#21442;&#25968;&#21069;&#38754;&#21152;&#19968;&#20010;*&#21495;,&#25152;&#26377;&#20256;&#36882;&#32473;&#20989;&#25968;&#30340;&#21442;&#25968;&#23558;&#20250;&#20445;&#23384;&#20026;&#19968;&#20010;&#20803;&#32452;. &#22914;&#26524;&#20320;&#22312;&#20989;&#25968;&#23450;&#20041;&#26102;,&#22312;&#21442;&#25968;&#21069;&#38754;&#21152;&#20004;&#20010;*&#21495;,&#25152;&#26377;&#20256;&#36882;&#32473;&#20989;&#25968;&#30340;&#20851;&#38190;&#23383;&#21442;&#25968;,&#23558;&#20250;&#20445;&#23384;&#20026;&#19968;&#20010;&#23383;&#20856;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn204&quot;&gt;&#20363;&#22914;&#65292;&#23545;&#20110;&#36825;&#20010;&#20989;&#25968;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn206&quot;&gt;def foo(*args, **kwargs):
    print &quot;Positional arguments are:&quot;
    print args
    print &quot;Keyword arguments are:&quot;
    print kwargs
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn207&quot;&gt;&#30475;&#19968;&#19979;&#23427;&#26159;&#24590;&#20040;&#24037;&#20316;&#30340;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn209&quot;&gt;&amp;gt;&amp;gt;&amp;gt; foo(1, 2, 3)
Positional arguments are:
(1, 2, 3)
Keyword arguments are:
{}
&amp;gt;&amp;gt;&amp;gt; foo(1, 2, name=&apos;Adrian&apos;, framework=&apos;Django&apos;)
Positional arguments are:
(1, 2)
Keyword arguments are:
{&apos;framework&apos;: &apos;Django&apos;, &apos;name&apos;: &apos;Adrian&apos;}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&#22238;&#36807;&#22836;&#26469;&#30475;&#65292;&#20320;&#33021;&#21457;&#29616;&#25105;&#20204;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;method_splitter()&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;*args&lt;/span&gt;&lt;/tt&gt;&#25509;&#21463;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;**kwargs&lt;/span&gt;&lt;/tt&gt;&#20989;&#25968;&#21442;&#25968;&#24182;&#25226;&#23427;&#20204;&#20256;&#36882;&#21040;&#27491;&#30830;&#30340;&#35270;&#22270;&#12290;&lt;em&gt;any&lt;/em&gt; &#20294;&#26159;&#22312;&#25105;&#20204;&#36825;&#26679;&#20570;&#20043;&#21069;&#65292;&#25105;&#20204;&#35201;&#35843;&#29992;&#20004;&#27425;&#33719;&#24471;&#21442;&#25968;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;kwargs.pop()&lt;/span&gt;&lt;/tt&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt;&#65292;&#22914;&#26524;&#23427;&#20204;&#21512;&#27861;&#30340;&#35805;&#12290; (&#25105;&#20204;&#36890;&#36807;&#25351;&#23450;pop&#30340;&#32570;&#30465;&#20540;&#20026;None,&#26469;&#36991;&#20813;&#30001;&#20110;&#19968;&#20010;&#25110;&#32773;&#22810;&#20010;&#20851;&#38190;&#23383;&#32570;&#22833;&#24102;&#26469;&#30340;KeyError)&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id17&quot;&gt;
&lt;span id=&quot;cn211&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn211&quot;&gt;&#21253;&#35013;&#35270;&#22270;&#20989;&#25968;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn212&quot;&gt;&#25105;&#20204;&#26368;&#32456;&#30340;&#35270;&#22270;&#25216;&#24039;&#21033;&#29992;&#20102;&#19968;&#20010;&#39640;&#32423;python&#25216;&#26415;&#12290; &#20551;&#35774;&#20320;&#21457;&#29616;&#33258;&#24049;&#22312;&#21508;&#20010;&#19981;&#21516;&#35270;&#22270;&#37324;&#37325;&#22797;&#20102;&#22823;&#37327;&#20195;&#30721;&#65292;&#23601;&#20687; &#36825;&#20010;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn214&quot;&gt;def my_view1(request):
    if not request.user.is_authenticated():
        return HttpResponseRedirect(&apos;/accounts/login/&apos;)
    # ...
    return render_to_response(&apos;template1.html&apos;)

def my_view2(request):
    if not request.user.is_authenticated():
        return HttpResponseRedirect(&apos;/accounts/login/&apos;)
    # ...
    return render_to_response(&apos;template2.html&apos;)

def my_view3(request):
    if not request.user.is_authenticated():
        return HttpResponseRedirect(&apos;/accounts/login/&apos;)
    # ...
    return render_to_response(&apos;template3.html&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn215&quot;&gt;&#36825;&#37324;&#65292;&#27599;&#19968;&#20010;&#35270;&#22270;&#24320;&#22987;&#37117;&#26816;&#26597;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.user&lt;/span&gt;&lt;/tt&gt;&#26159;&#21542;&#26159;&#24050;&#32463;&#35748;&#35777;&#30340;&#65292;&#26159;&#30340;&#35805;&#65292;&#24403;&#21069;&#29992;&#25143;&#24050;&#32463;&#25104;&#21151;&#30331;&#38470;&#31449;&#28857;&#21542;&#21017;&#23601;&#37325;&#23450;&#21521;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/accounts/login/&lt;/span&gt;&lt;/tt&gt; (&#27880;&#24847;,&#34429;&#28982;&#25105;&#20204;&#36824;&#27809;&#26377;&#35762;&#21040;request.user,&#20294;&#26159;14&#31456;&#23558;&#35201;&#35762;&#21040;&#23427;.&#23601;&#22914;&#20320;&#25152;&#24819;&#20687;&#30340;,request.user&#25551;&#36848;&#24403;&#21069;&#29992;&#25143;&#26159;&#30331;&#38470;&#30340;&#36824;&#26159;&#21311;&#21517;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn216&quot;&gt;&#22914;&#26524;&#25105;&#20204;&#33021;&#22815;&#19995;&#27599;&#20010;&#35270;&#22270;&#37324;&#31227;&#38500;&#37027;&#20123; &#37325;&#22797;&#20195;&#65292;&#24182;&#19988;&#21482;&#22312;&#38656;&#35201;&#35748;&#35777;&#30340;&#26102;&#20505;&#25351;&#26126;&#23427;&#20204;&#65292;&#37027;&#23601;&#23436;&#32654;&#20102;&#12290; &#25105;&#20204;&#33021;&#22815;&#36890;&#36807;&#20351;&#29992;&#19968;&#20010;&#35270;&#22270;&#21253;&#35013;&#36798;&#21040;&#30446;&#30340;&#12290; &#33457;&#28857;&#26102;&#38388;&#26469;&#30475;&#30475;&#36825;&#20010;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn218&quot;&gt;def requires_login(view):
    def new_view(request, *args, **kwargs):
        if not request.user.is_authenticated():
            return HttpResponseRedirect(&apos;/accounts/login/&apos;)
        return view(request, *args, **kwargs)
    return new_view
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn219&quot;&gt;&#20989;&#25968;requires_login,&#20256;&#20837;&#19968;&#20010;&#35270;&#22270;&#20989;&#25968;view,&#28982;&#21518;&#36820;&#22238;&#19968;&#20010;&#26032;&#30340;&#35270;&#22270;&#20989;&#25968;new_view.&#36825;&#20010;&#26032;&#30340;&#35270;&#22270;&#20989;&#25968;new_view&#22312;&#20989;&#25968;requires_login&#20869;&#23450;&#20041; &#22788;&#29702;request.user.is_authenticated()&#36825;&#20010;&#39564;&#35777;,&#20174;&#32780;&#20915;&#23450;&#26159;&#21542;&#25191;&#34892;&#21407;&#26469;&#30340;view&#20989;&#25968;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn220&quot;&gt;&#29616;&#22312;,&#25105;&#20204;&#21487;&#20197;&#20174;views&#20013;&#21435;&#25481;if not request.user.is_authenticated()&#39564;&#35777;.&#25105;&#20204;&#21487;&#20197;&#22312;URLconf&#20013;&#24456;&#23481;&#26131;&#30340;&#29992;requires_login&#26469;&#21253;&#35013;&#23454;&#29616;.&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn222&quot;&gt;from django.conf.urls.defaults import *
from mysite.views import requires_login, my_view1, my_view2, my_view3

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^view1/$&apos;, requires_login(my_view1)),
    (r&apos;^view2/$&apos;, requires_login(my_view2)),
    (r&apos;^view3/$&apos;, requires_login(my_view3)),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn223&quot;&gt;&#20248;&#21270;&#21518;&#30340;&#20195;&#30721;&#21644;&#21069;&#38754;&#30340;&#21151;&#33021;&#19968;&#26679;,&#20294;&#26159;&#20943;&#23569;&#20102;&#20195;&#30721;&#20887;&#20313; &#29616;&#22312;&#25105;&#20204;&#24314;&#31435;&#20102;&#19968;&#20010;&#28418;&#20142;,&#36890;&#29992;&#30340;&#20989;&#25968;requires_login()&#26469;&#24110;&#21161;&#25105;&#20204;&#20462;&#39280;&#25152;&#26377;&#38656;&#35201;&#23427;&#26469;&#39564;&#35777;&#30340;&#35270;&#22270;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id18&quot;&gt;
&lt;span id=&quot;cn224&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn224&quot;&gt;&#21253;&#21547;&#20854;&#20182;URLconf&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn225&quot;&gt;&#22914;&#26524;&#20320;&#35797;&#22270;&#35753;&#20320;&#30340;&#20195;&#30721;&#29992;&#22312;&#22810;&#20010;&#22522;&#20110;Django&#30340;&#31449;&#28857;&#19978;&#65292;&#20320;&#24212;&#35813;&#32771;&#34385;&#23558;&#20320;&#30340;URLconf&#20197;&#21253;&#21547;&#30340;&#26041;&#24335;&#26469;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn226&quot;&gt;&#22312;&#20219;&#20309;&#26102;&#20505;&#65292;&#20320;&#30340;URLconf&#37117;&#21487;&#20197;&#21253;&#21547;&#20854;&#20182;URLconf&#27169;&#22359;&#12290; &#23545;&#20110;&#26681;&#30446;&#24405;&#26159;&#22522;&#20110;&#19968;&#31995;&#21015;URL&#30340;&#31449;&#28857;&#26469;&#35828;&#65292;&#36825;&#26159;&#24517;&#35201;&#30340;&#12290; &#20363;&#22914;&#19979;&#38754;&#30340;&#65292;URLconf&#21253;&#21547;&#20102;&#20854;&#20182;URLConf&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn228&quot;&gt;from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^weblog/&apos;, include(&apos;mysite.blog.urls&apos;)),
    (r&apos;^photos/&apos;, include(&apos;mysite.photos.urls&apos;)),
    (r&apos;^about/$&apos;, &apos;mysite.views.about&apos;),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn229&quot;&gt;&#22312;&#21069;&#38754;&#31532;6&#31456;&#20171;&#32461;Django&#30340;admin&#27169;&#22359;&#26102;&#25105;&#20204;&#26366;&#32463;&#35265;&#36807;include. admin&#27169;&#22359;&#26377;&#20182;&#33258;&#24049;&#30340;URLconf,&#20320;&#20165;&#20165;&#21482;&#38656;&#35201;&#22312;&#20320;&#33258;&#24049;&#30340;&#20195;&#30721;&#20013;&#21152;&#20837;include&#23601;&#21487;&#20197;&#20102;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn230&quot;&gt;&#36825;&#37324;&#26377;&#20010;&#24456;&#37325;&#35201;&#30340;&#22320;&#26041;&#65306; &#20363;&#23376;&#20013;&#30340;&#25351;&#21521; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;include()&lt;/span&gt;&lt;/tt&gt; &#30340;&#27491;&#21017;&#34920;&#36798;&#24335;&#24182; &lt;em&gt;&#19981;&lt;/em&gt; &#21253;&#21547;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;$&lt;/span&gt;&lt;/tt&gt; &#65288;&#23383;&#31526;&#20018;&#32467;&#23614;&#21305;&#37197;&#31526;&#65289;&#65292;&#20294;&#26159;&#21253;&#21547;&#20102;&#19968;&#20010;&#26012;&#26438;&#12290; &#27599;&#24403;Django&#36935;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;include()&lt;/span&gt;&lt;/tt&gt; &#26102;&#65292;&#23427;&#23558;&#25130;&#26029;&#21305;&#37197;&#30340;URL&#65292;&#24182;&#25226;&#21097;&#20313;&#30340;&#23383;&#31526;&#20018;&#21457;&#24448;&#21253;&#21547;&#30340;URLconf&#20316;&#36827;&#19968;&#27493;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn231&quot;&gt;&#32487;&#32493;&#30475;&#36825;&#20010;&#20363;&#23376;&#65292;&#36825;&#37324;&#23601;&#26159;&#34987;&#21253;&#21547;&#30340;URLconf &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.blog.urls&lt;/span&gt;&lt;/tt&gt; &#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn233&quot;&gt;from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^(\d\d\d\d)/$&apos;, &apos;mysite.blog.views.year_detail&apos;),
    (r&apos;^(\d\d\d\d)/(\d\d)/$&apos;, &apos;mysite.blog.views.month_detail&apos;),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn234&quot;&gt;&#36890;&#36807;&#36825;&#20004;&#20010;URLconf&#65292;&#19979;&#38754;&#26159;&#19968;&#20123;&#22788;&#29702;&#35831;&#27714;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn235&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn235&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/weblog/2007/&lt;/span&gt;&lt;/tt&gt; &#65306;&#22312;&#31532;&#19968;&#20010;URLconf&#20013;&#65292;&#27169;&#24335; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;r&apos;^weblog/&apos;&lt;/span&gt;&lt;/tt&gt; &#34987;&#21305;&#37197;&#12290; &#22240;&#20026;&#23427;&#26159;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;include()&lt;/span&gt;&lt;/tt&gt; &#65292;Django&#23558;&#25130;&#25481;&#25152;&#26377;&#21305;&#37197;&#30340;&#25991;&#26412;&#65292;&#22312;&#36825;&#37324;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;weblog/&apos;&lt;/span&gt;&lt;/tt&gt; &#12290;URL&#21097;&#20313;&#30340;&#37096;&#20998;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;2007/&lt;/span&gt;&lt;/tt&gt; &#65292; &#23558;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.blog.urls&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;URLconf&#30340;&#31532;&#19968;&#34892;&#20013;&#34987;&#21305;&#37197;&#21040;&#12290; URL&#20173;&#23384;&#22312;&#30340;&#37096;&#20998;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;2007/&lt;/span&gt;&lt;/tt&gt; ,&#19982;&#31532;&#19968;&#34892;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.blog.urls&lt;/span&gt;&lt;/tt&gt;URL&#35774;&#32622;&#30456;&#21305;&#37197;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn236&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn236&quot;&gt;/weblog//2007/(&#21253;&#21547;&#20004;&#20010;&#26012;&#26464;) &#22312;&#31532;&#19968;&#20010;URLconf&#20013;,r&#8217;^weblog/&#8217;&#21305;&#37197;
&#22240;&#20026;&#23427;&#26377;&#19968;&#20010;include(),django&#21435;&#25481;&#20102;&#21305;&#37197;&#30340;&#37096;,&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#21305;&#37197;&#30340;&#37096;&#20998;&#26159;&#8217;weblog/&#8217; &#21097;&#19979;&#30340;&#37096;&#20998;&#26159;/2007/ (&#26368;&#21069;&#38754;&#26377;&#19968;&#20010;&#26012;&#26464;),&#19981;&#21305;&#37197;mysite.blog.urls&#20013;&#30340;&#20219;&#20309;&#19968;&#34892;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn237&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn237&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/about/&lt;/span&gt;&lt;/tt&gt; : &#36825;&#20010;&#21305;&#37197;&#31532;&#19968;&#20010;URLconf&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.views.about&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;section&quot; id=&quot;include&quot;&gt;
&lt;span id=&quot;cn238&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn238&quot;&gt;&#25429;&#33719;&#30340;&#21442;&#25968;&#22914;&#20309;&#21644;include()&#21327;&#21516;&#24037;&#20316;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn239&quot;&gt;&#19968;&#20010;&#34987;&#21253;&#21547;&#30340;URLconf&#25509;&#25910;&#20219;&#20309;&#26469;&#33258;parent URLconfs&#30340;&#34987;&#25429;&#33719;&#30340;&#21442;&#25968;&#65292;&#27604;&#22914;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn241&quot;&gt;# root urls.py

from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^(?P&amp;lt;username&amp;gt;\w+)/blog/&apos;, include(&apos;foo.urls.blog&apos;)),
)

# foo/urls/blog.py

from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^$&apos;, &apos;foo.views.blog_index&apos;),
    (r&apos;^archive/$&apos;, &apos;foo.views.blog_archive&apos;),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn242&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#34987;&#25429;&#33719;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;username&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#23558;&#20256;&#36882;&#32473;&#34987;&#21253;&#21547;&#30340; URLconf&#65292;&#36827;&#32780;&#20256;&#36882;&#32473;&#37027;&#20010;URLconf&#20013;&#30340; &lt;em&gt;&#27599;&#19968;&#20010;&lt;/em&gt; &#35270;&#22270;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn243&quot;&gt;&#27880;&#24847;&#65292;&#36825;&#20010;&#34987;&#25429;&#33719;&#30340;&#21442;&#25968; &lt;em&gt;&#24635;&#26159;&lt;/em&gt; &#20256;&#36882;&#21040;&#34987;&#21253;&#21547;&#30340;URLconf&#20013;&#30340; &lt;em&gt;&#27599;&#19968;&lt;/em&gt; &#34892;&#65292;&#19981;&#31649;&#37027;&#20123;&#34892;&#23545;&#24212;&#30340;&#35270;&#22270;&#26159;&#21542;&#38656;&#35201;&#36825;&#20123;&#21442;&#25968;&#12290; &#22240;&#27492;&#65292;&#36825;&#20010;&#25216;&#26415;&#21482;&#26377;&#22312;&#20320;&#30830;&#23454;&#38656;&#35201;&#37027;&#20010;&#34987;&#20256;&#36882;&#30340;&#21442;&#25968;&#30340;&#26102;&#20505;&#25165;&#26174;&#24471;&#26377;&#29992;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;urlconf-include&quot;&gt;
&lt;span id=&quot;cn244&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn244&quot;&gt;&#39069;&#22806;&#30340;URLconf&#22914;&#20309;&#21644;include()&#21327;&#21516;&#24037;&#20316;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn245&quot;&gt;&#30456;&#20284;&#30340;&#65292;&#20320;&#21487;&#20197;&#20256;&#36882;&#39069;&#22806;&#30340;URLconf&#36873;&#39033;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;include()&lt;/span&gt;&lt;/tt&gt; , &#23601;&#20687;&#20320;&#21487;&#20197;&#36890;&#36807;&#23383;&#20856;&#20256;&#36882;&#39069;&#22806;&#30340;URLconf&#36873;&#39033;&#21040;&#26222;&#36890;&#30340;&#35270;&#22270;&#12290; &#24403;&#20320;&#36825;&#26679;&#20570;&#30340;&#26102;&#20505;&#65292;&#34987;&#21253;&#21547;URLconf&#30340; &lt;em&gt;&#27599;&#19968;&lt;/em&gt; &#34892;&#37117;&#20250;&#25910;&#21040;&#37027;&#20123;&#39069;&#22806;&#30340;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn246&quot;&gt;&#27604;&#22914;&#65292;&#19979;&#38754;&#30340;&#20004;&#20010;URLconf&#22312;&#21151;&#33021;&#19978;&#26159;&#30456;&#31561;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn247&quot;&gt;&#31532;&#19968;&#20010;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn249&quot;&gt;# urls.py

from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^blog/&apos;, include(&apos;inner&apos;), {&apos;blogid&apos;: 3}),
)

# inner.py

from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^archive/$&apos;, &apos;mysite.views.archive&apos;),
    (r&apos;^about/$&apos;, &apos;mysite.views.about&apos;),
    (r&apos;^rss/$&apos;, &apos;mysite.views.rss&apos;),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn250&quot;&gt;&#31532;&#20108;&#20010;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn252&quot;&gt;# urls.py

from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^blog/&apos;, include(&apos;inner&apos;)),
)

# inner.py

from django.conf.urls.defaults import *

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^archive/$&apos;, &apos;mysite.views.archive&apos;, {&apos;blogid&apos;: 3}),
    (r&apos;^about/$&apos;, &apos;mysite.views.about&apos;, {&apos;blogid&apos;: 3}),
    (r&apos;^rss/$&apos;, &apos;mysite.views.rss&apos;, {&apos;blogid&apos;: 3}),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn253&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#21644;&#21069;&#38754;&#20851;&#20110;&#34987;&#25429;&#33719;&#30340;&#21442;&#25968;&#19968;&#26679;&#65288;&#22312;&#19978;&#19968;&#33410;&#23601;&#35299;&#37322;&#36807;&#36825;&#19968;&#28857;&#65289;&#65292;&#39069;&#22806;&#30340;&#36873;&#39033;&#23558; &lt;em&gt;&#24635;&#26159;&lt;/em&gt; &#34987;&#20256;&#36882;&#21040;&#34987;&#21253;&#21547;&#30340;URLconf&#20013;&#30340; &lt;em&gt;&#27599;&#19968;&lt;/em&gt; &#34892;&#65292;&#19981;&#31649;&#37027;&#19968;&#34892;&#23545;&#24212;&#30340;&#35270;&#22270;&#26159;&#21542;&#30830;&#23454;&#20316;&#20026;&#26377;&#25928;&#21442;&#25968;&#25509;&#25910;&#36825;&#20123;&#36873;&#39033;&#65292;&#22240;&#27492;&#65292;&#36825;&#20010;&#25216;&#26415;&#21482;&#26377;&#22312;&#20320;&#30830;&#23454;&#38656;&#35201;&#37027;&#20010;&#34987;&#20256;&#36882;&#30340;&#39069;&#22806;&#21442;&#25968;&#30340;&#26102;&#20505;&#25165;&#26174;&#24471;&#26377;&#29992;&#12290; &#22240;&#20026;&#36825;&#20010;&#21407;&#22240;&#65292;&#36825;&#31181;&#25216;&#26415;&#20165;&#24403;&#20320;&#30830;&#20449;&#22312;&#28041;&#21450;&#21040;&#30340;&#25509;&#21463;&#21040;&#39069;&#22806;&#20320;&#32473;&#20986;&#30340;&#36873;&#39033;&#30340;&#27599;&#20010;URLconf&#26102;&#26377;&#29992;&#30340;&#25165;&#22863;&#25928;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id19&quot;&gt;
&lt;span id=&quot;cn254&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn254&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn255&quot;&gt;&#36825;&#19968;&#31456;&#25552;&#20379;&#20102;&#24456;&#22810;&#39640;&#32423;&#35270;&#22270;&#21644;URLconfs&#30340;&#23567;&#25552;&#31034;&#21644;&#25216;&#24039;&#12290; &#25509;&#19979;&#26469;&#65292;&#22312;&lt;a class=&quot;reference external&quot; href=&quot;../chapter09/&quot;&gt;Chapter 9&lt;/a&gt;,&#25105;&#20204;&#23558;&#20250;&#23558;&#36825;&#20010;&#20808;&#36827;&#30340;&#22788;&#29702;&#26041;&#26696;&#24102;&#32473;djangos&#27169;&#26495;&#31995;&#32479;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn256&quot;&gt;GNU Free Document License. Hosting&#20844;&#21496;&#27575;&#21220;&#25552;&#20379;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter09</id>
        <title type="html">chapter09</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter09"/>
        <published>2015-02-26T23:25:10+08:00</published>
        <updated>2015-02-26T23:25:10+08:00</updated> 
        <category term="/General" label="General" />
        <summary type="html">&lt;span id=&quot;cn181&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn181&quot;&gt;&#33258;&#23450;&#20041;&#27169;&#26495;&#36807;&#28388;&#22120;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn182&quot;&gt;&#33258;&#23450;&#20041;&#36807;&#28388;&#22120;&#23601;&#26159;&#26377;&#19968;&#20010;&#25110;&#20004;&#20010;&#21442;&#25968;&#30340;Python&#20989;&#25968;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn183&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn183&quot;&gt;(&#36755;&#20837;)&#21464;&#37327;&#30340;&#20540;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn184&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn184&quot;&gt;&#21442;&#25968;&#30340;&#20540;&#65292; &#21487;&#20197;&#26159;&#40664;&#35748;&#20540;&#25110;&#32773;&#23436;&#20840;&#30041;&#31354;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#20363;&#22914;&#65292;&#22312;&#36807;&#28388;&#22120; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;var|foo:&quot;bar&quot;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#20013; &#65292;&#36807;&#28388;&#22120; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo&lt;/span&gt;&lt;/tt&gt; &#20250;&#34987;&#20256;&#20837;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;var&lt;/span&gt;&lt;/tt&gt; &#21644;&#40664;&#35748;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;bar&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#36807;&#28388;&#22120;&#20989;&#25968;&#24212;&#35813;&#24635;&#26377;&#36820;&#22238;&#20540;&#12290; &#32780;&#19988;&#19981;&#33021;&#35302;&#21457;&#24322;&#24120;&#65292;&#23427;&#20204;&#37117;&#24212;&#35813;&#38745;&#38745;&#22320;&#22833;&#36133;&#12290; &#22914;&#26524;&#20986;&#29616;&#38169;&#35823;&#65292;&#24212;&#35813;&#36820;&#22238;&#19968;&#20010;&#21407;&#22987;&#36755;&#20837;&#25110;&#32773;&#31354;&#23383;&#31526;&#20018;&#65292;&#36825;&#20250;&#26356;&#26377;&#24847;&#20041;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn187&quot;&gt;&#36825;&#37324;&#26159;&#19968;&#20123;&#23450;&#20041;&#36807;&#28388;&#22120;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn189&quot;&gt;def cut(value, arg):
    &quot;Removes all values of arg from the given string&quot;
    return value.replace(arg, &apos;&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20010;&#21487;&#20197;&#29992;&#26469;&#21435;&#25481;&#21464;&#37327;&#20540;&#31354;&#26684;&#30340;&#36807;&#28388;&#22120;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn192&quot;&gt;{{ somevariable|cut:&quot; &quot; }}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&#22823;&#22810;&#25968;&#36807;&#28388;&#22120;&#24182;&#19981;&#38656;&#35201;&#21442;&#25968;&#12290; &#19979;&#38754;&#30340;&#20363;&#23376;&#25226;&#21442;&#25968;&#20174;&#20320;&#30340;&#20989;&#25968;&#20013;&#25343;&#25481;&#20102;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn195&quot;&gt;def lower(value): # Only one argument.
    &quot;Converts a string into all lowercase&quot;
    return value.lower()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn196&quot;&gt;&#24403;&#20320;&#23450;&#20041;&#23436;&#36807;&#28388;&#22120;&#21518;&#65292;&#20320;&#38656;&#35201;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Library&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&#26469;&#27880;&#20876;&#23427;&#65292;&#36825;&#26679;&#23601;&#33021;&#36890;&#36807;Django&#30340;&#27169;&#26495;&#35821;&#35328;&#26469;&#20351;&#29992;&#20102;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn198&quot;&gt;register.filter(&apos;cut&apos;, cut)
register.filter(&apos;lower&apos;, lower)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Library.filter()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#38656;&#35201;&#20004;&#20010;&#21442;&#25968;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn200&quot;&gt;&#36807;&#28388;&#22120;&#30340;&#21517;&#31216;&#65288;&#19968;&#20010;&#23383;&#20018;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn201&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn201&quot;&gt;&#36807;&#28388;&#22120;&#20989;&#25968;&#26412;&#36523;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn202&quot;&gt;&#22914;&#26524;&#20320;&#20351;&#29992;&#30340;&#26159;Python 2.4&#25110;&#32773;&#26356;&#26032;&#30340;&#29256;&#26412;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#35013;&#39280;&#22120;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;register.filter()&lt;/span&gt;&lt;/tt&gt;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn204&quot;&gt;@register.filter(name=&apos;cut&apos;)
def cut(value, arg):
    return value.replace(arg, &apos;&apos;)

@register.filter
def lower(value):
    return value.lower()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn205&quot;&gt;&#22914;&#26524;&#20320;&#24819;&#31532;&#20108;&#20010;&#20363;&#23376;&#37027;&#26679;&#19981;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#65292;&#37027;&#20040;Django&#20250;&#25226;&#20989;&#25968;&#21517;&#24403;&#20316;&#36807;&#28388;&#22120;&#30340;&#21517;&#23383;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn206&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20010;&#23436;&#25972;&#30340;&#27169;&#26495;&#24211;&#30340;&#20363;&#23376;&#65292;&#23427;&#21253;&#21547;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cut&lt;/span&gt;&lt;/tt&gt; &#36807;&#28388;&#22120;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn208&quot;&gt;from django import template

register = template.Library()

@register.filter(name=&apos;cut&apos;)
def cut(value, arg):
    return value.replace(arg, &apos;&apos;)
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id16&quot;&gt;
&lt;span id=&quot;cn209&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&#33258;&#23450;&#20041;&#27169;&#26495;&#26631;&#31614;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&#26631;&#31614;&#35201;&#27604;&#36807;&#28388;&#22120;&#22797;&#26434;&#20123;&#65292;&#22240;&#20026;&#26631;&#31614;&#20960;&#20046;&#33021;&#20570;&#20219;&#20309;&#20107;&#24773;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn211&quot;&gt;&#31532;&#22235;&#31456;&#25551;&#36848;&#20102;&#27169;&#26495;&#31995;&#32479;&#30340;&#20004;&#27493;&#22788;&#29702;&#36807;&#31243;&#65306;
&#32534;&#35793;&#21644;&#21576;&#29616;&#12290; &#20026;&#20102;&#33258;&#23450;&#20041;&#19968;&#20010;&#27169;&#26495;&#26631;&#31614;&#65292;&#20320;&#38656;&#35201;&#21578;&#35785;Django&#24403;&#36935;&#21040;&#20320;&#30340;&#26631;&#31614;&#26102;&#24590;&#26679;&#36827;&#34892;&#36825;&#20010;&#36807;&#31243;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn212&quot;&gt;&#24403;Django&#32534;&#35793;&#19968;&#20010;&#27169;&#26495;&#26102;&#65292;&#23427;&#23558;&#21407;&#22987;&#27169;&#26495;&#20998;&#25104;&#19968;&#20010;&#20010; &lt;em&gt;&#33410;&#28857;&lt;/em&gt; &#12290;&#27599;&#20010;&#33410;&#28857;&#37117;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.Node&lt;/span&gt;&lt;/tt&gt; &#30340;&#19968;&#20010;&#23454;&#20363;&#65292;&#24182;&#19988;&#20855;&#22791; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290; &#20110;&#26159;&#65292;&#19968;&#20010;&#24050;&#32534;&#35793;&#30340;&#27169;&#26495;&#23601;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#33410;&#28857;&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#30340;&#19968;&#20010;&#21015;&#34920;&#12290; &#20363;&#22914;&#65292;&#30475;&#30475;&#36825;&#20010;&#27169;&#26495;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn214&quot;&gt;Hello, {{ person.name }}.

{% ifequal name.birthday today %}
    Happy birthday!
{% else %}
    Be sure to come back on your birthday
    for a splendid surprise message.
{% endifequal %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn215&quot;&gt;&#34987;&#32534;&#35793;&#30340;&#27169;&#26495;&#34920;&#29616;&#20026;&#33410;&#28857;&#21015;&#34920;&#30340;&#24418;&#24335;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn216&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn216&quot;&gt;&#25991;&#26412;&#33410;&#28857;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;Hello,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&quot;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn217&quot;&gt;&#21464;&#37327;&#33410;&#28857;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;person.name&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn218&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn218&quot;&gt;&#25991;&#26412;&#33410;&#28857;: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;.\n\n&quot;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn219&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn219&quot;&gt;IfEqual&#33410;&#28857;: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name.birthday&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;today&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn220&quot;&gt;&#24403;&#20320;&#35843;&#29992;&#19968;&#20010;&#24050;&#32534;&#35793;&#27169;&#26495;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#26102;&#65292;&#27169;&#26495;&#23601;&#20250;&#29992;&#32473;&#23450;&#30340;context&#26469;&#35843;&#29992;&#27599;&#20010;&#22312;&#23427;&#30340;&#33410;&#28857;&#21015;&#34920;&#19978;&#30340;&#25152;&#26377;&#33410;&#28857;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290; &#36825;&#20123;&#28210;&#26579;&#30340;&#32467;&#26524;&#21512;&#24182;&#36215;&#26469;&#65292;&#24418;&#25104;&#20102;&#27169;&#26495;&#30340;&#36755;&#20986;&#12290; &#22240;&#27492;&#65292;&#35201;&#33258;&#23450;&#20041;&#27169;&#26495;&#26631;&#31614;&#65292;&#20320;&#38656;&#35201;&#25351;&#26126;&#21407;&#22987;&#27169;&#26495;&#26631;&#31614;&#22914;&#20309;&#36716;&#25442;&#25104;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#33410;&#28857;&lt;/span&gt;&lt;/tt&gt;&#65288;&#32534;&#35793;&#20989;&#25968;&#65289;&#21644;&#33410;&#28857;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#23436;&#25104;&#30340;&#21151;&#33021; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn221&quot;&gt;&#22312;&#19979;&#38754;&#30340;&#31456;&#33410;&#20013;&#65292;&#25105;&#20204;&#23558;&#35814;&#32454;&#35299;&#35828;&#20889;&#19968;&#20010;&#33258;&#23450;&#20041;&#26631;&#31614;&#26102;&#30340;&#25152;&#26377;&#27493;&#39588;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id17&quot;&gt;
&lt;span id=&quot;cn222&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn222&quot;&gt;&#32534;&#20889;&#32534;&#35793;&#20989;&#25968;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn223&quot;&gt;&#24403;&#36935;&#21040;&#19968;&#20010;&#27169;&#26495;&#26631;&#31614;&#65288;template tag&#65289;&#26102;&#65292;&#27169;&#26495;&#35299;&#26512;&#22120;&#23601;&#20250;&#25226;&#26631;&#31614;&#21253;&#21547;&#30340;&#20869;&#23481;&#65292;&#20197;&#21450;&#27169;&#26495;&#35299;&#26512;&#22120;&#33258;&#24049;&#20316;&#20026;&#21442;&#25968;&#35843;&#29992;&#19968;&#20010;python&#20989;&#25968;&#12290; &#36825;&#20010;&#20989;&#25968;&#36127;&#36131;&#36820;&#22238;&#19968;&#20010;&#21644;&#24403;&#21069;&#27169;&#26495;&#26631;&#31614;&#20869;&#23481;&#30456;&#23545;&#24212;&#30340;&#33410;&#28857;&#65288;Node&#65289;&#30340;&#23454;&#20363;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn224&quot;&gt;&#20363;&#22914;&#65292;&#20889;&#19968;&#20010;&#26174;&#31034;&#24403;&#21069;&#26085;&#26399;&#30340;&#27169;&#26495;&#26631;&#31614;&#65306;{% current_time %}&#12290;&#35813;&#26631;&#31614;&#20250;&#26681;&#25454;&#21442;&#25968;&#25351;&#23450;&#30340; strftime &#26684;&#24335;&#65288;&#21442;&#35265;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://www.djangoproject.com/r/python/strftime/&lt;/span&gt;&lt;/tt&gt;&#65289;&#26174;&#31034;&#24403;&#21069;&#26102;&#38388;&#12290;&#39318;&#20808;&#30830;&#23450;&#26631;&#31614;&#30340;&#35821;&#27861;&#26159;&#20010;&#22909;&#20027;&#24847;&#12290; &#22312;&#36825;&#20010;&#20363;&#23376;&#37324;&#65292;&#26631;&#31614;&#24212;&#35813;&#36825;&#26679;&#20351;&#29992;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn226&quot;&gt;&amp;lt;p&amp;gt;The time is {% current_time &quot;%Y-%m-%d %I:%M %p&quot; %}.&amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn227&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn228&quot;&gt;&#27809;&#38169;, &#36825;&#20010;&#27169;&#26495;&#26631;&#31614;&#26159;&#22810;&#20313;&#30340;&#65292;Django&#40664;&#35748;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;now&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#29992;&#26356;&#31616;&#21333;&#30340;&#35821;&#27861;&#23436;&#25104;&#20102;&#21516;&#26679;&#30340;&#24037;&#20316;&#12290; &#36825;&#20010;&#27169;&#26495;&#26631;&#31614;&#22312;&#36825;&#37324;&#21482;&#26159;&#20316;&#20026;&#19968;&#20010;&#20363;&#23376;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn229&quot;&gt;&#36825;&#20010;&#20989;&#25968;&#30340;&#20998;&#26512;&#22120;&#20250;&#33719;&#21462;&#21442;&#25968;&#24182;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Node&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn231&quot;&gt;from django import template

register = template.Library()

def do_current_time(parser, token):
    try:
        # split_contents() knows not to split quoted strings.
        tag_name, format_string = token.split_contents()
    except ValueError:
        msg = &apos;%r tag requires a single argument&apos; % token.split_contents()[0]
        raise template.TemplateSyntaxError(msg)
    return CurrentTimeNode(format_string[1:-1])
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn232&quot;&gt;&#36825;&#37324;&#38656;&#35201;&#35828;&#26126;&#30340;&#22320;&#26041;&#24456;&#22810;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn233&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn233&quot;&gt;&#27599;&#20010;&#26631;&#31614;&#32534;&#35793;&#20989;&#25968;&#26377;&#20004;&#20010;&#21442;&#25968;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;parser&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;token&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;parser&lt;/span&gt;&lt;/tt&gt;&#26159;&#27169;&#26495;&#35299;&#26512;&#22120;&#23545;&#35937;&#12290; &#25105;&#20204;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#24182;&#19981;&#20351;&#29992;&#23427;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;token&lt;/span&gt;&lt;/tt&gt;&#26159;&#27491;&#22312;&#34987;&#35299;&#26512;&#30340;&#35821;&#21477;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn234&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn234&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;token.contents&lt;/span&gt;&lt;/tt&gt; &#26159;&#21253;&#21547;&#26377;&#26631;&#31614;&#21407;&#22987;&#20869;&#23481;&#30340;&#23383;&#31526;&#20018;&#12290; &#22312;&#25105;&#20204;&#30340;&#20363;&#23376;&#20013;&#65292;&#23427;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;current_time&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&quot;%Y-%m-%d&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%I:%M&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%p&quot;&apos;&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn235&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn235&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;token.split_contents()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#25353;&#31354;&#26684;&#25286;&#20998;&#21442;&#25968;&#21516;&#26102;&#20445;&#35777;&#24341;&#21495;&#20013;&#30340;&#23383;&#31526;&#20018;&#19981;&#25286;&#20998;&#12290; &#24212;&#35813;&#36991;&#20813;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;token.contents.split()&lt;/span&gt;&lt;/tt&gt; &#65288;&#20165;&#20351;&#29992;Python&#30340;&#26631;&#20934;&#23383;&#31526;&#20018;&#25286;&#20998;&#65289;&#12290; &#23427;&#19981;&#22815;&#20581;&#22766;&#65292;&#22240;&#20026;&#23427;&#21482;&#26159;&#31616;&#21333;&#30340;&#25353;&#29031;&#25152;&#26377;&#31354;&#26684;&#36827;&#34892;&#25286;&#20998;&#65292;&#21253;&#25324;&#37027;&#20123;&#24341;&#21495;&#24341;&#36215;&#26469;&#30340;&#23383;&#31526;&#20018;&#20013;&#30340;&#31354;&#26684;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn236&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn236&quot;&gt;&#36825;&#20010;&#20989;&#25968;&#21487;&#20197;&#25243;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.TemplateSyntaxError&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#20010;&#24322;&#24120;&#25552;&#20379;&#25152;&#26377;&#35821;&#27861;&#38169;&#35823;&#30340;&#26377;&#29992;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn237&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn237&quot;&gt;&#19981;&#35201;&#25226;&#26631;&#31614;&#21517;&#31216;&#30828;&#32534;&#30721;&#22312;&#20320;&#30340;&#38169;&#35823;&#20449;&#24687;&#20013;&#65292;&#22240;&#20026;&#36825;&#26679;&#20250;&#25226;&#26631;&#31614;&#21517;&#31216;&#21644;&#20320;&#30340;&#20989;&#25968;&#32806;&#21512;&#22312;&#19968;&#36215;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;token.split_contents()[0]&lt;/span&gt;&lt;/tt&gt;&lt;em&gt;&#24635;&#26159;&lt;/em&gt;&#35760;&#24405;&#26631;&#31614;&#30340;&#21517;&#23383;&#65292;&#23601;&#31639;&#26631;&#31614;&#27809;&#26377;&#20219;&#20309;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn238&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn238&quot;&gt;&#36825;&#20010;&#20989;&#25968;&#36820;&#22238;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentTimeNode&lt;/span&gt;&lt;/tt&gt; &#65288;&#31245;&#21518;&#25105;&#20204;&#23558;&#21019;&#24314;&#23427;&#65289;&#65292;&#23427;&#21253;&#21547;&#20102;&#33410;&#28857;&#38656;&#35201;&#30693;&#36947;&#30340;&#20851;&#20110;&#36825;&#20010;&#26631;&#31614;&#30340;&#20840;&#37096;&#20449;&#24687;&#12290; &#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#23427;&#21482;&#26159;&#20256;&#36882;&#20102;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;%Y-%m-%d&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%I:%M&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%p&quot;&lt;/span&gt;&lt;/tt&gt; &#12290;&#27169;&#26495;&#26631;&#31614;&#24320;&#22836;&#21644;&#32467;&#23614;&#30340;&#24341;&#21495;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;format_string[1:-1]&lt;/span&gt;&lt;/tt&gt; &#38500;&#21435;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn239&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn239&quot;&gt;&#27169;&#26495;&#26631;&#31614;&#32534;&#35793;&#20989;&#25968; &lt;em&gt;&#24517;&#39035;&lt;/em&gt; &#36820;&#22238;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Node&lt;/span&gt;&lt;/tt&gt; &#23376;&#31867;&#65292;&#36820;&#22238;&#20854;&#23427;&#20540;&#37117;&#26159;&#38169;&#30340;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id18&quot;&gt;
&lt;span id=&quot;cn240&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn240&quot;&gt;&#32534;&#20889;&#27169;&#26495;&#33410;&#28857;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn241&quot;&gt;&#32534;&#20889;&#33258;&#23450;&#20041;&#26631;&#31614;&#30340;&#31532;&#20108;&#27493;&#23601;&#26159;&#23450;&#20041;&#19968;&#20010;&#25317;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Node&lt;/span&gt;&lt;/tt&gt; &#23376;&#31867;&#12290; &#32487;&#32493;&#21069;&#38754;&#30340;&#20363;&#23376;&#65292;&#25105;&#20204;&#38656;&#35201;&#23450;&#20041; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentTimeNode&lt;/span&gt;&lt;/tt&gt; &#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn243&quot;&gt;import datetime

class CurrentTimeNode(template.Node):
    def __init__(self, format_string):
        self.format_string = str(format_string)

    def render(self, context):
        now = datetime.datetime.now()
        return now.strftime(self.format_string)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn244&quot;&gt;&#36825;&#20004;&#20010;&#20989;&#25968;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__init__()&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#65289;&#19982;&#27169;&#26495;&#22788;&#29702;&#20013;&#30340;&#20004;&#27493;&#65288;&#32534;&#35793;&#19982;&#28210;&#26579;&#65289;&#30452;&#25509;&#23545;&#24212;&#12290; &#36825;&#26679;&#65292;&#21021;&#22987;&#21270;&#20989;&#25968;&#20165;&#20165;&#38656;&#35201;&#23384;&#20648;&#21518;&#38754;&#35201;&#29992;&#21040;&#30340;&#26684;&#24335;&#23383;&#31526;&#20018;&#65292;&#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#25165;&#20570;&#30495;&#27491;&#30340;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn245&quot;&gt;&#19982;&#27169;&#26495;&#36807;&#28388;&#22120;&#19968;&#26679;&#65292;&#36825;&#20123;&#28210;&#26579;&#20989;&#25968;&#24212;&#35813;&#38745;&#38745;&#22320;&#25429;&#33719;&#38169;&#35823;&#65292;&#32780;&#19981;&#26159;&#25243;&#20986;&#38169;&#35823;&#12290; &#27169;&#26495;&#26631;&#31614;&#21482;&#20801;&#35768;&#22312;&#32534;&#35793;&#30340;&#26102;&#20505;&#25243;&#20986;&#38169;&#35823;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id19&quot;&gt;
&lt;span id=&quot;cn246&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn246&quot;&gt;&#27880;&#20876;&#26631;&#31614;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn247&quot;&gt;&#26368;&#21518;&#65292;&#20320;&#38656;&#35201;&#29992;&#20320;&#27169;&#22359;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Library&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&#27880;&#20876;&#36825;&#20010;&#26631;&#31614;&#12290;
&#27880;&#20876;&#33258;&#23450;&#20041;&#26631;&#31614;&#19982;&#27880;&#20876;&#33258;&#23450;&#20041;&#36807;&#28388;&#22120;&#38750;&#24120;&#31867;&#20284;&#65288;&#22914;&#21069;&#25991;&#25152;&#36848;&#65289;&#12290; &#21482;&#38656;&#23454;&#20363;&#21270;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template.Library&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&#28982;&#21518;&#35843;&#29992;&#23427;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;tag()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn249&quot;&gt;register.tag(&apos;current_time&apos;, do_current_time)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn250&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;tag()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#38656;&#35201;&#20004;&#20010;&#21442;&#25968;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn251&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn251&quot;&gt;&#27169;&#26495;&#26631;&#31614;&#30340;&#21517;&#23383;&#65288;&#23383;&#31526;&#20018;&#65289;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn252&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn252&quot;&gt;&#32534;&#35793;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn253&quot;&gt;&#21644;&#27880;&#20876;&#36807;&#28388;&#22120;&#31867;&#20284;&#65292;&#20063;&#21487;&#20197;&#22312;Python2.4&#21450;&#20854;&#20197;&#19978;&#29256;&#26412;&#20013;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;register.tag&lt;/span&gt;&lt;/tt&gt;&#35013;&#39280;&#22120;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn255&quot;&gt;@register.tag(name=&quot;current_time&quot;)
def do_current_time(parser, token):
    # ...

@register.tag
def shout(parser, token):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn256&quot;&gt;&#22914;&#26524;&#20320;&#20687;&#22312;&#31532;&#20108;&#20010;&#20363;&#23376;&#20013;&#37027;&#26679;&#24573;&#30053; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#30340;&#35805;&#65292;Django&#20250;&#20351;&#29992;&#20989;&#25968;&#21517;&#31216;&#20316;&#20026;&#26631;&#31614;&#21517;&#31216;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id20&quot;&gt;
&lt;span id=&quot;cn257&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn257&quot;&gt;&#22312;&#19978;&#19979;&#25991;&#20013;&#35774;&#32622;&#21464;&#37327;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn258&quot;&gt;&#21069;&#19968;&#33410;&#30340;&#20363;&#23376;&#21482;&#26159;&#31616;&#21333;&#30340;&#36820;&#22238;&#19968;&#20010;&#20540;&#12290; &#24456;&#22810;&#26102;&#20505;&#35774;&#32622;&#19968;&#20010;&#27169;&#26495;&#21464;&#37327;&#32780;&#38750;&#36820;&#22238;&#20540;&#20063;&#24456;&#26377;&#29992;&#12290; &#37027;&#26679;&#65292;&#27169;&#26495;&#20316;&#32773;&#23601;&#21482;&#33021;&#20351;&#29992;&#20320;&#30340;&#27169;&#26495;&#26631;&#31614;&#25152;&#35774;&#32622;&#30340;&#21464;&#37327;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn259&quot;&gt;&#35201;&#22312;&#19978;&#19979;&#25991;&#20013;&#35774;&#32622;&#21464;&#37327;&#65292;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#30340;context&#23545;&#35937;&#19978;&#20351;&#29992;&#23383;&#20856;&#36171;&#20540;&#12290; &#36825;&#37324;&#26159;&#19968;&#20010;&#20462;&#25913;&#36807;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentTimeNode&lt;/span&gt;&lt;/tt&gt; &#65292;&#20854;&#20013;&#35774;&#23450;&#20102;&#19968;&#20010;&#27169;&#26495;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_time&lt;/span&gt;&lt;/tt&gt; &#65292;&#24182;&#27809;&#26377;&#36820;&#22238;&#23427;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn261&quot;&gt;class CurrentTimeNode2(template.Node):
    def __init__(self, format_string):
        self.format_string = str(format_string)

    def render(self, context):
        now = datetime.datetime.now()
        context[&apos;current_time&apos;] = now.strftime(self.format_string)
        return &apos;&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn262&quot;&gt;(&#25105;&#20204;&#25226;&#21019;&#24314;&#20989;&#25968;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;do_current_time2&lt;/span&gt;&lt;/tt&gt;&#21644;&#27880;&#20876;&#32473;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_time2&lt;/span&gt;&lt;/tt&gt;&#27169;&#26495;&#26631;&#31614;&#30340;&#24037;&#20316;&#30041;&#20316;&#35835;&#32773;&#32451;&#20064;&#12290;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn263&quot;&gt;&#27880;&#24847; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#36820;&#22238;&#20102;&#19968;&#20010;&#31354;&#23383;&#31526;&#20018;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#24212;&#24403;&#24635;&#26159;&#36820;&#22238;&#19968;&#20010;&#23383;&#31526;&#20018;&#65292;&#25152;&#20197;&#22914;&#26524;&#27169;&#26495;&#26631;&#31614;&#21482;&#26159;&#35201;&#35774;&#32622;&#21464;&#37327;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#23601;&#24212;&#35813;&#36820;&#22238;&#19968;&#20010;&#31354;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn264&quot;&gt;&#20320;&#24212;&#35813;&#36825;&#26679;&#20351;&#29992;&#36825;&#20010;&#26032;&#29256;&#26412;&#30340;&#26631;&#31614;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn266&quot;&gt;{% current_time2 &quot;%Y-%M-%d %I:%M %p&quot; %}
&amp;lt;p&amp;gt;The time is {{ current_time }}.&amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn267&quot;&gt;&#20294;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentTimeNode2&lt;/span&gt;&lt;/tt&gt; &#26377;&#19968;&#20010;&#38382;&#39064;: &#21464;&#37327;&#21517; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_time&lt;/span&gt;&lt;/tt&gt; &#26159;&#30828;&#32534;&#30721;&#30340;&#12290; &#36825;&#24847;&#21619;&#30528;&#20320;&#24517;&#39035;&#30830;&#23450;&#20320;&#30340;&#27169;&#26495;&#22312;&#20854;&#23427;&#20219;&#20309;&#22320;&#26041;&#37117;&#19981;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;current_time&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#65292;&#22240;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;current_time2&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20250;&#30450;&#30446;&#30340;&#35206;&#30422;&#35813;&#21464;&#37327;&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn268&quot;&gt;&#19968;&#31181;&#26356;&#31616;&#27905;&#30340;&#26041;&#26696;&#26159;&#30001;&#27169;&#26495;&#26631;&#31614;&#26469;&#25351;&#23450;&#38656;&#35201;&#35774;&#23450;&#30340;&#21464;&#37327;&#30340;&#21517;&#31216;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn270&quot;&gt;{% get_current_time &quot;%Y-%M-%d %I:%M %p&quot; as my_current_time %}
&amp;lt;p&amp;gt;The current time is {{ my_current_time }}.&amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn271&quot;&gt;&#20026;&#27492;&#65292;&#20320;&#38656;&#35201;&#37325;&#26500;&#32534;&#35793;&#20989;&#25968;&#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Node&lt;/span&gt;&lt;/tt&gt; &#31867;&#65292;&#22914;&#19979;&#25152;&#31034;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn273&quot;&gt;import re

class CurrentTimeNode3(template.Node):
    def __init__(self, format_string, var_name):
        self.format_string = str(format_string)
        self.var_name = var_name

    def render(self, context):
        now = datetime.datetime.now()
        context[self.var_name] = now.strftime(self.format_string)
        return &apos;&apos;

def do_current_time(parser, token):
    # This version uses a regular expression to parse tag contents.
    try:
        # Splitting by None == splitting by spaces.
        tag_name, arg = token.contents.split(None, 1)
    except ValueError:
        msg = &apos;%r tag requires arguments&apos; % token.contents[0]
        raise template.TemplateSyntaxError(msg)

    m = re.search(r&apos;(.*?) as (\w+)&apos;, arg)
    if m:
        fmt, var_name = m.groups()
    else:
        msg = &apos;%r tag had invalid arguments&apos; % tag_name
        raise template.TemplateSyntaxError(msg)

    if not (fmt[0] == fmt[-1] and fmt[0] in (&apos;&quot;&apos;, &quot;&apos;&quot;)):
        msg = &quot;%r tag&apos;s argument should be in quotes&quot; % tag_name
        raise template.TemplateSyntaxError(msg)

    return CurrentTimeNode3(fmt[1:-1], var_name)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn274&quot;&gt;&#29616;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;do_current_time()&lt;/span&gt;&lt;/tt&gt; &#25226;&#26684;&#24335;&#23383;&#31526;&#20018;&#21644;&#21464;&#37327;&#21517;&#20256;&#36882;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentTimeNode3&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id21&quot;&gt;
&lt;span id=&quot;cn275&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn275&quot;&gt;&#20998;&#26512;&#30452;&#33267;&#21478;&#19968;&#20010;&#27169;&#26495;&#26631;&#31614;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn276&quot;&gt;&#27169;&#26495;&#26631;&#31614;&#21487;&#20197;&#20687;&#21253;&#21547;&#20854;&#23427;&#26631;&#31614;&#30340;&#22359;&#19968;&#26679;&#24037;&#20316;&#65288;&#24819;&#24819; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#31561;&#65289;&#12290; &#35201;&#21019;&#24314;&#19968;&#20010;&#36825;&#26679;&#30340;&#27169;&#26495;&#26631;&#31614;&#65292;&#22312;&#20320;&#30340;&#32534;&#35793;&#20989;&#25968;&#20013;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;parser.parse()&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn277&quot;&gt;&#26631;&#20934;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;comment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#26159;&#36825;&#26679;&#23454;&#29616;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn279&quot;&gt;def do_comment(parser, token):
    nodelist = parser.parse((&apos;endcomment&apos;,))
    parser.delete_first_token()
    return CommentNode()

class CommentNode(template.Node):
    def render(self, context):
        return &apos;&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn280&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;parser.parse()&lt;/span&gt;&lt;/tt&gt; &#25509;&#25910;&#19968;&#20010;&#21253;&#21547;&#20102;&#38656;&#35201;&#20998;&#26512;&#30340;&#27169;&#26495;&#26631;&#31614;&#21517;&#30340;&#20803;&#32452;&#20316;&#20026;&#21442;&#25968;&#12290; &#23427;&#36820;&#22238;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.NodeList&lt;/span&gt;&lt;/tt&gt;&#23454;&#20363;&#65292;&#23427;&#26159;&#19968;&#20010;&#21253;&#21547;&#20102;&#25152;&#26377;&lt;em&gt;Node&lt;/em&gt;&#23545;&#35937;&#30340;&#21015;&#34920;&#65292;&#36825;&#20123;&#23545;&#35937;&#26159;&#35299;&#26512;&#22120;&#22312;&#35299;&#26512;&#21040;&#20219;&#19968;&#20803;&#32452;&#20013;&#25351;&#23450;&#30340;&#26631;&#31614;&#20043;&#21069;&#36935;&#21040;&#30340;&#20869;&#23481;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn281&quot;&gt;&#22240;&#27492;&#22312;&#21069;&#38754;&#30340;&#20363;&#23376;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;nodelist&lt;/span&gt;&lt;/tt&gt; &#26159;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;comment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endcomment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20043;&#38388;&#25152;&#26377;&#33410;&#28857;&#30340;&#21015;&#34920;&#65292;&#19981;&#21253;&#25324; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;comment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endcomment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#33258;&#36523;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn282&quot;&gt;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;parser.parse()&lt;/span&gt;&lt;/tt&gt; &#34987;&#35843;&#29992;&#20043;&#21518;&#65292;&#20998;&#26512;&#22120;&#36824;&#27809;&#26377;&#28165;&#38500; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endcomment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#65292;&#22240;&#27492;&#20195;&#30721;&#38656;&#35201;&#26174;&#24335;&#22320;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;parser.delete_first_token()&lt;/span&gt;&lt;/tt&gt; &#26469;&#38450;&#27490;&#35813;&#26631;&#31614;&#34987;&#22788;&#29702;&#20004;&#27425;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn283&quot;&gt;&#20043;&#21518; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CommentNode.render()&lt;/span&gt;&lt;/tt&gt; &#21482;&#26159;&#31616;&#21333;&#22320;&#36820;&#22238;&#19968;&#20010;&#31354;&#23383;&#31526;&#20018;&#12290; &#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;comment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endcomment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20043;&#38388;&#30340;&#25152;&#26377;&#20869;&#23481;&#37117;&#34987;&#24573;&#30053;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id22&quot;&gt;
&lt;span id=&quot;cn284&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn284&quot;&gt;&#20998;&#26512;&#30452;&#33267;&#21478;&#22806;&#19968;&#20010;&#27169;&#26495;&#26631;&#31614;&#24182;&#20445;&#23384;&#20869;&#23481;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn285&quot;&gt;&#22312;&#21069;&#19968;&#20010;&#20363;&#23376;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;do_comment()&lt;/span&gt;&lt;/tt&gt; &#25243;&#24323;&#20102;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;comment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endcomment&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20043;&#38388;&#30340;&#25152;&#26377;&#20869;&#23481;&#12290;&#24403;&#28982;&#20063;&#21487;&#20197;&#20462;&#25913;&#21644;&#21033;&#29992;&#19979;&#26631;&#31614;&#20043;&#38388;&#30340;&#36825;&#20123;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn286&quot;&gt;&#20363;&#22914;&#65292;&#36825;&#20010;&#33258;&#23450;&#20041;&#27169;&#26495;&#26631;&#31614;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;upper&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#65292;&#23427;&#20250;&#25226;&#23427;&#33258;&#24049;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endupper&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#20043;&#38388;&#30340;&#20869;&#23481;&#21464;&#25104;&#22823;&#20889;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn288&quot;&gt;{% upper %}
    This will appear in uppercase, {{ user_name }}.
{% endupper %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn289&quot;&gt;&#23601;&#20687;&#21069;&#38754;&#30340;&#20363;&#23376;&#19968;&#26679;&#65292;&#25105;&#20204;&#23558;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;parser.parse()&lt;/span&gt;&lt;/tt&gt; &#12290;&#36825;&#27425;&#65292;&#25105;&#20204;&#23558;&#20135;&#29983;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;nodelist&lt;/span&gt;&lt;/tt&gt; &#20256;&#36882;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Node&lt;/span&gt;&lt;/tt&gt; &#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn291&quot;&gt;def do_upper(parser, token):
    nodelist = parser.parse((&apos;endupper&apos;,))
    parser.delete_first_token()
    return UpperNode(nodelist)

class UpperNode(template.Node):
    def __init__(self, nodelist):
        self.nodelist = nodelist

    def render(self, context):
        output = self.nodelist.render(context)
        return output.upper()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn292&quot;&gt;&#36825;&#37324;&#21807;&#19968;&#30340;&#19968;&#20010;&#26032;&#27010;&#24565;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;UpperNode.render()&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;self.nodelist.render(context)&lt;/span&gt;&lt;/tt&gt; &#12290;&#23427;&#23545;&#33410;&#28857;&#21015;&#34920;&#20013;&#30340;&#27599;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Node&lt;/span&gt;&lt;/tt&gt; &#31616;&#21333;&#30340;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn293&quot;&gt;&#26356;&#22810;&#30340;&#22797;&#26434;&#28210;&#26579;&#31034;&#20363;&#35831;&#26597;&#30475; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django/template/defaulttags.py&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ifequal&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ifchanged&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#30340;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id23&quot;&gt;
&lt;span id=&quot;cn294&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn294&quot;&gt;&#31616;&#21333;&#26631;&#31614;&#30340;&#24555;&#25463;&#26041;&#24335;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn295&quot;&gt;&#35768;&#22810;&#27169;&#26495;&#26631;&#31614;&#25509;&#25910;&#21333;&#19968;&#30340;&#23383;&#31526;&#20018;&#21442;&#25968;&#25110;&#32773;&#19968;&#20010;&#27169;&#26495;&#21464;&#37327;&#24341;&#29992;&#65292;&#28982;&#21518;&#29420;&#31435;&#22320;&#26681;&#25454;&#36755;&#20837;&#21464;&#37327;&#21644;&#19968;&#20123;&#20854;&#23427;&#22806;&#37096;&#20449;&#24687;&#36827;&#34892;&#22788;&#29702;&#24182;&#36820;&#22238;&#19968;&#20010;&#23383;&#31526;&#20018;&#12290; &#20363;&#22914;&#65292;&#25105;&#20204;&#20808;&#21069;&#20889;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_time&lt;/span&gt;&lt;/tt&gt;&#26631;&#31614;&#23601;&#26159;&#36825;&#26679;&#19968;&#20010;&#20363;&#23376;&#12290; &#25105;&#20204;&#32473;&#23450;&#20102;&#19968;&#20010;&#26684;&#24335;&#21270;&#23383;&#31526;&#20018;&#65292;&#28982;&#21518;&#23427;&#36820;&#22238;&#19968;&#20010;&#23383;&#31526;&#20018;&#24418;&#24335;&#30340;&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn296&quot;&gt;&#20026;&#20102;&#31616;&#21270;&#36825;&#31867;&#26631;&#31614;&#65292;Django&#25552;&#20379;&#20102;&#19968;&#20010;&#24110;&#21161;&#20989;&#25968;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;simple_tag&lt;/span&gt;&lt;/tt&gt;&#12290;&#36825;&#20010;&#20989;&#25968;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.Library&lt;/span&gt;&lt;/tt&gt;&#30340;&#19968;&#20010;&#26041;&#27861;&#65292;&#23427;&#25509;&#21463;&#19968;&#20010;&#21482;&#26377;&#19968;&#20010;&#21442;&#25968;&#30340;&#20989;&#25968;&#20316;&#21442;&#25968;&#65292;&#25226;&#23427;&#21253;&#35013;&#22312;render&#20989;&#25968;&#21644;&#20043;&#21069;&#25552;&#21450;&#36807;&#30340;&#20854;&#20182;&#30340;&#24517;&#35201;&#21333;&#20301;&#20013;&#65292;&#28982;&#21518;&#36890;&#36807;&#27169;&#26495;&#31995;&#32479;&#27880;&#20876;&#26631;&#31614;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn297&quot;&gt;&#25105;&#20204;&#20043;&#21069;&#30340;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;current_time&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#20110;&#26159;&#21487;&#20197;&#20889;&#25104;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn299&quot;&gt;def current_time(format_string):
    try:
        return datetime.datetime.now().strftime(str(format_string))
    except UnicodeEncodeError:
        return &apos;&apos;

register.simple_tag(current_time)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn300&quot;&gt;&#22312;Python 2.4&#20013;&#65292;&#20063;&#21487;&#20197;&#20351;&#29992;&#35013;&#39280;&#22120;&#35821;&#27861;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn302&quot;&gt;@register.simple_tag
def current_time(token):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn303&quot;&gt;&#26377;&#20851; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;simple_tag&lt;/span&gt;&lt;/tt&gt; &#36741;&#21161;&#20989;&#25968;&#65292;&#38656;&#35201;&#27880;&#24847;&#19979;&#38754;&#19968;&#20123;&#20107;&#24773;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn304&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn304&quot;&gt;&#20256;&#36882;&#32473;&#25105;&#20204;&#30340;&#20989;&#25968;&#30340;&#21482;&#26377;&#65288;&#21333;&#20010;&#65289;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn305&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn305&quot;&gt;&#22312;&#25105;&#20204;&#30340;&#20989;&#25968;&#34987;&#35843;&#29992;&#30340;&#26102;&#20505;&#65292;&#26816;&#26597;&#24517;&#38656;&#21442;&#25968;&#20010;&#25968;&#30340;&#24037;&#20316;&#24050;&#32463;&#23436;&#25104;&#20102;&#65292;&#25152;&#20197;&#25105;&#20204;&#19981;&#38656;&#35201;&#20877;&#20570;&#36825;&#20010;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn306&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn306&quot;&gt;&#21442;&#25968;&#20004;&#36793;&#30340;&#24341;&#21495;&#65288;&#22914;&#26524;&#26377;&#30340;&#35805;&#65289;&#24050;&#32463;&#34987;&#25130;&#25481;&#20102;&#65292;&#25152;&#20197;&#25105;&#20204;&#20250;&#25509;&#25910;&#21040;&#19968;&#20010;&#26222;&#36890;Unicode&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id24&quot;&gt;
&lt;span id=&quot;cn307&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn307&quot;&gt;&#21253;&#21547;&#26631;&#31614;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn308&quot;&gt;&#21478;&#22806;&#19968;&#31867;&#24120;&#29992;&#30340;&#27169;&#26495;&#26631;&#31614;&#26159;&#36890;&#36807;&#28210;&#26579; &lt;em&gt;&#20854;&#20182;&lt;/em&gt; &#27169;&#26495;&#26174;&#31034;&#25968;&#25454;&#30340;&#12290; &#27604;&#22914;&#35828;&#65292;Django&#30340;&#21518;&#21488;&#31649;&#29702;&#30028;&#38754;&#65292;&#23427;&#20351;&#29992;&#20102;&#33258;&#23450;&#20041;&#30340;&#27169;&#26495;&#26631;&#31614;&#26469;&#26174;&#31034;&#26032;&#22686;/&#32534;&#36753;&#34920;&#21333;&#39029;&#38754;&#19979;&#37096;&#30340;&#25353;&#38062;&#12290;
&#37027;&#20123;&#25353;&#38062;&#30475;&#36215;&#26469;&#24635;&#26159;&#19968;&#26679;&#30340;&#65292;&#20294;&#26159;&#38142;&#25509;&#21364;&#38543;&#30528;&#25152;&#32534;&#36753;&#30340;&#23545;&#35937;&#30340;&#19981;&#21516;&#32780;&#25913;&#21464;&#12290; &#36825;&#23601;&#26159;&#19968;&#20010;&#20351;&#29992;&#23567;&#27169;&#26495;&#24456;&#22909;&#30340;&#20363;&#23376;&#65292;&#36825;&#20123;&#23567;&#27169;&#26495;&#23601;&#26159;&#24403;&#21069;&#23545;&#35937;&#30340;&#35814;&#32454;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn309&quot;&gt;&#36825;&#20123;&#25490;&#24207;&#26631;&#31614;&#34987;&#31216;&#20026; &lt;em&gt;&#21253;&#21547;&#26631;&#31614;&lt;/em&gt; &#12290;&#22914;&#20309;&#20889;&#21253;&#21547;&#26631;&#31614;&#26368;&#22909;&#36890;&#36807;&#20030;&#20363;&#26469;&#35828;&#26126;&#12290; &#35753;&#25105;&#20204;&#26469;&#20889;&#19968;&#20010;&#33021;&#22815;&#20135;&#29983;&#25351;&#23450;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#20316;&#32773;&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#30340;&#20070;&#31821;&#28165;&#21333;&#30340;&#26631;&#31614;&#12290; &#25105;&#20204;&#23558;&#36825;&#26679;&#21033;&#29992;&#26631;&#31614;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn311&quot;&gt;{% books_for_author author %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn312&quot;&gt;&#32467;&#26524;&#23558;&#20250;&#20687;&#19979;&#38754;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn314&quot;&gt;&amp;lt;ul&amp;gt;
    &amp;lt;li&amp;gt;The Cat In The Hat&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;Hop On Pop&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;Green Eggs And Ham&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn315&quot;&gt;&#39318;&#20808;&#65292;&#25105;&#20204;&#23450;&#20041;&#19968;&#20010;&#20989;&#25968;&#65292;&#36890;&#36807;&#32473;&#23450;&#30340;&#21442;&#25968;&#29983;&#25104;&#19968;&#20010;&#23383;&#20856;&#24418;&#24335;&#30340;&#32467;&#26524;&#12290; &#38656;&#35201;&#27880;&#24847;&#30340;&#26159;&#65292;&#25105;&#20204;&#21482;&#38656;&#35201;&#36820;&#22238;&#23383;&#20856;&#31867;&#22411;&#30340;&#32467;&#26524;&#23601;&#34892;&#20102;&#65292;&#19981;&#38656;&#35201;&#36820;&#22238;&#26356;&#22797;&#26434;&#30340;&#19996;&#35199;&#12290; &#36825;&#23558;&#34987;&#29992;&#26469;&#20316;&#20026;&#27169;&#26495;&#29255;&#27573;&#30340;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn317&quot;&gt;def books_for_author(author):
    books = Book.objects.filter(authors__id=author.id)
    return {&apos;books&apos;: books}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn318&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#25105;&#20204;&#21019;&#24314;&#29992;&#20110;&#28210;&#26579;&#26631;&#31614;&#36755;&#20986;&#30340;&#27169;&#26495;&#12290; &#22312;&#25105;&#20204;&#30340;&#20363;&#23376;&#20013;&#65292;&#27169;&#26495;&#24456;&#31616;&#21333;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn320&quot;&gt;&amp;lt;ul&amp;gt;
{% for book in books %}
    &amp;lt;li&amp;gt;{{ book.title }}&amp;lt;/li&amp;gt;
{% endfor %}
&amp;lt;/ul&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn321&quot;&gt;&#26368;&#21518;&#65292;&#25105;&#20204;&#36890;&#36807;&#23545;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Library&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;inclusion_tag()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#26469;&#21019;&#24314;&#24182;&#27880;&#20876;&#36825;&#20010;&#21253;&#21547;&#26631;&#31614;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn322&quot;&gt;&#22312;&#25105;&#20204;&#30340;&#20363;&#23376;&#20013;&#65292;&#22914;&#26524;&#20808;&#21069;&#30340;&#27169;&#26495;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;polls/result_snippet.html&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#20013;&#65292;&#37027;&#20040;&#25105;&#20204;&#36825;&#26679;&#27880;&#20876;&#26631;&#31614;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn324&quot;&gt;register.inclusion_tag(&apos;book_snippet.html&apos;)(books_for_author)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn325&quot;&gt;Python 2.4&#35013;&#39280;&#22120;&#35821;&#27861;&#20063;&#33021;&#27491;&#24120;&#24037;&#20316;&#65292;&#25152;&#20197;&#25105;&#20204;&#21487;&#20197;&#36825;&#26679;&#20889;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn327&quot;&gt;@register.inclusion_tag(&apos;book_snippet.html&apos;)
def books_for_author(author):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn328&quot;&gt;&#26377;&#26102;&#20505;&#65292;&#20320;&#30340;&#21253;&#21547;&#26631;&#31614;&#38656;&#35201;&#35775;&#38382;&#29238;&#27169;&#26495;&#30340;context&#12290; &#20026;&#20102;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#65292;Django&#20026;&#21253;&#21547;&#26631;&#31614;&#25552;&#20379;&#20102;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;takes_context&lt;/span&gt;&lt;/tt&gt; &#36873;&#39033;&#12290; &#22914;&#26524;&#20320;&#22312;&#21019;&#24314;&#27169;&#26495;&#26631;&#31614;&#26102;&#65292;&#25351;&#26126;&#20102;&#36825;&#20010;&#36873;&#39033;&#65292;&#36825;&#20010;&#26631;&#31614;&#23601;&#19981;&#38656;&#35201;&#21442;&#25968;&#65292;&#24182;&#19988;&#19979;&#38754;&#30340;Python&#20989;&#25968;&#20250;&#24102;&#19968;&#20010;&#21442;&#25968;&#65306; &#23601;&#26159;&#24403;&#36825;&#20010;&#26631;&#31614;&#34987;&#35843;&#29992;&#26102;&#30340;&#27169;&#26495;context&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn329&quot;&gt;&#20363;&#22914;&#65292;&#20320;&#27491;&#22312;&#20889;&#19968;&#20010;&#21253;&#21547;&#26631;&#31614;&#65292;&#35813;&#26631;&#31614;&#21253;&#21547;&#26377;&#25351;&#21521;&#20027;&#39029;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;home_link&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;home_title&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#12290; Python&#20989;&#25968;&#20250;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn331&quot;&gt;@register.inclusion_tag(&apos;link.html&apos;, takes_context=True)
def jump_link(context):
    return {
        &apos;link&apos;: context[&apos;home_link&apos;],
        &apos;title&apos;: context[&apos;home_title&apos;],
    }
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn332&quot;&gt;&#65288;&#27880;&#24847;&#20989;&#25968;&#30340;&#31532;&#19968;&#20010;&#21442;&#25968; &lt;em&gt;&#24517;&#39035;&lt;/em&gt; &#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;context&lt;/span&gt;&lt;/tt&gt; &#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn333&quot;&gt;&#27169;&#26495; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;link.html&lt;/span&gt;&lt;/tt&gt; &#21487;&#33021;&#21253;&#21547;&#19979;&#38754;&#30340;&#19996;&#35199;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn335&quot;&gt;Jump directly to &amp;lt;a href=&quot;{{ link }}&quot;&amp;gt;{{ title }}&amp;lt;/a&amp;gt;.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn336&quot;&gt;&#28982;&#21518;&#24744;&#24819;&#20351;&#29992;&#33258;&#23450;&#20041;&#26631;&#31614;&#26102;&#65292;&#23601;&#21487;&#20197;&#21152;&#36733;&#23427;&#30340;&#24211;&#65292;&#28982;&#21518;&#19981;&#24102;&#21442;&#25968;&#22320;&#35843;&#29992;&#23427;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn338&quot;&gt;{% jump_link %}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id25&quot;&gt;
&lt;span id=&quot;cn339&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn339&quot;&gt;&#32534;&#20889;&#33258;&#23450;&#20041;&#27169;&#26495;&#21152;&#36733;&#22120;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn340&quot;&gt;Djangos &#20869;&#32622;&#30340;&#27169;&#26495;&#21152;&#36733;&#22120;&#65288;&#22312;&#20808;&#21069;&#30340;&#27169;&#26495;&#21152;&#36733;&#20869;&#24149;&#31456;&#33410;&#26377;&#21465;&#36848;&#65289;&#36890;&#24120;&#20250;&#28385;&#36275;&#20320;&#30340;&#25152;&#26377;&#30340;&#27169;&#26495;&#21152;&#36733;&#38656;&#27714;&#65292;&#20294;&#26159;&#22914;&#26524;&#20320;&#26377;&#29305;&#27530;&#30340;&#21152;&#36733;&#38656;&#27714;&#30340;&#35805;&#65292;&#32534;&#20889;&#33258;&#24049;&#30340;&#27169;&#26495;&#21152;&#36733;&#22120;&#20063;&#20250;&#30456;&#24403;&#31616;&#21333;&#12290; &#27604;&#22914;&#65306;&#20320;&#21487;&#20197;&#20174;&#25968;&#25454;&#24211;&#20013;&#65292;&#25110;&#32773;&#21033;&#29992;Python&#30340;&#32465;&#23450;&#30452;&#25509;&#20174;Subversion&#24211;&#20013;&#65292;&#26356;&#25110;&#32773;&#20174;&#19968;&#20010;ZIP&#25991;&#26723;&#20013;&#21152;&#36733;&#27169;&#26495;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn341&quot;&gt;&#27169;&#26495;&#21152;&#36733;&#22120;&#65292;&#20063;&#23601;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_LOADERS&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#27599;&#19968;&#39033;&#65292;&#37117;&#35201;&#33021;&#34987;&#19979;&#38754;&#36825;&#20010;&#25509;&#21475;&#35843;&#29992;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn343&quot;&gt;load_template_source(template_name, template_dirs=None)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn344&quot;&gt;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_name&lt;/span&gt;&lt;/tt&gt; &#26159;&#25152;&#21152;&#36733;&#27169;&#26495;&#30340;&#21517;&#31216; (&#21644;&#20256;&#36882;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;loader.get_template()&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;loader.select_template()&lt;/span&gt;&lt;/tt&gt; &#19968;&#26679;), &#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_dirs&lt;/span&gt;&lt;/tt&gt; &#26159;&#19968;&#20010;&#21487;&#36873;&#30340;&#20195;&#26367;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt;&#30340;&#25628;&#32034;&#30446;&#24405;&#21015;&#34920;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn345&quot;&gt;&#22914;&#26524;&#21152;&#36733;&#22120;&#33021;&#22815;&#25104;&#21151;&#21152;&#36733;&#19968;&#20010;&#27169;&#26495;, &#23427;&#24212;&#24403;&#36820;&#22238;&#19968;&#20010;&#20803;&#32452;&#65306;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;(template_source,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;template_path)&lt;/span&gt;&lt;/tt&gt; &#12290;&#22312;&#36825;&#37324;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_source&lt;/span&gt;&lt;/tt&gt; &#23601;&#26159;&#23558;&#34987;&#27169;&#26495;&#24341;&#25806;&#32534;&#35793;&#30340;&#30340;&#27169;&#26495;&#23383;&#31526;&#20018;&#65292;&#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_path&lt;/span&gt;&lt;/tt&gt; &#26159;&#34987;&#21152;&#36733;&#30340;&#27169;&#26495;&#30340;&#36335;&#24452;&#12290; &#30001;&#20110;&#37027;&#20010;&#36335;&#24452;&#21487;&#33021;&#20250;&#20986;&#20110;&#35843;&#35797;&#30446;&#30340;&#26174;&#31034;&#32473;&#29992;&#25143;&#65292;&#22240;&#27492;&#23427;&#24212;&#24403;&#24456;&#24555;&#30340;&#25351;&#26126;&#27169;&#26495;&#20174;&#21738;&#37324;&#21152;&#36733;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn346&quot;&gt;&#22914;&#26524;&#21152;&#36733;&#22120;&#21152;&#36733;&#27169;&#26495;&#22833;&#36133;&#65292;&#37027;&#20040;&#23601;&#20250;&#35302;&#21457; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.TemplateDoesNotExist&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn347&quot;&gt;&#27599;&#20010;&#21152;&#36733;&#20989;&#25968;&#37117;&#24212;&#35813;&#26377;&#19968;&#20010;&#21517;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;is_usable&lt;/span&gt;&lt;/tt&gt; &#30340;&#20989;&#25968;&#23646;&#24615;&#12290; &#36825;&#20010;&#23646;&#24615;&#26159;&#19968;&#20010;&#24067;&#23572;&#20540;&#65292;&#29992;&#20110;&#21578;&#30693;&#27169;&#26495;&#24341;&#25806;&#36825;&#20010;&#21152;&#36733;&#22120;&#26159;&#21542;&#22312;&#24403;&#21069;&#23433;&#35013;&#30340;Python&#20013;&#21487;&#29992;&#12290; &#20363;&#22914;&#65292;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pkg_resources&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#27809;&#26377;&#23433;&#35013;&#30340;&#35805;&#65292;eggs&#21152;&#36733;&#22120;&#65288;&#23427;&#33021;&#22815;&#20174;python eggs&#20013;&#21152;&#36733;&#27169;&#26495;&#65289;&#23601;&#24212;&#35813;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;is_usable&lt;/span&gt;&lt;/tt&gt; &#35774;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt; &#65292;&#22240;&#20026;&#24517;&#39035;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pkg_resources&lt;/span&gt;&lt;/tt&gt; &#25165;&#33021;&#20174;eggs&#20013;&#35835;&#21462;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn348&quot;&gt;&#19968;&#20010;&#20363;&#23376;&#21487;&#20197;&#28165;&#26224;&#22320;&#38416;&#26126;&#19968;&#20999;&#12290; &#36825;&#20799;&#26159;&#19968;&#20010;&#27169;&#26495;&#21152;&#36733;&#20989;&#25968;&#65292;&#23427;&#21487;&#20197;&#20174;ZIP&#25991;&#20214;&#20013;&#21152;&#36733;&#27169;&#26495;&#12290; &#23427;&#20351;&#29992;&#20102;&#33258;&#23450;&#20041;&#30340;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_ZIP_FILES&lt;/span&gt;&lt;/tt&gt; &#26469;&#21462;&#20195;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#29992;&#20316;&#26597;&#25214;&#36335;&#24452;&#65292;&#24182;&#19988;&#23427;&#20551;&#35774;&#22312;&#27492;&#36335;&#24452;&#19978;&#30340;&#27599;&#19968;&#20010;&#25991;&#20214;&#37117;&#26159;&#21253;&#21547;&#27169;&#26495;&#30340;ZIP&#25991;&#20214;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn350&quot;&gt;from django.conf import settings
from django.template import TemplateDoesNotExist
import zipfile

def load_template_source(template_name, template_dirs=None):
    &quot;Template loader that loads templates from a ZIP file.&quot;

    template_zipfiles = getattr(settings, &quot;TEMPLATE_ZIP_FILES&quot;, [])

    # Try each ZIP file in TEMPLATE_ZIP_FILES.
    for fname in template_zipfiles:
        try:
            z = zipfile.ZipFile(fname)
            source = z.read(template_name)
        except (IOError, KeyError):
            continue
        z.close()
        # We found a template, so return the source.
        template_path = &quot;%s:%s&quot; % (fname, template_name)
        return (source, template_path)

    # If we reach here, the template couldn&apos;t be loaded
    raise TemplateDoesNotExist(template_name)

# This loader is always usable (since zipfile is included with Python)
load_template_source.is_usable = True
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn351&quot;&gt;&#25105;&#20204;&#35201;&#24819;&#20351;&#29992;&#23427;&#65292;&#36824;&#24046;&#26368;&#21518;&#19968;&#27493;&#65292;&#23601;&#26159;&#25226;&#23427;&#21152;&#20837;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_LOADERS&lt;/span&gt;&lt;/tt&gt; &#12290; &#22914;&#26524;&#25105;&#20204;&#23558;&#36825;&#20010;&#20195;&#30721;&#25918;&#20837;&#19968;&#20010;&#21483;mysite.zip_loader&#30340;&#21253;&#20013;&#65292;&#37027;&#20040;&#25105;&#20204;&#35201;&#25226;mysite.zip_loader.load_template_source&#21152;&#21040;TEMPLATE_LOADERS&#20013;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id26&quot;&gt;
&lt;span id=&quot;cn352&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn352&quot;&gt;&#37197;&#32622;&#29420;&#31435;&#27169;&#24335;&#19979;&#30340;&#27169;&#26495;&#31995;&#32479;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn353&quot;&gt;&#27880;&#24847;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn354&quot;&gt;&#36825;&#37096;&#20998;&#21482;&#38024;&#23545;&#20110;&#23545;&#22312;&#20854;&#20182;&#24212;&#29992;&#20013;&#20351;&#29992;&#27169;&#29256;&#31995;&#32479;&#20316;&#20026;&#36755;&#20986;&#32452;&#20214;&#24863;&#20852;&#36259;&#30340;&#20154;&#12290; &#22914;&#26524;&#20320;&#26159;&#22312;Django&#24212;&#29992;&#20013;&#20351;&#29992;&#27169;&#29256;&#31995;&#32479;&#65292;&#35831;&#30053;&#36807;&#27492;&#37096;&#20998;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn355&quot;&gt;&#36890;&#24120;&#65292;Django&#20250;&#20174;&#23427;&#30340;&#40664;&#35748;&#37197;&#32622;&#25991;&#20214;&#21644;&#30001; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DJANGO_SETTINGS_MODULE&lt;/span&gt;&lt;/tt&gt; &#29615;&#22659;&#21464;&#37327;&#25152;&#25351;&#23450;&#30340;&#27169;&#22359;&#20013;&#21152;&#36733;&#23427;&#38656;&#35201;&#30340;&#25152;&#26377;&#37197;&#32622;&#20449;&#24687;&#12290; &#65288;&#36825;&#28857;&#22312;&#31532;&#22235;&#31456;&#30340;&#8221;&#29305;&#27530;&#30340;Python&#21629;&#20196;&#25552;&#31034;&#34892;&#8221;&#19968;&#33410;&#35299;&#37322;&#36807;&#12290;&#65289;&#20294;&#26159;&#24403;&#20320;&#24819;&#22312;&#38750;Django&#24212;&#29992;&#20013;&#20351;&#29992;&#27169;&#29256;&#31995;&#32479;&#30340;&#26102;&#20505;&#65292;&#37319;&#29992;&#29615;&#22659;&#21464;&#37327;&#24182;&#19981;&#26041;&#20415;&#65292;&#22240;&#20026;&#20320;&#21487;&#33021;&#26356;&#24819;&#21516;&#20854;&#20313;&#30340;&#24212;&#29992;&#19968;&#36215;&#37197;&#32622;&#20320;&#30340;&#27169;&#26495;&#31995;&#32479;&#65292;&#32780;&#19981;&#26159;&#22788;&#29702;&#37197;&#32622;&#25991;&#20214;&#24182;&#36890;&#36807;&#29615;&#22659;&#21464;&#37327;&#25351;&#21521;&#20182;&#20204;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn356&quot;&gt;&#20026;&#20102;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#65292;&#20320;&#38656;&#35201;&#20351;&#29992;&#38468;&#24405;D&#20013;&#25152;&#25551;&#36848;&#30340;&#25163;&#21160;&#37197;&#32622;&#36873;&#39033;&#12290;&#27010;&#25324;&#30340;&#35828;&#65292;&#20320;&#38656;&#35201;&#23548;&#20837;&#27491;&#30830;&#30340;&#27169;&#26495;&#20013;&#30340;&#29255;&#27573;&#65292;&#28982;&#21518;&#22312;&#20320;&#35775;&#38382;&#20219;&#19968;&#20010;&#27169;&#26495;&#20989;&#25968;&#20043;&#21069;&#65292;&#39318;&#20808;&#29992;&#20320;&#24819;&#25351;&#23450;&#30340;&#37197;&#32622;&#35775;&#38382;Django.conf.settings.configure()&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn357&quot;&gt;&#20320;&#21487;&#33021;&#20250;&#32771;&#34385;&#33267;&#23569;&#35201;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#65288;&#22914;&#26524;&#20320;&#25171;&#31639;&#20351;&#29992;&#27169;&#26495;&#21152;&#36733;&#22120;&#65289;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEFAULT_CHARSET&lt;/span&gt;&lt;/tt&gt; &#65288;&#23613;&#31649;&#40664;&#35748;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;utf-8&lt;/span&gt;&lt;/tt&gt; &#32534;&#30721;&#30456;&#24403;&#22909;&#29992;&#65289;&#65292;&#20197;&#21450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DEBUG&lt;/span&gt;&lt;/tt&gt; &#12290;&#25152;&#26377;&#21487;&#29992;&#30340;&#36873;&#39033;&#22312;&#38468;&#24405;D&#20013;&#37117;&#26377;&#35814;&#32454;&#25551;&#36848;&#65292;&#25152;&#26377;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_&lt;/span&gt;&lt;/tt&gt; &#24320;&#22836;&#30340;&#36873;&#39033;&#37117;&#21487;&#33021;&#20351;&#20320;&#24863;&#20852;&#36259;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id27&quot;&gt;
&lt;span id=&quot;cn358&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn358&quot;&gt;&#25509;&#19979;&#26469;&#20570;&#20160;&#20040;&#65311;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn359&quot;&gt;&#24310;&#32493;&#26412;&#31456;&#30340;&#39640;&#32423;&#35805;&#39064;&#65292;&lt;a class=&quot;reference external&quot; href=&quot;../chapter10/&quot;&gt;&#19979;&#19968;&#31456;&lt;/a&gt; &#20250;&#32487;&#32493;&#35752;&#35770;Django&#27169;&#29256;&#30340;&#39640;&#32423;&#29992;&#27861;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</summary>
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#20061;&#31456; &#27169;&#26495;&#39640;&#32423;&#36827;&#38454;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#34429;&#28982;&#22823;&#22810;&#25968;&#21644;Django&#27169;&#26495;&#35821;&#35328;&#30340;&#20132;&#20114;&#37117;&#26159;&#27169;&#26495;&#20316;&#32773;&#30340;&#24037;&#20316;&#65292;&#20294;&#20320;&#21487;&#33021;&#24819;&#23450;&#21046;&#21644;&#25193;&#23637;&#27169;&#26495;&#24341;&#25806;&#65292;&#35753;&#23427;&#20570;&#19968;&#20123;&#23427;&#19981;&#33021;&#20570;&#30340;&#20107;&#24773;&#65292;&#25110;&#32773;&#26159;&#20197;&#20854;&#20182;&#26041;&#24335;&#35753;&#20320;&#30340;&#24037;&#20316;&#26356;&#36731;&#26494;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#26412;&#31456;&#28145;&#20837;&#25506;&#35752;Django&#30340;&#27169;&#26495;&#31995;&#32479;&#12290; &#22914;&#26524;&#20320;&#24819;&#25193;&#23637;&#27169;&#26495;&#31995;&#32479;&#25110;&#32773;&#21482;&#26159;&#23545;&#23427;&#30340;&#24037;&#20316;&#21407;&#29702;&#24863;&#35273;&#21040;&#22909;&#22855;&#65292;&#26412;&#31456;&#28041;&#21450;&#20102;&#20320;&#38656;&#35201;&#20102;&#35299;&#30340;&#19996;&#35199;&#12290; &#23427;&#20063;&#21253;&#21547;&#19968;&#20010;&#33258;&#21160;&#36716;&#24847;&#29305;&#24449;&#65292;&#22914;&#26524;&#20320;&#32487;&#32493;&#20351;&#29992;django&#65292;&#38543;&#30528;&#26102;&#38388;&#30340;&#25512;&#31227;&#20320;&#19968;&#23450;&#20250;&#27880;&#24847;&#36825;&#20010;&#23433;&#20840;&#32771;&#34385;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#22914;&#26524;&#20320;&#24819;&#25226;Django&#30340;&#27169;&#29256;&#31995;&#32479;&#20316;&#20026;&#21478;&#22806;&#19968;&#20010;&#24212;&#29992;&#31243;&#24207;&#30340;&#19968;&#37096;&#20998;&#65288;&#23601;&#26159;&#35828;&#65292;&#20165;&#20351;&#29992;Django&#30340;&#27169;&#26495;&#31995;&#32479;&#32780;&#19981;&#20351;&#29992;Django&#26694;&#26550;&#30340;&#20854;&#20182;&#37096;&#20998;&#65289;&#65292;&#37027;&#20320;&#19968;&#23450;&#35201;&#35835;&#19968;&#19979;&#8220;&#37197;&#32622;&#29420;&#31435;&#27169;&#24335;&#19979;&#30340;&#27169;&#29256;&#31995;&#32479;&#8221;&#36825;&#19968;&#33410;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn4&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#27169;&#26495;&#35821;&#35328;&#22238;&#39038;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&#39318;&#20808;&#65292;&#35753;&#25105;&#20204;&#24555;&#36895;&#22238;&#39038;&#19968;&#19979;&#31532;&#22235;&#31456;&#20171;&#32461;&#30340;&#33509;&#24178;&#19987;&#19994;&#26415;&#35821;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&lt;em&gt;&#27169;&#26495;&lt;/em&gt; &#26159;&#19968;&#20010;&#32431;&#25991;&#26412;&#25991;&#20214;&#65292;&#25110;&#26159;&#19968;&#20010;&#29992;Django&#27169;&#26495;&#35821;&#35328;&#26631;&#35760;&#36807;&#30340;&#26222;&#36890;&#30340;Python&#23383;&#31526;&#20018;&#12290; &#27169;&#26495;&#21487;&#20197;&#21253;&#21547;&#27169;&#26495;&#26631;&#31614;&#21644;&#21464;&#37327;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&lt;em&gt;&#27169;&#26495;&#26631;&#31614;&lt;/em&gt; &#26159;&#22312;&#19968;&#20010;&#27169;&#26495;&#37324;&#38754;&#36215;&#20316;&#29992;&#30340;&#30340;&#26631;&#35760;&#12290; &#36825;&#20010;&#23450;&#20041;&#25925;&#24847;&#25630;&#24471;&#27169;&#31946;&#19981;&#28165;&#12290; &#20363;&#22914;&#65292;&#19968;&#20010;&#27169;&#29256;&#26631;&#31614;&#33021;&#22815;&#20135;&#29983;&#20316;&#20026;&#25511;&#21046;&#32467;&#26500;&#30340;&#20869;&#23481;&#65288;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt;&lt;/tt&gt;&#35821;&#21477;&#25110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;for&lt;/span&gt;&lt;/tt&gt; &#24490;&#29615;), &#21487;&#20197;&#33719;&#21462;&#25968;&#25454;&#24211;&#20869;&#23481;&#65292;&#25110;&#32773;&#35775;&#38382;&#20854;&#20182;&#30340;&#27169;&#26495;&#26631;&#31614;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#21306;&#22359;&#26631;&#31614;&#34987; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21253;&#22260;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn10&quot;&gt;{% if is_logged_in %}
    Thanks for logging in!
{% else %}
    Please log in.
{% endif %}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&lt;em&gt;&#21464;&#37327;&lt;/em&gt; &#26159;&#19968;&#20010;&#22312;&#27169;&#26495;&#37324;&#29992;&#26469;&#36755;&#20986;&#20540;&#30340;&#26631;&#35760;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&#21464;&#37327;&#26631;&#31614;&#34987; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#21253;&#22260;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn14&quot;&gt;My first name is {{ first_name }}. My last name is {{ last_name }}.
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&lt;em&gt;context&lt;/em&gt; &#26159;&#19968;&#20010;&#20256;&#36882;&#32473;&#27169;&#26495;&#30340;&#21517;&#31216;&#21040;&#20540;&#30340;&#26144;&#23556;&#65288;&#31867;&#20284;Python&#23383;&#20856;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#27169;&#26495; &lt;em&gt;&#28210;&#26579;&lt;/em&gt; &#23601;&#26159;&#26159;&#36890;&#36807;&#20174;context&#33719;&#21462;&#20540;&#26469;&#26367;&#25442;&#27169;&#26495;&#20013;&#21464;&#37327;&#24182;&#25191;&#34892;&#25152;&#26377;&#30340;&#27169;&#26495;&#26631;&#31614;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#20851;&#20110;&#36825;&#20123;&#22522;&#26412;&#27010;&#24565;&#26356;&#35814;&#32454;&#30340;&#20869;&#23481;&#65292;&#35831;&#21442;&#32771;&#31532;&#22235;&#31456;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#26412;&#31456;&#30340;&#20854;&#20313;&#37096;&#20998;&#35752;&#35770;&#20102;&#25193;&#23637;&#27169;&#26495;&#24341;&#25806;&#30340;&#26041;&#27861;&#12290;
&#39318;&#20808;&#65292;&#25105;&#20204;&#24555;&#36895;&#30340;&#30475;&#19968;&#19979;&#31532;&#22235;&#31456;&#36951;&#30041;&#30340;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;requestcontext-context&quot;&gt;
&lt;span id=&quot;cn19&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn19&quot;&gt;RequestContext&#21644;Context&#22788;&#29702;&#22120;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#20320;&#38656;&#35201;&#19968;&#27573;context&#26469;&#35299;&#26512;&#27169;&#26495;&#12290; &#19968;&#33324;&#24773;&#20917;&#19979;&#65292;&#36825;&#26159;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.Context&lt;/span&gt;&lt;/tt&gt; &#30340;&#23454;&#20363;&#65292;&#19981;&#36807;&#22312;Django&#20013;&#36824;&#21487;&#20197;&#29992;&#19968;&#20010;&#29305;&#27530;&#30340;&#23376;&#31867;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.RequestContext&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#20010;&#29992;&#36215;&#26469;&#31245;&#24494;&#26377;&#20123;&#19981;&#21516;&#12290;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#40664;&#35748;&#22320;&#22312;&#27169;&#26495;context&#20013;&#21152;&#20837;&#20102;&#19968;&#20123;&#21464;&#37327;&#65292;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#25110;&#24403;&#21069;&#30331;&#24405;&#29992;&#25143;&#30340;&#30456;&#20851;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#24403;&#20320;&#19981;&#24819;&#22312;&#19968;&#31995;&#20363;&#27169;&#26495;&#20013;&#37117;&#26126;&#30830;&#25351;&#23450;&#19968;&#20123;&#30456;&#21516;&#30340;&#21464;&#37327;&#26102;&#65292;&#20320;&#24212;&#35813;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#12290; &#20363;&#22914;&#65292;&#32771;&#34385;&#36825;&#20004;&#20010;&#35270;&#22270;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn23&quot;&gt;from django.template import loader, Context

def view_1(request):
    # ...
    t = loader.get_template(&apos;template1.html&apos;)
    c = Context({
        &apos;app&apos;: &apos;My app&apos;,
        &apos;user&apos;: request.user,
        &apos;ip_address&apos;: request.META[&apos;REMOTE_ADDR&apos;],
        &apos;message&apos;: &apos;I am view 1.&apos;
    })
    return t.render(c)

def view_2(request):
    # ...
    t = loader.get_template(&apos;template2.html&apos;)
    c = Context({
        &apos;app&apos;: &apos;My app&apos;,
        &apos;user&apos;: request.user,
        &apos;ip_address&apos;: request.META[&apos;REMOTE_ADDR&apos;],
        &apos;message&apos;: &apos;I am the second view.&apos;
    })
    return t.render(c)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#65288;&#27880;&#24847;&#65292;&#22312;&#36825;&#20123;&#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#25925;&#24847; &lt;em&gt;&#19981;&lt;/em&gt; &#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#24555;&#25463;&#26041;&#27861;&#65292;&#32780;&#36873;&#25321;&#25163;&#21160;&#36733;&#20837;&#27169;&#26495;&#65292;&#25163;&#21160;&#26500;&#36896;context&#23545;&#35937;&#28982;&#21518;&#28210;&#26579;&#27169;&#26495;&#12290; &#26159;&#20026;&#20102;&#33021;&#22815;&#28165;&#26224;&#30340;&#35828;&#26126;&#25152;&#26377;&#27493;&#39588;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#27599;&#20010;&#35270;&#22270;&#37117;&#32473;&#27169;&#26495;&#20256;&#20837;&#20102;&#19977;&#20010;&#30456;&#21516;&#30340;&#21464;&#37327;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;app&lt;/span&gt;&lt;/tt&gt;&#12289;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ip_address&lt;/span&gt;&lt;/tt&gt;&#12290; &#22914;&#26524;&#25105;&#20204;&#25226;&#36825;&#20123;&#20887;&#20313;&#21435;&#25481;&#20250;&#19981;&#20250;&#26356;&#22909;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;strong&gt;context&#22788;&#29702;&#22120;&lt;/strong&gt; &#23601;&#26159;&#20026;&#20102;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#12290; Context&#22788;&#29702;&#22120;&#20801;&#35768;&#20320;&#35774;&#32622;&#19968;&#20123;&#21464;&#37327;&#65292;&#23427;&#20204;&#20250;&#22312;&#27599;&#20010;context&#20013;&#33258;&#21160;&#34987;&#35774;&#32622;&#22909;&#65292;&#32780;&#19981;&#24517;&#27599;&#27425;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#26102;&#37117;&#25351;&#23450;&#12290; &#35201;&#28857;&#23601;&#26159;&#65292;&#24403;&#20320;&#28210;&#26579;&#27169;&#26495;&#26102;&#65292;&#20320;&#35201;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#32780;&#19981;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&#26368;&#30452;&#25509;&#30340;&#20570;&#27861;&#26159;&#29992;context&#22788;&#29702;&#22120;&#26469;&#21019;&#24314;&#19968;&#20123;&#22788;&#29702;&#22120;&#24182;&#20256;&#36882;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#12290;&#19978;&#38754;&#30340;&#20363;&#23376;&#21487;&#20197;&#29992;context processors&#25913;&#20889;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn29&quot;&gt;from django.template import loader, RequestContext

def custom_proc(request):
    &quot;A context processor that provides &apos;app&apos;, &apos;user&apos; and &apos;ip_address&apos;.&quot;
    return {
        &apos;app&apos;: &apos;My app&apos;,
        &apos;user&apos;: request.user,
        &apos;ip_address&apos;: request.META[&apos;REMOTE_ADDR&apos;]
    }

def view_1(request):
    # ...
    t = loader.get_template(&apos;template1.html&apos;)
    c = RequestContext(request, {&apos;message&apos;: &apos;I am view 1.&apos;},
            processors=[custom_proc])
    return t.render(c)

def view_2(request):
    # ...
    t = loader.get_template(&apos;template2.html&apos;)
    c = RequestContext(request, {&apos;message&apos;: &apos;I am the second view.&apos;},
            processors=[custom_proc])
    return t.render(c)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#25105;&#20204;&#26469;&#36890;&#35835;&#19968;&#19979;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn31&quot;&gt;&#39318;&#20808;&#65292;&#25105;&#20204;&#23450;&#20041;&#19968;&#20010;&#20989;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;custom_proc&lt;/span&gt;&lt;/tt&gt; &#12290;&#36825;&#26159;&#19968;&#20010;context&#22788;&#29702;&#22120;&#65292;&#23427;&#25509;&#25910;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#28982;&#21518;&#36820;&#22238;&#19968;&#20010;&#23383;&#20856;&#65292;&#36825;&#20010;&#23383;&#20856;&#20013;&#21253;&#21547;&#20102;&#21487;&#20197;&#22312;&#27169;&#26495;context&#20013;&#20351;&#29992;&#30340;&#21464;&#37327;&#12290; &#23427;&#23601;&#20570;&#20102;&#36825;&#20040;&#22810;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn32&quot;&gt;&#25105;&#20204;&#22312;&#36825;&#20004;&#20010;&#35270;&#22270;&#20989;&#25968;&#20013;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#20195;&#26367;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#12290;&#22312;context&#23545;&#35937;&#30340;&#26500;&#24314;&#19978;&#26377;&#20004;&#20010;&#19981;&#21516;&#28857;&#12290;
&#19968;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#38656;&#35201;&#20256;&#36882;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#23601;&#26159;&#20256;&#36882;&#32473;&#35270;&#22270;&#20989;&#25968;&#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290;&#20108;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#26377;&#19968;&#20010;&#21487;&#36873;&#30340;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;processors&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#26159;&#19968;&#20010;&#21253;&#21547;context&#22788;&#29702;&#22120;&#20989;&#25968;&#30340;&#21015;&#34920;&#25110;&#32773;&#20803;&#32452;&#12290; &#22312;&#36825;&#37324;&#65292;&#25105;&#20204;&#20256;&#36882;&#20102;&#25105;&#20204;&#20043;&#21069;&#23450;&#20041;&#30340;&#22788;&#29702;&#22120;&#20989;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;curstom_proc&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn33&quot;&gt;&#27599;&#20010;&#35270;&#22270;&#30340;context&#32467;&#26500;&#37324;&#19981;&#20877;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;app&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ip_address&lt;/span&gt;&lt;/tt&gt; &#31561;&#21464;&#37327;&#65292;&#22240;&#20026;&#36825;&#20123;&#30001; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;custom_proc&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#25552;&#20379;&#20102;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn34&quot;&gt;&#27599;&#20010;&#35270;&#22270; &lt;em&gt;&#20173;&#28982;&lt;/em&gt; &#20855;&#26377;&#24456;&#22823;&#30340;&#28789;&#27963;&#24615;&#65292;&#21487;&#20197;&#24341;&#20837;&#25105;&#20204;&#38656;&#35201;&#30340;&#20219;&#20309;&#27169;&#26495;&#21464;&#37327;&#12290; &#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;message&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#21464;&#37327;&#22312;&#27599;&#20010;&#35270;&#22270;&#20013;&#37117;&#19981;&#19968;&#26679;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#22312;&#31532;&#22235;&#31456;&#65292;&#25105;&#20204;&#20171;&#32461;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#24555;&#25463;&#26041;&#24335;&#65292;&#23427;&#21487;&#20197;&#31616;&#21270;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;loader.get_template()&lt;/span&gt;&lt;/tt&gt; ,&#28982;&#21518;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Context&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#26368;&#21518;&#20877;&#35843;&#29992;&#27169;&#26495;&#23545;&#35937;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render()&lt;/span&gt;&lt;/tt&gt;&#36807;&#31243;&#12290; &#20026;&#20102;&#35762;&#35299;context&#22788;&#29702;&#22120;&#24213;&#23618;&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#65292;&#22312;&#19978;&#38754;&#30340;&#20363;&#23376;&#20013;&#25105;&#20204;&#27809;&#26377;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#12290;&#20294;&#26159;&#24314;&#35758;&#36873;&#25321; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;render_to_response()&lt;/span&gt;&lt;/tt&gt; &#20316;&#20026;context&#30340;&#22788;&#29702;&#22120;&#12290;&#36825;&#23601;&#38656;&#35201;&#29992;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;context_instance&lt;/span&gt;&lt;/tt&gt;&#21442;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn37&quot;&gt;from django.shortcuts import render_to_response
from django.template import RequestContext

def custom_proc(request):
    &quot;A context processor that provides &apos;app&apos;, &apos;user&apos; and &apos;ip_address&apos;.&quot;
    return {
        &apos;app&apos;: &apos;My app&apos;,
        &apos;user&apos;: request.user,
        &apos;ip_address&apos;: request.META[&apos;REMOTE_ADDR&apos;]
    }

def view_1(request):
    # ...
    return render_to_response(&apos;template1.html&apos;,
        {&apos;message&apos;: &apos;I am view 1.&apos;},
        context_instance=RequestContext(request, processors=[custom_proc]))

def view_2(request):
    # ...
    return render_to_response(&apos;template2.html&apos;,
        {&apos;message&apos;: &apos;I am the second view.&apos;},
        context_instance=RequestContext(request, processors=[custom_proc]))
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#22312;&#36825;&#65292;&#25105;&#20204;&#23558;&#27599;&#20010;&#35270;&#22270;&#30340;&#27169;&#26495;&#28210;&#26579;&#20195;&#30721;&#20889;&#25104;&#20102;&#19968;&#20010;&#21333;&#34892;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&#34429;&#28982;&#36825;&#26159;&#19968;&#31181;&#25913;&#36827;&#65292;&#20294;&#26159;&#65292;&#35831;&#32771;&#34385;&#19968;&#19979;&#36825;&#27573;&#20195;&#30721;&#30340;&#31616;&#27905;&#24615;&#65292;&#25105;&#20204;&#29616;&#22312;&#19981;&#24471;&#19981;&#25215;&#35748;&#30340;&#26159;&#22312; &lt;em&gt;&#21478;&#22806;&lt;/em&gt; &#19968;&#26041;&#38754;&#26377;&#20123;&#36807;&#20998;&#20102;&#12290; &#25105;&#20204;&#20197;&#20195;&#30721;&#20887;&#20313;&#65288;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;processors&lt;/span&gt;&lt;/tt&gt; &#35843;&#29992;&#20013;&#65289;&#30340;&#20195;&#20215;&#28040;&#38500;&#20102;&#25968;&#25454;&#19978;&#30340;&#20887;&#20313;&#65288;&#25105;&#20204;&#30340;&#27169;&#26495;&#21464;&#37327;&#65289;&#12290; &#30001;&#20110;&#20320;&#19981;&#24471;&#19981;&#19968;&#30452;&#38190;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;processors&lt;/span&gt;&lt;/tt&gt; &#65292;&#25152;&#20197;&#20351;&#29992;context&#22788;&#29702;&#22120;&#24182;&#27809;&#26377;&#20943;&#23569;&#22826;&#22810;&#30340;&#36755;&#20837;&#37327;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn40&quot;&gt;Django&#22240;&#27492;&#25552;&#20379;&#23545; &lt;em&gt;&#20840;&#23616;&lt;/em&gt; context&#22788;&#29702;&#22120;&#30340;&#25903;&#25345;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_CONTEXT_PROCESSORS&lt;/span&gt;&lt;/tt&gt; &#25351;&#23450;&#20102;&#21738;&#20123;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;processors&lt;/span&gt;&lt;/tt&gt;&lt;em&gt;&#24635;&#26159;&lt;/em&gt;&#40664;&#35748;&#34987;&#20351;&#29992;&#12290;&#36825;&#26679;&#23601;&#30465;&#21435;&#20102;&#27599;&#27425;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#37117;&#25351;&#23450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;processors&lt;/span&gt;&lt;/tt&gt; &#30340;&#40635;&#28902;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#40664;&#35748;&#24773;&#20917;&#19979;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_CONTEXT_PROCESSORS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn43&quot;&gt;TEMPLATE_CONTEXT_PROCESSORS = (
    &apos;django.core.context_processors.auth&apos;,
    &apos;django.core.context_processors.debug&apos;,
    &apos;django.core.context_processors.i18n&apos;,
    &apos;django.core.context_processors.media&apos;,
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#36825;&#20010;&#35774;&#32622;&#39033;&#26159;&#19968;&#20010;&#21487;&#35843;&#29992;&#20989;&#25968;&#30340;&#20803;&#32452;&#65292;&#20854;&#20013;&#30340;&#27599;&#20010;&#20989;&#25968;&#20351;&#29992;&#20102;&#21644;&#19978;&#25991;&#20013;&#25105;&#20204;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;custom_proc&lt;/span&gt;&lt;/tt&gt; &#30456;&#21516;&#30340;&#25509;&#21475;&#65292;&#23427;&#20204;&#20197;request&#23545;&#35937;&#20316;&#20026;&#21442;&#25968;&#65292;&#36820;&#22238;&#19968;&#20010;&#20250;&#34987;&#21512;&#24182;&#20256;&#32473;context&#30340;&#23383;&#20856;&#65306; &#25509;&#25910;&#19968;&#20010;request&#23545;&#35937;&#20316;&#20026;&#21442;&#25968;&#65292;&#36820;&#22238;&#19968;&#20010;&#21253;&#21547;&#20102;&#23558;&#34987;&#21512;&#24182;&#21040;context&#20013;&#30340;&#39033;&#30340;&#23383;&#20856;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#27599;&#20010;&#22788;&#29702;&#22120;&#23558;&#20250;&#25353;&#29031;&#39034;&#24207;&#24212;&#29992;&#12290; &#20063;&#23601;&#26159;&#35828;&#22914;&#26524;&#20320;&#22312;&#31532;&#19968;&#20010;&#22788;&#29702;&#22120;&#37324;&#38754;&#21521;context&#28155;&#21152;&#20102;&#19968;&#20010;&#21464;&#37327;&#65292;&#32780;&#31532;&#20108;&#20010;&#22788;&#29702;&#22120;&#28155;&#21152;&#20102;&#21516;&#26679;&#21517;&#23383;&#30340;&#21464;&#37327;&#65292;&#37027;&#20040;&#31532;&#20108;&#20010;&#23558;&#20250;&#35206;&#30422;&#31532;&#19968;&#20010;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;Django&#25552;&#20379;&#20102;&#20960;&#20010;&#31616;&#21333;&#30340;context&#22788;&#29702;&#22120;&#65292;&#26377;&#20123;&#22312;&#40664;&#35748;&#24773;&#20917;&#19979;&#34987;&#21551;&#29992;&#30340;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;django-core-context-processors-auth&quot;&gt;
&lt;span id=&quot;cn47&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn47&quot;&gt;django.core.context_processors.auth&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_CONTEXT_PROCESSORS&lt;/span&gt;&lt;/tt&gt; &#21253;&#21547;&#20102;&#36825;&#20010;&#22788;&#29702;&#22120;&#65292;&#37027;&#20040;&#27599;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#23558;&#21253;&#21547;&#36825;&#20123;&#21464;&#37327;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn49&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user&lt;/span&gt;&lt;/tt&gt; &#65306;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.auth.models.User&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&#65292;&#25551;&#36848;&#20102;&#24403;&#21069;&#30331;&#24405;&#29992;&#25143;&#65288;&#25110;&#32773;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;AnonymousUser&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&#65292;&#22914;&#26524;&#23458;&#25143;&#31471;&#27809;&#26377;&#30331;&#24405;&#65289;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn50&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;messages&lt;/span&gt;&lt;/tt&gt; &#65306;&#19968;&#20010;&#24403;&#21069;&#30331;&#24405;&#29992;&#25143;&#30340;&#28040;&#24687;&#21015;&#34920;&#65288;&#23383;&#31526;&#20018;&#65289;&#12290; &#22312;&#21518;&#21488;&#65292;&#23545;&#27599;&#19968;&#20010;&#35831;&#27714;&#65292;&#36825;&#20010;&#21464;&#37327;&#37117;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.user.get_and_delete_messages()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290; &#36825;&#20010;&#26041;&#27861;&#25910;&#38598;&#29992;&#25143;&#30340;&#28040;&#24687;&#28982;&#21518;&#25226;&#23427;&#20204;&#20174;&#25968;&#25454;&#24211;&#20013;&#21024;&#38500;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn51&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;perms&lt;/span&gt;&lt;/tt&gt; &#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.core.context_processors.PermWrapper&lt;/span&gt;&lt;/tt&gt; &#30340;&#19968;&#20010;&#23454;&#20363;&#65292;&#21253;&#21547;&#20102;&#24403;&#21069;&#30331;&#24405;&#29992;&#25143;&#26377;&#21738;&#20123;&#26435;&#38480;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#20851;&#20110;users&#12289;permissions&#21644;messages&#30340;&#26356;&#22810;&#20869;&#23481;&#35831;&#21442;&#32771;&#31532;14&#31456;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django-core-context-processors-debug&quot;&gt;
&lt;span id=&quot;cn53&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn53&quot;&gt;django.core.context_processors.debug&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&#36825;&#20010;&#22788;&#29702;&#22120;&#25226;&#35843;&#35797;&#20449;&#24687;&#21457;&#36865;&#21040;&#27169;&#26495;&#23618;&#12290; &#22914;&#26524;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_CONTEXT_PROCESSORS&lt;/span&gt;&lt;/tt&gt;&#21253;&#21547;&#36825;&#20010;&#22788;&#29702;&#22120;&#65292;&#27599;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt;&#23558;&#21253;&#21547;&#36825;&#20123;&#21464;&#37327;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn55&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;debug&lt;/span&gt;&lt;/tt&gt; &#65306;&#20320;&#35774;&#32622;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290;&#20320;&#21487;&#20197;&#22312;&#27169;&#26495;&#37324;&#38754;&#29992;&#36825;&#20010;&#21464;&#37327;&#27979;&#35797;&#26159;&#21542;&#22788;&#22312;debug&#27169;&#24335;&#19979;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn56&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sql_queries&lt;/span&gt;&lt;/tt&gt; &#65306;&#21253;&#21547;&#31867;&#20284;&#20110; &lt;a href=&quot;#id3&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id4&quot;&gt;``&lt;/span&gt;&lt;/a&gt;{&#8216;sql&#8217;: &#8230;, &#8216;time&#8217;: `` &#30340;&#23383;&#20856;&#30340;&#19968;&#20010;&#21015;&#34920;&#65292; &#35760;&#24405;&#20102;&#36825;&#20010;&#35831;&#27714;&#26399;&#38388;&#30340;&#27599;&#20010;SQL&#26597;&#35810;&#20197;&#21450;&#26597;&#35810;&#25152;&#32791;&#36153;&#30340;&#26102;&#38388;&#12290; &#36825;&#20010;&#21015;&#34920;&#26159;&#25353;&#29031;&#35831;&#27714;&#39034;&#24207;&#36827;&#34892;&#25490;&#21015;&#30340;&#12290;&lt;/p&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id3&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 315); &lt;em&gt;&lt;a href=&quot;#id4&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#30001;&#20110;&#35843;&#35797;&#20449;&#24687;&#27604;&#36739;&#25935;&#24863;&#65292;&#25152;&#20197;&#36825;&#20010;context&#22788;&#29702;&#22120;&#21482;&#26377;&#24403;&#21516;&#26102;&#28385;&#36275;&#19979;&#38754;&#20004;&#20010;&#26465;&#20214;&#30340;&#26102;&#20505;&#25165;&#26377;&#25928;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn58&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn59&quot;&gt;&#35831;&#27714;&#30340;ip&#24212;&#35813;&#21253;&#21547;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INTERNAL_IPS&lt;/span&gt;&lt;/tt&gt; &#30340;&#35774;&#32622;&#37324;&#38754;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#32454;&#24515;&#30340;&#35835;&#32773;&#21487;&#33021;&#20250;&#27880;&#24847;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;debug&lt;/span&gt;&lt;/tt&gt;&#27169;&#26495;&#21464;&#37327;&#30340;&#20540;&#27704;&#36828;&#19981;&#21487;&#33021;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt;&#65292;&#22240;&#20026;&#22914;&#26524;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt;&#65292;&#37027;&#20040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;debug&lt;/span&gt;&lt;/tt&gt;&#27169;&#26495;&#21464;&#37327;&#19968;&#24320;&#22987;&#23601;&#19981;&#20250;&#34987;RequestContext&#25152;&#21253;&#21547;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django-core-context-processors-i18n&quot;&gt;
&lt;span id=&quot;cn61&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn61&quot;&gt;django.core.context_processors.i18n&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#22914;&#26524;&#36825;&#20010;&#22788;&#29702;&#22120;&#21551;&#29992;&#65292;&#27599;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#23558;&#21253;&#21547;&#19979;&#38754;&#30340;&#21464;&#37327;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn63&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGES&lt;/span&gt;&lt;/tt&gt; &#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGES&lt;/span&gt;&lt;/tt&gt; &#36873;&#39033;&#30340;&#20540;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn64&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt; &#65306;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt; &#23384;&#22312;&#65292;&#23601;&#31561;&#20110;&#23427;&#65307;&#21542;&#21017;&#65292;&#31561;&#21516;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#38468;&#24405;E&#25552;&#20379;&#20102;&#26377;&#20851;&#36825;&#20004;&#20010;&#35774;&#32622;&#30340;&#26356;&#22810;&#30340;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django-core-context-processors-request&quot;&gt;
&lt;span id=&quot;cn66&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn66&quot;&gt;django.core.context_processors.request&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&#22914;&#26524;&#21551;&#29992;&#36825;&#20010;&#22788;&#29702;&#22120;&#65292;&#27599;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#23558;&#21253;&#21547;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; &#65292; &#20063;&#23601;&#26159;&#24403;&#21069;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290; &#27880;&#24847;&#36825;&#20010;&#22788;&#29702;&#22120;&#40664;&#35748;&#26159;&#19981;&#21551;&#29992;&#30340;&#65292;&#20320;&#38656;&#35201;&#28608;&#27963;&#23427;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#22914;&#26524;&#20320;&#21457;&#29616;&#20320;&#30340;&#27169;&#26495;&#38656;&#35201;&#35775;&#38382;&#24403;&#21069;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt;&#20320;&#23601;&#38656;&#35201;&#20351;&#29992;&#23427;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn70&quot;&gt;{{ request.REMOTE_ADDR }}
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;context&quot;&gt;
&lt;span id=&quot;cn71&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#20889;Context&#22788;&#29702;&#22120;&#30340;&#19968;&#20123;&#24314;&#35758;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&#32534;&#20889;&#22788;&#29702;&#22120;&#30340;&#19968;&#20123;&#24314;&#35758;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn73&quot;&gt;&#20351;&#27599;&#20010;context&#22788;&#29702;&#22120;&#23436;&#25104;&#23613;&#21487;&#33021;&#23567;&#30340;&#21151;&#33021;&#12290; &#20351;&#29992;&#22810;&#20010;&#22788;&#29702;&#22120;&#26159;&#24456;&#23481;&#26131;&#30340;&#65292;&#25152;&#20197;&#20320;&#21487;&#20197;&#26681;&#25454;&#36923;&#36753;&#22359;&#26469;&#20998;&#35299;&#21151;&#33021;&#20197;&#20415;&#23558;&#26469;&#22797;&#29992;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn74&quot;&gt;&#35201;&#27880;&#24847; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_CONTEXT_PROCESSORS&lt;/span&gt;&lt;/tt&gt; &#37324;&#30340;context processor &#23558;&#20250;&#22312;&#22522;&#20110;&#36825;&#20010;settings.py&#30340;&lt;em&gt;&#27599;&#20010;&lt;/em&gt; &#27169;&#26495;&#20013;&#26377;&#25928;&#65292;&#25152;&#20197;&#21464;&#37327;&#30340;&#21629;&#21517;&#19981;&#35201;&#21644;&#27169;&#26495;&#30340;&#21464;&#37327;&#20914;&#31361;&#12290; &#21464;&#37327;&#21517;&#26159;&#22823;&#23567;&#20889;&#25935;&#24863;&#30340;&#65292;&#25152;&#20197;processor&#30340;&#21464;&#37327;&#20840;&#29992;&#22823;&#20889;&#26159;&#20010;&#19981;&#38169;&#30340;&#20027;&#24847;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn75&quot;&gt;&#19981;&#35770;&#23427;&#20204;&#23384;&#25918;&#22312;&#21738;&#20010;&#29289;&#29702;&#36335;&#24452;&#19979;&#65292;&#21482;&#35201;&#22312;&#20320;&#30340;Python&#25628;&#32034;&#36335;&#24452;&#20013;&#65292;&#20320;&#23601;&#21487;&#20197;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_CONTEXT_PROCESSORS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#37324;&#25351;&#21521;&#23427;&#20204;&#12290; &#24314;&#35758;&#20320;&#25226;&#23427;&#20204;&#25918;&#22312;&#24212;&#29992;&#25110;&#32773;&#24037;&#31243;&#30446;&#24405;&#19979;&#21517;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;context_processors.py&lt;/span&gt;&lt;/tt&gt; &#30340;&#25991;&#20214;&#37324;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;html&quot;&gt;
&lt;span id=&quot;cn76&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn76&quot;&gt;html&#33258;&#21160;&#36716;&#24847;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#20174;&#27169;&#26495;&#29983;&#25104;html&#30340;&#26102;&#20505;&#65292;&#24635;&#26159;&#26377;&#19968;&#20010;&#39118;&#38505;&#8212;&#8212;&#21464;&#37327;&#21253;&#20102;&#21547;&#20250;&#24433;&#21709;&#32467;&#26524;html&#30340;&#23383;&#31526;&#12290; &#20363;&#22914;&#65292;&#32771;&#34385;&#36825;&#20010;&#27169;&#26495;&#29255;&#27573;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn79&quot;&gt;Hello, {{ name }}.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#19968;&#24320;&#22987;&#65292;&#36825;&#30475;&#36215;&#26469;&#26159;&#26174;&#31034;&#29992;&#25143;&#21517;&#30340;&#19968;&#20010;&#26080;&#23475;&#30340;&#36884;&#24452;&#65292;&#20294;&#26159;&#32771;&#34385;&#22914;&#26524;&#29992;&#25143;&#36755;&#20837;&#22914;&#19979;&#30340;&#21517;&#23383;&#23558;&#20250;&#21457;&#29983;&#20160;&#20040;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn82&quot;&gt;&amp;lt;script&amp;gt;alert(&apos;hello&apos;)&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#29992;&#36825;&#20010;&#29992;&#25143;&#21517;&#65292;&#27169;&#26495;&#23558;&#34987;&#28210;&#26579;&#25104;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn85&quot;&gt;Hello, &amp;lt;script&amp;gt;alert(&apos;hello&apos;)&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#36825;&#24847;&#21619;&#30528;&#27983;&#35272;&#22120;&#23558;&#24377;&#20986;JavaScript&#35686;&#21578;&#26694;&#65281;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#31867;&#20284;&#30340;&#65292;&#22914;&#26524;&#29992;&#25143;&#21517;&#21253;&#21547;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#23567;&#20110;&lt;/span&gt;&lt;/tt&gt;&#31526;&#21495;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#29992;&#25143;&#21517;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#37027;&#26679;&#30340;&#35805;&#27169;&#26495;&#32467;&#26524;&#34987;&#32763;&#35793;&#25104;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn91&quot;&gt;Hello, &amp;lt;b&amp;gt;username
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#39029;&#38754;&#30340;&#21097;&#20313;&#37096;&#20998;&#21464;&#25104;&#20102;&#31895;&#20307;&#65281;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&#26174;&#28982;&#65292;&#29992;&#25143;&#25552;&#20132;&#30340;&#25968;&#25454;&#19981;&#24212;&#35813;&#34987;&#30450;&#30446;&#20449;&#20219;&#65292;&#30452;&#25509;&#25554;&#20837;&#21040;&#20320;&#30340;&#39029;&#38754;&#20013;&#12290;&#22240;&#20026;&#19968;&#20010;&#28508;&#22312;&#30340;&#24694;&#24847;&#30340;&#29992;&#25143;&#33021;&#22815;&#21033;&#29992;&#36825;&#31867;&#28431;&#27934;&#20570;&#22351;&#20107;&#12290; &#36825;&#31867;&#28431;&#27934;&#31216;&#20026;&#34987;&#36328;&#22495;&#33050;&#26412; (XSS) &#25915;&#20987;&#12290; &#20851;&#20110;&#23433;&#20840;&#30340;&#26356;&#22810;&#20869;&#23481;&#65292;&#35831;&#30475;20&#31456;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&#20026;&#20102;&#36991;&#20813;&#36825;&#20010;&#38382;&#39064;&#65292;&#20320;&#26377;&#20004;&#20010;&#36873;&#25321;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn95&quot;&gt;&#19968;&#26159;&#20320;&#21487;&#20197;&#30830;&#20445;&#27599;&#19968;&#20010;&#19981;&#34987;&#20449;&#20219;&#30340;&#21464;&#37327;&#37117;&#34987;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;escape&lt;/span&gt;&lt;/tt&gt;&#36807;&#28388;&#22120;&#22788;&#29702;&#19968;&#36941;&#65292;&#25226;&#28508;&#22312;&#26377;&#23475;&#30340;html&#23383;&#31526;&#36716;&#25442;&#20026;&#26080;&#23475;&#30340;&#12290; &#36825;&#26159;&#26368;&#21021;&#20960;&#24180;Django&#30340;&#40664;&#35748;&#26041;&#26696;&#65292;&#20294;&#26159;&#36825;&#26679;&#20570;&#30340;&#38382;&#39064;&#26159;&#23427;&#25226;&#36131;&#20219;&#25512;&#32473;&lt;em&gt;&#20320;&lt;/em&gt;&#65288;&#24320;&#21457;&#32773;&#12289;&#27169;&#29256;&#20316;&#32773;&#65289;&#33258;&#24049;&#65292;&#26469;&#30830;&#20445;&#25226;&#25152;&#26377;&#19996;&#35199;&#36716;&#24847;&#12290; &#24456;&#23481;&#26131;&#23601;&#24536;&#35760;&#36716;&#24847;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn96&quot;&gt;&#20108;&#26159;&#65292;&#20320;&#21487;&#20197;&#21033;&#29992;Django&#30340;&#33258;&#21160;html&#36716;&#24847;&#12290; &#36825;&#19968;&#31456;&#30340;&#21097;&#20313;&#37096;&#20998;&#25551;&#36848;&#33258;&#21160;&#36716;&#24847;&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#22312;django&#37324;&#40664;&#35748;&#24773;&#20917;&#19979;&#65292;&#27599;&#19968;&#20010;&#27169;&#26495;&#33258;&#21160;&#36716;&#24847;&#27599;&#19968;&#20010;&#21464;&#37327;&#26631;&#31614;&#30340;&#36755;&#20986;&#12290; &#23588;&#20854;&#26159;&#36825;&#20116;&#20010;&#23383;&#31526;&#12290;&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn98&quot;&gt;&lt;a href=&quot;#id5&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id6&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;``&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id5&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 491); &lt;em&gt;&lt;a href=&quot;#id6&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn99&quot;&gt;&amp;gt; &#34987;&#36716;&#25442;&#20026;&amp;gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn100&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;&lt;/span&gt;&lt;/tt&gt;&#65288;&#21333;&#24341;&#21495;&#65289;&#34987;&#36716;&#25442;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn101&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;&lt;/span&gt;&lt;/tt&gt;(&#21452;&#24341;&#21495;)&#34987;&#36716;&#25442;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn102&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn102&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;amp;&lt;/span&gt;&lt;/tt&gt; is converted to &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;amp;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#21478;&#22806;&#65292;&#25105;&#24378;&#35843;&#19968;&#19979;&#36825;&#20010;&#34892;&#20026;&#40664;&#35748;&#26159;&#24320;&#21551;&#30340;&#12290; &#22914;&#26524;&#20320;&#27491;&#22312;&#20351;&#29992;django&#30340;&#27169;&#26495;&#31995;&#32479;&#65292;&#37027;&#20040;&#20320;&#26159;&#34987;&#20445;&#25252;&#30340;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn104&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&#22914;&#20309;&#20851;&#38381;&#23427;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&#22914;&#26524;&#20320;&#19981;&#24819;&#25968;&#25454;&#34987;&#33258;&#21160;&#36716;&#24847;&#65292;&#22312;&#27599;&#19968;&#31449;&#28857;&#32423;&#21035;&#12289;&#27599;&#19968;&#27169;&#26495;&#32423;&#21035;&#25110;&#32773;&#27599;&#19968;&#21464;&#37327;&#32423;&#21035;&#20320;&#37117;&#26377;&#20960;&#31181;&#26041;&#27861;&#26469;&#20851;&#38381;&#23427;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#20026;&#20160;&#20040;&#35201;&#20851;&#38381;&#23427;&#65311; &#22240;&#20026;&#26377;&#26102;&#20505;&#27169;&#26495;&#21464;&#37327;&#21253;&#21547;&#20102;&#19968;&#20123;&#21407;&#22987;html&#25968;&#25454;&#65292;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#25105;&#20204;&#19981;&#24819;&#23427;&#20204;&#30340;&#20869;&#23481;&#34987;&#36716;&#24847;&#12290; &#20363;&#22914;&#65292;&#20320;&#21487;&#33021;&#22312;&#25968;&#25454;&#24211;&#37324;&#23384;&#20648;&#20102;&#19968;&#27573;&#34987;&#20449;&#20219;&#30340;html&#20195;&#30721;&#65292;&#24182;&#19988;&#20320;&#24819;&#30452;&#25509;&#25226;&#23427;&#23884;&#20837;&#21040;&#20320;&#30340;&#27169;&#26495;&#37324;&#12290; &#25110;&#32773;&#65292;&#20320;&#21487;&#33021;&#27491;&#22312;&#20351;&#29992;Django&#30340;&#27169;&#26495;&#31995;&#32479;&#29983;&#25104;&#38750;html&#25991;&#26412;&#65292;&#27604;&#22914;&#19968;&#23553;e-mail&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn107&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#23545;&#20110;&#21333;&#29420;&#30340;&#21464;&#37327;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&#29992;safe&#36807;&#28388;&#22120;&#20026;&#21333;&#29420;&#30340;&#21464;&#37327;&#20851;&#38381;&#33258;&#21160;&#36716;&#24847;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn110&quot;&gt;This will be escaped: {{ data }}
This will not be escaped: {{ data|safe }}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&#20320;&#21487;&#20197;&#25226;&lt;em&gt;safe&lt;/em&gt;&#24403;&#20570;&lt;em&gt;safe from further escaping&lt;/em&gt;&#30340;&#31616;&#20889;&#65292;&#25110;&#32773;&lt;em&gt;&#24403;&#20570;&#21487;&#20197;&#34987;&#30452;&#25509;&#35793;&#25104;HTML&#30340;&#20869;&#23481;&lt;/em&gt;&#12290;&#22312;&#36825;&#20010;&#20363;&#23376;&#37324;&#65292;&#22914;&#26524;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#25968;&#25454;&lt;/span&gt;&lt;/tt&gt;&#21253;&#21547;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;/tt&gt;&#65292;&#37027;&#20040;&#36755;&#20986;&#20250;&#21464;&#25104;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn113&quot;&gt;This will be escaped: &amp;amp;lt;b&amp;amp;gt;
This will not be escaped: &amp;lt;b&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn114&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#23545;&#20110;&#27169;&#26495;&#22359;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#20026;&#20102;&#25511;&#21046;&#27169;&#26495;&#30340;&#33258;&#21160;&#36716;&#24847;,&#29992;&#26631;&#31614;autoescape&#26469;&#21253;&#35013;&#25972;&#20010;&#27169;&#26495;(&#25110;&#32773;&#27169;&#26495;&#20013;&#24120;&#29992;&#30340;&#37096;&#20998;),&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn117&quot;&gt;{% autoescape off %}
    Hello {{ name }}
{% endautoescape %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;autoescape &#26631;&#31614;&#26377;&#20004;&#20010;&#21442;&#25968;on&#21644;off &#26377;&#26102;,&#20320;&#21487;&#33021;&#24819;&#38459;&#27490;&#19968;&#37096;&#20998;&#33258;&#21160;&#36716;&#24847;,&#23545;&#21478;&#19968;&#37096;&#20998;&#33258;&#21160;&#36716;&#24847;&#12290; &#36825;&#26159;&#19968;&#20010;&#27169;&#26495;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn120&quot;&gt;Auto-escaping is on by default. Hello {{ name }}

{% autoescape off %}
    This will not be auto-escaped: {{ data }}.

    Nor this: {{ other_data }}
    {% autoescape on %}
        Auto-escaping applies again: {{ name }}
    {% endautoescape %}
{% endautoescape %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn121&quot;&gt;auto-escaping &#26631;&#31614;&#30340;&#20316;&#29992;&#22495;&#19981;&#20165;&#21487;&#20197;&#24433;&#21709;&#21040;&#24403;&#21069;&#27169;&#26495;&#36824;&#21487;&#20197;&#36890;&#36807;include&#26631;&#31614;&#20316;&#29992;&#21040;&#20854;&#20182;&#26631;&#31614;,&#23601;&#20687;block&#26631;&#31614;&#19968;&#26679;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn123&quot;&gt;# base.html

{% autoescape off %}
&amp;lt;h1&amp;gt;{% block title %}{% endblock %}&amp;lt;/h1&amp;gt;
{% block content %}
{% endblock %}
{% endautoescape %}

# child.html

{% extends &quot;base.html&quot; %}
{% block title %}This &amp;amp; that{% endblock %}
{% block content %}{{ greeting }}{% endblock %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#30001;&#20110;&#22312;base&#27169;&#26495;&#20013;&#33258;&#21160;&#36716;&#24847;&#34987;&#20851;&#38381;,&#25152;&#20197;&#22312;child&#27169;&#26495;&#20013;&#33258;&#21160;&#36716;&#24847;&#20063;&#20250;&#20851;&#38381;.&#22240;&#27492;,&#22312;&#19979;&#38754;&#19968;&#27573;HTML&#34987;&#25552;&#20132;&#26102;,&#21464;&#37327;greeting&#30340;&#20540;&#23601;&#20026;&#23383;&#31526;&#20018;Hello!&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn126&quot;&gt;&amp;lt;h1&amp;gt;This &amp;amp; that&amp;lt;/h1&amp;gt;
&amp;lt;b&amp;gt;Hello!&amp;lt;/b&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn127&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&#22791;&#27880;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#36890;&#24120;,&#27169;&#26495;&#20316;&#32773;&#27809;&#24517;&#35201;&#20026;&#33258;&#21160;&#36716;&#24847;&#25285;&#24515;.
&#22522;&#20110;Pyhton&#30340;&#24320;&#21457;&#32773;(&#32534;&#20889;VIEWS&#35270;&#22270;&#21644;&#33258;&#23450;&#20041;&#36807;&#28388;&#22120;)&#21482;&#38656;&#35201;&#32771;&#34385;&#21738;&#20123;&#25968;&#25454;&#19981;&#38656;&#35201;&#34987;&#36716;&#24847;,&#36866;&#26102;&#30340;&#26631;&#35760;&#25968;&#25454;,&#23601;&#21487;&#20197;&#35753;&#23427;&#20204;&#22312;&#27169;&#26495;&#20013;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#22914;&#26524;&#20320;&#27491;&#22312;&#32534;&#20889;&#19968;&#20010;&#27169;&#26495;&#32780;&#19981;&#30693;&#36947;&#26159;&#21542;&#35201;&#20851;&#38381;&#33258;&#21160;&#36716;&#24847;,&#37027;&#23601;&#20026;&#25152;&#26377;&#38656;&#35201;&#36716;&#24847;&#30340;&#21464;&#37327;&#28155;&#21152;&#19968;&#20010;escape&#36807;&#28388;&#22120;&#12290; &#24403;&#33258;&#21160;&#36716;&#24847;&#24320;&#21551;&#26102;&#65292;&#20351;&#29992;escape&#36807;&#28388;&#22120;&#20284;&#20046;&#20250;&#20004;&#27425;&#36716;&#24847;&#25968;&#25454;&#65292;&#20294;&#20854;&#23454;&#27809;&#26377;&#20219;&#20309;&#21361;&#38505;&#12290;&#22240;&#20026;escape&#36807;&#28388;&#22120;&#19981;&#20316;&#29992;&#20110;&#34987;&#36716;&#24847;&#36807;&#30340;&#21464;&#37327;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn130&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#36807;&#28388;&#22120;&#21442;&#25968;&#37324;&#30340;&#23383;&#31526;&#20018;&#24120;&#37327;&#30340;&#33258;&#21160;&#36716;&#20041;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#23601;&#20687;&#25105;&#20204;&#21069;&#38754;&#25552;&#21040;&#30340;,&#36807;&#28388;&#22120;&#20063;&#21487;&#20197;&#26159;&#23383;&#31526;&#20018;.&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn133&quot;&gt;{{ data|default:&quot;This is a string literal.&quot; }}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn134&quot;&gt;&#25152;&#26377;&#23383;&#31526;&#24120;&#37327;&#27809;&#26377;&#32463;&#36807;&#36716;&#20041;&#23601;&#34987;&#25554;&#20837;&#27169;&#26495;,&#23601;&#22914;&#21516;&#23427;&#20204;&#37117;&#32463;&#36807;&#20102;safe&#36807;&#28388;&#12290; &#36825;&#26159;&#30001;&#20110;&#23383;&#31526;&#24120;&#37327;&#23436;&#20840;&#30001;&#27169;&#26495;&#20316;&#32773;&#20915;&#23450;,&#22240;&#27492;&#32534;&#20889;&#27169;&#26495;&#30340;&#26102;&#20505;&#20182;&#20204;&#20250;&#30830;&#20445;&#25991;&#26412;&#30340;&#27491;&#30830;&#24615;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#36825;&#24847;&#21619;&#30528;&#20320;&#24517;&#39035;&#36825;&#26679;&#20889;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn137&quot;&gt;{{ data|default:&quot;3 &amp;amp;lt; 2&quot; }}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#32780;&#19981;&#26159;&#36825;&#26679;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn140&quot;&gt;{{ data|default:&quot;3 &amp;lt; 2&quot; }}  &amp;lt;-- Bad! Don&apos;t do this.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn141&quot;&gt;&#36825;&#28857;&#23545;&#26469;&#33258;&#21464;&#37327;&#26412;&#36523;&#30340;&#25968;&#25454;&#19981;&#36215;&#20316;&#29992;&#12290; &#22914;&#26524;&#24517;&#35201;,&#21464;&#37327;&#20869;&#23481;&#20250;&#33258;&#21160;&#36716;&#20041;,&#22240;&#20026;&#23427;&#20204;&#19981;&#22312;&#27169;&#26495;&#20316;&#32773;&#30340;&#25511;&#21046;&#19979;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn142&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#27169;&#26495;&#21152;&#36733;&#30340;&#20869;&#24149;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn143&quot;&gt;&#19968;&#33324;&#35828;&#26469;&#65292;&#20320;&#20250;&#25226;&#27169;&#26495;&#20197;&#25991;&#20214;&#30340;&#26041;&#24335;&#23384;&#20648;&#22312;&#25991;&#20214;&#31995;&#32479;&#20013;&#65292;&#20294;&#26159;&#20320;&#20063;&#21487;&#20197;&#20351;&#29992;&#33258;&#23450;&#20041;&#30340; &lt;em&gt;template loaders&lt;/em&gt; &#20174;&#20854;&#20182;&#26469;&#28304;&#21152;&#36733;&#27169;&#26495;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn144&quot;&gt;Django&#26377;&#20004;&#31181;&#26041;&#27861;&#21152;&#36733;&#27169;&#26495;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn145&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn145&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.loader.get_template(template_name)&lt;/span&gt;&lt;/tt&gt; &#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template&lt;/span&gt;&lt;/tt&gt; &#26681;&#25454;&#32473;&#23450;&#30340;&#27169;&#26495;&#21517;&#31216;&#36820;&#22238;&#19968;&#20010;&#24050;&#32534;&#35793;&#30340;&#27169;&#26495;&#65288;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Template&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65289;&#12290; &#22914;&#26524;&#27169;&#26495;&#19981;&#23384;&#22312;&#65292;&#23601;&#35302;&#21457; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TemplateDoesNotExist&lt;/span&gt;&lt;/tt&gt; &#30340;&#24322;&#24120;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn146&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn146&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.loader.select_template(template_name_list)&lt;/span&gt;&lt;/tt&gt; &#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;select_template&lt;/span&gt;&lt;/tt&gt; &#24456;&#20687; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template&lt;/span&gt;&lt;/tt&gt; &#65292;&#19981;&#36807;&#23427;&#26159;&#20197;&#27169;&#26495;&#21517;&#31216;&#30340;&#21015;&#34920;&#20316;&#20026;&#21442;&#25968;&#30340;&#12290; &#23427;&#20250;&#36820;&#22238;&#21015;&#34920;&#20013;&#23384;&#22312;&#30340;&#31532;&#19968;&#20010;&#27169;&#26495;&#12290;
&#22914;&#26524;&#27169;&#26495;&#37117;&#19981;&#23384;&#22312;&#65292;&#23558;&#20250;&#35302;&#21457;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TemplateDoesNotExist&lt;/span&gt;&lt;/tt&gt;&#24322;&#24120;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn147&quot;&gt;&#27491;&#22914;&#22312;&#31532;&#22235;&#31456;&#20013;&#25152;&#25552;&#21040;&#30340;&#65292;&#40664;&#35748;&#24773;&#20917;&#19979;&#36825;&#20123;&#20989;&#25968;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#30340;&#35774;&#32622;&#26469;&#36733;&#20837;&#27169;&#26495;&#12290; &#20294;&#26159;&#65292;&#22312;&#20869;&#37096;&#36825;&#20123;&#20989;&#25968;&#21487;&#20197;&#25351;&#23450;&#19968;&#20010;&#27169;&#26495;&#21152;&#36733;&#22120;&#26469;&#23436;&#25104;&#36825;&#20123;&#32321;&#37325;&#30340;&#20219;&#21153;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn148&quot;&gt;&#19968;&#20123;&#21152;&#36733;&#22120;&#40664;&#35748;&#34987;&#31105;&#29992;&#65292;&#20294;&#26159;&#20320;&#21487;&#20197;&#36890;&#36807;&#32534;&#36753; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_LOADERS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#26469;&#28608;&#27963;&#23427;&#20204;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_LOADERS&lt;/span&gt;&lt;/tt&gt; &#24212;&#24403;&#26159;&#19968;&#20010;&#23383;&#31526;&#20018;&#30340;&#20803;&#32452;&#65292;&#20854;&#20013;&#27599;&#20010;&#23383;&#31526;&#20018;&#37117;&#34920;&#31034;&#19968;&#20010;&#27169;&#26495;&#21152;&#36733;&#22120;&#12290; &#36825;&#20123;&#27169;&#26495;&#21152;&#36733;&#22120;&#38543;Django&#19968;&#36215;&#21457;&#24067;&#12290;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.loaders.filesystem.load_template_source&lt;/span&gt;&lt;/tt&gt; : &#36825;&#20010;&#21152;&#36733;&#22120;&#26681;&#25454; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#30340;&#35774;&#32622;&#20174;&#25991;&#20214;&#31995;&#32479;&#21152;&#36733;&#27169;&#26495;&#12290;&#23427;&#40664;&#35748;&#26159;&#21487;&#29992;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn150&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.loaders.app_directories.load_template_source&lt;/span&gt;&lt;/tt&gt; : &#36825;&#20010;&#21152; &#36733;&#22120;&#20174;&#25991;&#20214;&#31995;&#32479;&#19978;&#30340;Django&#24212;&#29992;&#20013;&#21152;&#36733;&#27169;&#26495;&#12290; &#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#27599;&#20010;&#24212;&#29992;&#65292;&#36825;&#20010;&#21152;&#36733;&#22120;&#20250;&#26597;&#25214;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;templates&lt;/span&gt;&lt;/tt&gt; &#23376;&#30446;&#24405;&#12290; &#22914;&#26524;&#36825;&#20010;&#30446;&#24405;&#23384;&#22312;&#65292;Django&#23601;&#22312;&#37027;&#37324;&#23547;&#25214;&#27169;&#26495;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn151&quot;&gt;&#36825;&#24847;&#21619;&#30528;&#20320;&#21487;&#20197;&#25226;&#27169;&#26495;&#21644;&#20320;&#30340;&#24212;&#29992;&#19968;&#36215;&#20445;&#23384;&#65292;&#20174;&#32780;&#20351;&#24471;Django&#24212;&#29992;&#26356;&#23481;&#26131;&#21644;&#40664;&#35748;&#27169;&#26495;&#19968;&#36215;&#21457;&#24067;&#12290;
&#20363;&#22914;&#65292;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;(&apos;myproject.polls&apos;,&apos;myproject.music&apos;)&lt;/span&gt;&lt;/tt&gt; &#65292;&#37027;&#20040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_template(&apos;foo.html&apos;)&lt;/span&gt;&lt;/tt&gt; &#20250;&#25353;&#36825;&#20010;&#39034;&#24207;&#26597;&#25214;&#27169;&#26495;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn152&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn152&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/path/to/myproject/polls/templates/foo.html&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn153&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn153&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/path/to/myproject/music/templates/foo.html&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&#35831;&#27880;&#24847;&#21152;&#36733;&#22120;&#22312;&#39318;&#27425;&#34987;&#23548;&#20837;&#30340;&#26102;&#20505;&#20250;&#25191;&#34892;&#19968;&#20010;&#20248;&#21270;&#65306; &#23427;&#20250;&#32531;&#23384;&#19968;&#20010;&#21015;&#34920;&#65292;&#36825;&#20010;&#21015;&#34920;&#21253;&#21547;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#20013;&#24102;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;templates&lt;/span&gt;&lt;/tt&gt; &#23376;&#30446;&#24405;&#30340;&#21253;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&#36825;&#20010;&#21152;&#36733;&#22120;&#40664;&#35748;&#21551;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn156&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.template.loaders.eggs.load_template_source&lt;/span&gt;&lt;/tt&gt; : &#36825;&#20010;&#21152;&#36733;&#22120;&#31867;&#20284; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;app_directories&lt;/span&gt;&lt;/tt&gt; &#65292;&#21482;&#19981;&#36807;&#23427;&#20174;Python eggs&#32780;&#19981;&#26159;&#25991;&#20214;&#31995;&#32479;&#20013;&#21152;&#36733;&#27169;&#26495;&#12290; &#36825;&#20010;&#21152;&#36733;&#22120;&#40664;&#35748;&#34987;&#31105;&#29992;&#65307;&#22914;&#26524;&#20320;&#20351;&#29992;eggs&#26469;&#21457;&#24067;&#20320;&#30340;&#24212;&#29992;&#65292;&#37027;&#20040;&#20320;&#23601;&#38656;&#35201;&#21551;&#29992;&#23427;&#12290;
Python eggs&#21487;&#20197;&#23558;Python&#20195;&#30721;&#21387;&#32553;&#21040;&#19968;&#20010;&#25991;&#20214;&#20013;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn157&quot;&gt;Django&#25353;&#29031; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_LOADERS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#30340;&#39034;&#24207;&#20351;&#29992;&#27169;&#26495;&#21152;&#36733;&#22120;&#12290; &#23427;&#36880;&#20010;&#20351;&#29992;&#27599;&#20010;&#21152;&#36733;&#22120;&#30452;&#33267;&#25214;&#21040;&#19968;&#20010;&#21305;&#37197;&#30340;&#27169;&#26495;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn158&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn158&quot;&gt;&#25193;&#23637;&#27169;&#26495;&#31995;&#32479;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&#26082;&#28982;&#20320;&#24050;&#32463;&#23545;&#27169;&#26495;&#31995;&#32479;&#30340;&#20869;&#24149;&#22810;&#20102;&#19968;&#20123;&#20102;&#35299;&#65292;&#35753;&#25105;&#20204;&#26469;&#30475;&#30475;&#22914;&#20309;&#20351;&#29992;&#33258;&#23450;&#20041;&#30340;&#20195;&#30721;&#26469;&#25193;&#23637;&#36825;&#20010;&#31995;&#32479;&#21543;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn160&quot;&gt;&#32477;&#22823;&#37096;&#20998;&#30340;&#27169;&#26495;&#23450;&#21046;&#26159;&#20197;&#33258;&#23450;&#20041;&#26631;&#31614;/&#36807;&#28388;&#22120;&#30340;&#26041;&#24335;&#26469;&#23436;&#25104;&#30340;&#12290; &#23613;&#31649;Django&#27169;&#26495;&#35821;&#35328;&#33258;&#24102;&#20102;&#35768;&#22810;&#20869;&#24314;&#26631;&#31614;&#21644;&#36807;&#28388;&#22120;&#65292;&#20294;&#26159;&#20320;&#21487;&#33021;&#36824;&#26159;&#38656;&#35201;&#32452;&#24314;&#20320;&#33258;&#24049;&#30340;&#26631;&#31614;&#21644;&#36807;&#28388;&#22120;&#24211;&#26469;&#28385;&#36275;&#20320;&#30340;&#38656;&#35201;&#12290; &#24184;&#36816;&#30340;&#26159;&#65292;&#23450;&#20041;&#20320;&#33258;&#24049;&#30340;&#21151;&#33021;&#38750;&#24120;&#23481;&#26131;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn161&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn161&quot;&gt;&#21019;&#24314;&#19968;&#20010;&#27169;&#26495;&#24211;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#19981;&#31649;&#26159;&#20889;&#33258;&#23450;&#20041;&#26631;&#31614;&#36824;&#26159;&#36807;&#28388;&#22120;&#65292;&#31532;&#19968;&#20214;&#35201;&#20570;&#30340;&#20107;&#26159;&#21019;&#24314;&lt;strong&gt;&#27169;&#26495;&#24211;&lt;/strong&gt;&#65288;Django&#33021;&#22815;&#23548;&#20837;&#30340;&#22522;&#26412;&#32467;&#26500;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn163&quot;&gt;&#21019;&#24314;&#19968;&#20010;&#27169;&#26495;&#24211;&#20998;&#20004;&#27493;&#36208;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn164&quot;&gt;&#31532;&#19968;&#65292;&#20915;&#23450;&#27169;&#26495;&#24211;&#24212;&#35813;&#25918;&#22312;&#21738;&#20010;Django&#24212;&#29992;&#19979;&#12290;
&#22914;&#26524;&#20320;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startapp&lt;/span&gt;&lt;/tt&gt; &#21019;&#24314;&#20102;&#19968;&#20010;&#24212;&#29992;&#65292;&#20320;&#21487;&#20197;&#25226;&#23427;&#25918;&#22312;&#37027;&#37324;&#65292;&#25110;&#32773;&#20320;&#21487;&#20197;&#20026;&#27169;&#26495;&#24211;&#21333;&#29420;&#21019;&#24314;&#19968;&#20010;&#24212;&#29992;&#12290; &#25105;&#20204;&#26356;&#25512;&#33616;&#20351;&#29992;&#21518;&#32773;&#65292;&#22240;&#20026;&#20320;&#30340;filter&#21487;&#33021;&#22312;&#21518;&#26469;&#30340;&#24037;&#31243;&#20013;&#26377;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&#26080;&#35770;&#20320;&#37319;&#29992;&#20309;&#31181;&#26041;&#24335;&#65292;&#35831;&#30830;&#20445;&#25226;&#20320;&#30340;&#24212;&#29992;&#28155;&#21152;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#20013;&#12290; &#25105;&#20204;&#31245;&#21518;&#20250;&#35299;&#37322;&#36825;&#19968;&#28857;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn166&quot;&gt;&#31532;&#20108;&#65292;&#22312;&#36866;&#24403;&#30340;Django&#24212;&#29992;&#21253;&#37324;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;templatetags&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#12290; &#36825;&#20010;&#30446;&#24405;&#24212;&#24403;&#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;models.py&lt;/span&gt;&lt;/tt&gt; &#12289; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;views.py&lt;/span&gt;&lt;/tt&gt; &#31561;&#22788;&#20110;&#21516;&#19968;&#23618;&#27425;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn168&quot;&gt;books/
    __init__.py
    models.py
    templatetags/
    views.py
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn169&quot;&gt;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;templatetags&lt;/span&gt;&lt;/tt&gt; &#20013;&#21019;&#24314;&#20004;&#20010;&#31354;&#25991;&#20214;&#65306; &#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__init__.py&lt;/span&gt;&lt;/tt&gt; &#65288;&#21578;&#35785;Python&#36825;&#26159; &#19968;&#20010;&#21253;&#21547;&#20102;Python&#20195;&#30721;&#30340;&#21253;&#65289;&#21644;&#19968;&#20010;&#29992;&#26469;&#23384;&#25918;&#20320;&#33258;&#23450;&#20041;&#30340;&#26631;&#31614;/&#36807;&#28388;&#22120;&#23450;&#20041;&#30340;&#25991;&#20214;&#12290; &#31532;&#20108;&#20010;&#25991;&#20214;&#30340;&#21517;&#23383;&#31245;&#21518;&#23558;&#29992;&#26469;&#21152;&#36733;&#26631;&#31614;&#12290; &#20363;&#22914;&#65292;&#22914;&#26524;&#20320;&#30340;&#33258;&#23450;&#20041;&#26631;&#31614;/&#36807;&#28388;&#22120;&#22312;&#19968;&#20010;&#21483;&#20316; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;poll_extras.py&lt;/span&gt;&lt;/tt&gt; &#30340;&#25991;&#20214;&#20013;&#65292;&#20320;&#38656;&#35201;&#22312;&#27169;&#26495;&#20013;&#20889;&#20837;&#22914;&#19979;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn171&quot;&gt;{% load poll_extras %}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn172&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#26816;&#26597; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#35774;&#32622;&#65292;&#20165;&#20801;&#35768;&#21152;&#36733;&#24050;&#23433;&#35013;&#30340;Django&#24212;&#29992;&#31243;&#24207;&#20013;&#30340;&#27169;&#26495;&#24211;&#12290; &#36825;&#26159;&#19968;&#20010;&#23433;&#20840;&#29305;&#24615;&#65307;&#23427;&#21487;&#20197;&#35753;&#20320;&#22312;&#19968;&#21488;&#30005;&#33041;&#19978;&#37096;&#32626;&#24456;&#22810;&#30340;&#27169;&#26495;&#24211;&#30340;&#20195;&#30721;&#65292;&#32780;&#21448;&#19981;&#29992;&#25226;&#23427;&#20204;&#26292;&#38706;&#32473;&#27599;&#19968;&#20010;Django&#23433;&#35013;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn173&quot;&gt;&#22914;&#26524;&#20320;&#20889;&#20102;&#19968;&#20010;&#19981;&#21644;&#20219;&#20309;&#29305;&#23450;&#27169;&#22411;/&#35270;&#22270;&#20851;&#32852;&#30340;&#27169;&#26495;&#24211;&#65292;&#37027;&#20040;&#24471;&#21040;&#19968;&#20010;&#20165;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;templatetags&lt;/span&gt;&lt;/tt&gt; &#21253;&#30340;Django&#24212;&#29992;&#31243;&#24207;&#21253;&#26159;&#23436;&#20840;&#27491;&#24120;&#30340;&#12290; &#23545;&#20110;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;templatetags&lt;/span&gt;&lt;/tt&gt; &#21253;&#20013;&#25918;&#32622;&#22810;&#23569;&#20010;&#27169;&#22359;&#27809;&#26377;&#20570;&#20219;&#20309;&#30340;&#38480;&#21046;&#12290; &#38656;&#35201;&#20102;&#35299;&#30340;&#26159;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%load%}&lt;/span&gt;&lt;/tt&gt;&#35821;&#21477;&#26159;&#36890;&#36807;&#25351;&#23450;&#30340;Python&#27169;&#22359;&#21517;&#32780;&#19981;&#26159;&#24212;&#29992;&#21517;&#26469;&#21152;&#36733;&#26631;&#31614;/&#36807;&#28388;&#22120;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#19968;&#26086;&#21019;&#24314;&#20102;Python&#27169;&#22359;&#65292;&#20320;&#21482;&#38656;&#26681;&#25454;&#26159;&#35201;&#32534;&#20889;&#36807;&#28388;&#22120;&#36824;&#26159;&#26631;&#31614;&#26469;&#30456;&#24212;&#30340;&#32534;&#20889;&#19968;&#20123;Python&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn175&quot;&gt;&#20316;&#20026;&#21512;&#27861;&#30340;&#26631;&#31614;&#24211;&#65292;&#27169;&#22359;&#38656;&#35201;&#21253;&#21547;&#19968;&#20010;&#21517;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;register&lt;/span&gt;&lt;/tt&gt;&#30340;&#27169;&#22359;&#32423;&#21464;&#37327;&#12290;&#36825;&#20010;&#21464;&#37327;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template.Library&lt;/span&gt;&lt;/tt&gt;&#30340;&#23454;&#20363;&#65292;&#26159;&#25152;&#26377;&#27880;&#20876;&#26631;&#31614;&#21644;&#36807;&#28388;&#22120;&#30340;&#25968;&#25454;&#32467;&#26500;&#12290; &#25152;&#20197;&#65292;&#35831;&#22312;&#20320;&#30340;&#27169;&#22359;&#30340;&#39030;&#37096;&#25554;&#20837;&#22914;&#19979;&#35821;&#21477;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn177&quot;&gt;from django import template

register = template.Library()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn178&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn179&quot;&gt;&#35831;&#38405;&#35835;Django&#40664;&#35748;&#30340;&#36807;&#28388;&#22120;&#21644;&#26631;&#31614;&#30340;&#28304;&#30721;&#65292;&#37027;&#37324;&#26377;&#22823;&#37327;&#30340;&#20363;&#23376;&#12290; &#20182;&#20204;&#20998;&#21035;&#20026;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django/template/defaultfilters.py&lt;/span&gt;&lt;/tt&gt; &#21644; django/template/defaulttags.py &#12290;django.contrib&#20013;&#30340;&#26576;&#20123;&#24212;&#29992;&#31243;&#24207;&#20063;&#21253;&#21547;&#27169;&#26495;&#24211;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;register&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#21518;&#65292;&#20320;&#23601;&#21487;&#20197;&#20351;&#29992;&#23427;&#26469;&#21019;&#24314;&#27169;&#26495;&#30340;&#36807;&#28388;&#22120;&#21644;&#26631;&#31614;&#20102;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id15&quot;&gt;
</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter10</id>
        <title type="html">chapter10</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter10"/>
        <published>2015-02-26T23:22:39+08:00</published>
        <updated>2015-02-26T23:22:39+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;10&#31456;&#65306; &#25968;&#25454;&#27169;&#22411;&#39640;&#32423;&#36827;&#38454;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#22312;&#31532;5&#31456;&#37324;&#65292;&#25105;&#20204;&#20171;&#32461;&#20102;Django&#30340;&#25968;&#25454;&#23618;&#22914;&#20309;&#23450;&#20041;&#25968;&#25454;&#27169;&#22411;&#20197;&#21450;&#22914;&#20309;&#20351;&#29992;&#25968;&#25454;&#24211;API&#26469;&#21019;&#24314;&#12289;&#26816;&#32034;&#12289;&#26356;&#26032;&#20197;&#21450;&#21024;&#38500;&#35760;&#24405; &#22312;&#36825;&#31456;&#37324;&#65292;&#25105;&#20204;&#23558;&#21521;&#20320;&#20171;&#32461;Django&#22312;&#36825;&#26041;&#38754;&#30340;&#19968;&#20123;&#26356;&#39640;&#32423;&#21151;&#33021;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn2&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#30456;&#20851;&#23545;&#35937;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#20808;&#35753;&#25105;&#20204;&#22238;&#24518;&#19968;&#19979;&#22312;&#31532;&#20116;&#31456;&#37324;&#30340;&#20851;&#20110;&#20070;&#26412;(book)&#30340;&#25968;&#25454;&#27169;&#22411;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn5&quot;&gt;from django.db import models

class Publisher(models.Model):
    name = models.CharField(max_length=30)
    address = models.CharField(max_length=50)
    city = models.CharField(max_length=60)
    state_province = models.CharField(max_length=30)
    country = models.CharField(max_length=50)
    website = models.URLField()

    def __unicode__(self):
        return self.name

class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField()

    def __unicode__(self):
        return u&apos;%s %s&apos; % (self.first_name, self.last_name)

class Book(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publication_date = models.DateField()

    def __unicode__(self):
        return self.title
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&#22914;&#25105;&#20204;&#22312;&#31532;5&#31456;&#30340;&#35762;&#35299;,&#33719;&#21462;&#25968;&#25454;&#24211;&#23545;&#35937;&#30340;&#29305;&#23450;&#23383;&#27573;&#30340;&#20540;&#21482;&#38656;&#30452;&#25509;&#20351;&#29992;&#23646;&#24615;&#12290; &#20363;&#22914;,&#35201;&#30830;&#23450;ID&#20026;50&#30340;&#20070;&#26412;&#30340;&#26631;&#39064;,&#25105;&#20204;&#36825;&#26679;&#20570;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn8&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from mysite.books.models import Book
&amp;gt;&amp;gt;&amp;gt; b = Book.objects.get(id=50)
&amp;gt;&amp;gt;&amp;gt; b.title
u&apos;The Django Book&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#20294;&#26159;,&#22312;&#20043;&#21069;&#26377;&#19968;&#20214;&#25105;&#20204;&#27809;&#25552;&#21450;&#21040;&#30340;&#26159;&#34920;&#29616;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ForeignKey&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ManyToManyField&lt;/span&gt;&lt;/tt&gt;&#30340;&#20851;&#32852;&#23545;&#35937;&#23383;&#27573;,&#23427;&#20204;&#30340;&#20316;&#29992;&#31245;&#26377;&#19981;&#21516;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;foreign-key&quot;&gt;
&lt;span id=&quot;cn10&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#35775;&#38382;&#22806;&#38190;(Foreign Key)&#20540;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#24403;&#20320;&#33719;&#21462;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ForeignKey&lt;/span&gt;&lt;/tt&gt; &#23383;&#27573;&#26102;,&#20320;&#20250;&#24471;&#21040;&#30456;&#20851;&#30340;&#25968;&#25454;&#27169;&#22411;&#23545;&#35937;&#12290; &#20363;&#22914;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn13&quot;&gt;&amp;gt;&amp;gt;&amp;gt; b = Book.objects.get(id=50)
&amp;gt;&amp;gt;&amp;gt; b.publisher
&amp;lt;Publisher: Apress Publishing&amp;gt;
&amp;gt;&amp;gt;&amp;gt; b.publisher.website
u&apos;http://www.apress.com/&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&#23545;&#20110;&#29992;`` ForeignKey`` &#26469;&#23450;&#20041;&#30340;&#20851;&#31995;&#26469;&#35828;&#65292;&#22312;&#20851;&#31995;&#30340;&#21478;&#19968;&#31471;&#20063;&#33021;&#21453;&#21521;&#30340;&#36861;&#28335;&#22238;&#26469;&#65292;&#21482;&#19981;&#36807;&#30001;&#20110;&#19981;&#23545;&#31216;&#24615;&#30340;&#20851;&#31995;&#32780;&#31245;&#26377;&#19981;&#21516;&#12290; &#36890;&#36807;&#19968;&#20010;`` publisher`` &#23545;&#35937;&#65292;&#30452;&#25509;&#33719;&#21462; books &#65292;&#29992; publisher.book_set.all() &#65292;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn16&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p = Publisher.objects.get(name=&apos;Apress Publishing&apos;)
&amp;gt;&amp;gt;&amp;gt; p.book_set.all()
[&amp;lt;Book: The Django Book&amp;gt;, &amp;lt;Book: Dive Into Python&amp;gt;, ...]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#23454;&#38469;&#19978;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;book_set&lt;/span&gt;&lt;/tt&gt; &#21482;&#26159;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;QuerySet&lt;/span&gt;&lt;/tt&gt;&#65288;&#21442;&#32771;&#31532;5&#31456;&#30340;&#20171;&#32461;&#65289;&#65292;&#25152;&#20197;&#23427;&#21487;&#20197;&#20687;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;QuerySet&lt;/span&gt;&lt;/tt&gt;&#19968;&#26679;,&#33021;&#23454;&#29616;&#25968;&#25454;&#36807;&#28388;&#21644;&#20998;&#20999;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn19&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p = Publisher.objects.get(name=&apos;Apress Publishing&apos;)
&amp;gt;&amp;gt;&amp;gt; p.book_set.filter(name__icontains=&apos;django&apos;)
[&amp;lt;Book: The Django Book&amp;gt;, &amp;lt;Book: Pro Django&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#23646;&#24615;&#21517;&#31216;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;book_set&lt;/span&gt;&lt;/tt&gt;&#26159;&#30001;&#27169;&#22411;&#21517;&#31216;&#30340;&#23567;&#20889;(&#22914;book)&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_set&lt;/span&gt;&lt;/tt&gt;&#32452;&#25104;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;many-to-many-values&quot;&gt;
&lt;span id=&quot;cn21&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#35775;&#38382;&#22810;&#23545;&#22810;&#20540;(Many-to-Many Values)&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&#22810;&#23545;&#22810;&#21644;&#22806;&#38190;&#24037;&#20316;&#26041;&#24335;&#30456;&#21516;&#65292;&#21482;&#19981;&#36807;&#25105;&#20204;&#22788;&#29702;&#30340;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;QuerySet&lt;/span&gt;&lt;/tt&gt;&#32780;&#19981;&#26159;&#27169;&#22411;&#23454;&#20363;&#12290; &#20363;&#22914;,&#36825;&#37324;&#26159;&#22914;&#20309;&#26597;&#30475;&#20070;&#31821;&#30340;&#20316;&#32773;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn24&quot;&gt;&amp;gt;&amp;gt;&amp;gt; b = Book.objects.get(id=50)
&amp;gt;&amp;gt;&amp;gt; b.authors.all()
[&amp;lt;Author: Adrian Holovaty&amp;gt;, &amp;lt;Author: Jacob Kaplan-Moss&amp;gt;]
&amp;gt;&amp;gt;&amp;gt; b.authors.filter(first_name=&apos;Adrian&apos;)
[&amp;lt;Author: Adrian Holovaty&amp;gt;]
&amp;gt;&amp;gt;&amp;gt; b.authors.filter(first_name=&apos;Adam&apos;)
[]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#21453;&#21521;&#26597;&#35810;&#20063;&#21487;&#20197;&#12290; &#35201;&#26597;&#30475;&#19968;&#20010;&#20316;&#32773;&#30340;&#25152;&#26377;&#20070;&#31821;,&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;author.book_set&lt;/span&gt;&lt;/tt&gt; ,&#23601;&#22914;&#36825;&#26679;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn27&quot;&gt;&amp;gt;&amp;gt;&amp;gt; a = Author.objects.get(first_name=&apos;Adrian&apos;, last_name=&apos;Holovaty&apos;)
&amp;gt;&amp;gt;&amp;gt; a.book_set.all()
[&amp;lt;Book: The Django Book&amp;gt;, &amp;lt;Book: Adrian&apos;s Other Book&amp;gt;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&#36825;&#37324;,&#23601;&#20687;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ForeignKey&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#19968;&#26679;&#65292;&#23646;&#24615;&#21517;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;book_set&lt;/span&gt;&lt;/tt&gt;&#26159;&#22312;&#25968;&#25454;&#27169;&#22411;(model)&#21517;&#21518;&#36861;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_set&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;database-schema&quot;&gt;
&lt;span id=&quot;cn29&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#26356;&#25913;&#25968;&#25454;&#24211;&#27169;&#24335;(Database Schema)&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#22312;&#25105;&#20204;&#22312;&#31532;5&#31456;&#20171;&#32461; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#21629;&#20196;&#26102;, &#25105;&#20204;&#27880;&#24847;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt;&#20165;&#20165;&#21019;&#24314;&#25968;&#25454;&#24211;&#37324;&#36824;&#27809;&#26377;&#30340;&#34920;&#65292;&#23427; &lt;em&gt;&#24182;&#19981;&lt;/em&gt; &#23545;&#20320;&#25968;&#25454;&#27169;&#22411;&#30340;&#20462;&#25913;&#36827;&#34892;&#21516;&#27493;,&#20063;&#19981;&#22788;&#29702;&#25968;&#25454;&#27169;&#22411;&#30340;&#21024;&#38500;&#12290; &#22914;&#26524;&#20320;&#26032;&#22686;&#25110;&#20462;&#25913;&#25968;&#25454;&#27169;&#22411;&#37324;&#30340;&#23383;&#27573;,&#25110;&#26159;&#21024;&#38500;&#20102;&#19968;&#20010;&#25968;&#25454;&#27169;&#22411;&#65292;&#20320;&#38656;&#35201;&#25163;&#21160;&#22312;&#25968;&#25454;&#24211;&#37324;&#36827;&#34892;&#30456;&#24212;&#30340;&#20462;&#25913;&#12290; &#36825;&#27573;&#23558;&#35299;&#37322;&#20102;&#20855;&#20307;&#24590;&#20040;&#20570;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#24403;&#22788;&#29702;&#27169;&#22411;&#20462;&#25913;&#30340;&#26102;&#20505;&#65292;&#23558;Django&#30340;&#25968;&#25454;&#24211;&#23618;&#30340;&#24037;&#20316;&#27969;&#31243;&#38125;&#35760;&#20110;&#24515;&#26159;&#24456;&#37325;&#35201;&#30340;&#12290;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn32&quot;&gt;&#22914;&#26524;&#27169;&#22411;&#21253;&#21547;&#19968;&#20010;&#26410;&#26366;&#22312;&#25968;&#25454;&#24211;&#37324;&#24314;&#31435;&#30340;&#23383;&#27573;&#65292;Django&#20250;&#25253;&#20986;&#38169;&#20449;&#24687;&#12290; &#24403;&#20320;&#31532;&#19968;&#27425;&#29992;Django&#30340;&#25968;&#25454;&#24211;API&#35831;&#27714;&#34920;&#20013;&#19981;&#23384;&#22312;&#30340;&#23383;&#27573;&#26102;&#20250;&#23548;&#33268;&#38169;&#35823;&#65288;&#23601;&#26159;&#35828;&#65292;&#23427;&#20250;&#22312;&#36816;&#34892;&#26102;&#20986;&#38169;&#65292;&#32780;&#19981;&#26159;&#32534;&#35793;&#26102;&#65289;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn33&quot;&gt;Django&lt;em&gt;&#19981;&lt;/em&gt;&#20851;&#24515;&#25968;&#25454;&#24211;&#34920;&#20013;&#26159;&#21542;&#23384;&#22312;&#26410;&#22312;&#27169;&#22411;&#20013;&#23450;&#20041;&#30340;&#21015;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn34&quot;&gt;Django&lt;em&gt;&#19981;&lt;/em&gt;&#20851;&#24515;&#25968;&#25454;&#24211;&#20013;&#26159;&#21542;&#23384;&#22312;&#26410;&#34987;&#27169;&#22411;&#34920;&#31034;&#30340;&#34920;&#26684;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#25913;&#21464;&#27169;&#22411;&#30340;&#27169;&#24335;&#26550;&#26500;&#24847;&#21619;&#30528;&#38656;&#35201;&#25353;&#29031;&#39034;&#24207;&#26356;&#25913;Python&#20195;&#30721;&#21644;&#25968;&#25454;&#24211;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn36&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&#28155;&#21152;&#23383;&#27573;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#24403;&#35201;&#21521;&#19968;&#20010;&#20135;&#21697;&#35774;&#32622;&#34920;(&#25110;&#32773;&#35828;&#26159;model)&#28155;&#21152;&#19968;&#20010;&#23383;&#27573;&#30340;&#26102;&#20505;&#65292;&#35201;&#20351;&#29992;&#30340;&#25216;&#24039;&#26159;&#21033;&#29992;Django&#19981;&#20851;&#24515;&#34920;&#37324;&#26159;&#21542;&#21253;&#21547;model&#37324;&#25152;&#27809;&#26377;&#30340;&#21015;&#30340;&#29305;&#24615;&#12290; &#31574;&#30053;&#23601;&#26159;&#29616;&#22312;&#25968;&#25454;&#24211;&#37324;&#21152;&#20837;&#23383;&#27573;&#65292;&#28982;&#21518;&#21516;&#27493;Django&#30340;&#27169;&#22411;&#20197;&#21253;&#21547;&#26032;&#23383;&#27573;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#28982;&#32780; &#36825;&#37324;&#26377;&#19968;&#20010;&#40481;&#29983;&#34507;&#34507;&#29983;&#40481;&#30340;&#38382;&#39064; ,&#30001;&#20110;&#35201;&#24819;&#20102;&#35299;&#26032;&#22686;&#21015;&#30340;SQL&#35821;&#21477;&#65292;&#20320;&#38656;&#35201;&#20351;&#29992;Django&#30340;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;sqlall&lt;/span&gt;&lt;/tt&gt;&#21629;&#20196;&#36827;&#34892;&#26597;&#30475; ,&#32780;&#36825;&#21448;&#38656;&#35201;&#23383;&#27573;&#24050;&#32463;&#22312;&#27169;&#22411;&#37324;&#23384;&#22312;&#20102;&#12290; (&#27880;&#24847;:&#20320;&#24182; &lt;em&gt;&#19981;&#26159;&#38750;&#24471;&#20351;&#29992;&lt;/em&gt;&#19982;Django&#30456;&#21516;&#30340;SQL&#35821;&#21477;&#21019;&#24314;&#26032;&#30340;&#23383;&#27573;&#65292;&#20294;&#26159;&#36825;&#26679;&#20570;&#30830;&#23454;&#26159;&#19968;&#20010;&#22909;&#20027;&#24847; ,&#23427;&#33021;&#35753;&#19968;&#20999;&#37117;&#20445;&#25345;&#21516;&#27493;&#12290;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&#36825;&#20010;&#40481;-&#34507;&#30340;&#38382;&#39064;&#30340;&#35299;&#20915;&#26041;&#27861;&#26159;&#22312;&#24320;&#21457;&#32773;&#29615;&#22659;&#37324;&#32780;&#19981;&#26159;&#21457;&#24067;&#29615;&#22659;&#37324;&#23454;&#29616;&#36825;&#20010;&#21464;&#21270;&#12290; (&#20320;&lt;em&gt;&#27491;&lt;/em&gt;&#20351;&#29992;&#30340;&#26159;&#27979;&#35797;/&#24320;&#21457;&#29615;&#22659;&#65292;&#23545;&#21543;?)&#19979;&#38754;&#26159;&#20855;&#20307;&#30340;&#23454;&#26045;&#27493;&#39588;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn40&quot;&gt;&#39318;&#20808;&#65292;&#36827;&#20837;&#24320;&#21457;&#29615;&#22659;(&#20063;&#23601;&#26159;&#35828;&#65292;&#19981;&#26159;&#22312;&#21457;&#24067;&#29615;&#22659;&#37324;)&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn41&quot;&gt;&#22312;&#20320;&#30340;&#27169;&#22411;&#37324;&#28155;&#21152;&#23383;&#27573;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn42&quot;&gt;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;sqlall&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;[yourapp]&lt;/span&gt;&lt;/tt&gt; &#26469;&#27979;&#35797;&#27169;&#22411;&#26032;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#12290; &#27880;&#24847;&#20026;&#26032;&#23383;&#27573;&#30340;&#21015;&#23450;&#20041;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn43&quot;&gt;&#24320;&#21551;&#20320;&#30340;&#25968;&#25454;&#24211;&#30340;&#20132;&#20114;&#21629;&#20196;&#30028;&#38754;(&#27604;&#22914;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;psql&lt;/span&gt;&lt;/tt&gt; &#25110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysql&lt;/span&gt;&lt;/tt&gt; , &#25110;&#32773;&#21487;&#20197;&#20351;&#29992;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;dbshell&lt;/span&gt;&lt;/tt&gt; )&#12290; &#25191;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ALTER&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#26469;&#28155;&#21152;&#26032;&#21015;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;4&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn44&quot;&gt;&#20351;&#29992;Python&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;shell&lt;/span&gt;&lt;/tt&gt;&#65292;&#36890;&#36807;&#23548;&#20837;&#27169;&#22411;&#21644;&#36873;&#20013;&#34920;&#21333;(&#20363;&#22914;&#65292;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MyModel.objects.all()[:5]&lt;/span&gt;&lt;/tt&gt; )&#26469;&#39564;&#35777;&#26032;&#30340;&#23383;&#27573;&#26159;&#21542;&#34987;&#27491;&#30830;&#30340;&#28155;&#21152; ,&#22914;&#26524;&#19968;&#20999;&#39034;&#21033;,&#25152;&#26377;&#30340;&#35821;&#21477;&#37117;&#19981;&#20250;&#25253;&#38169;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#28982;&#21518;&#22312;&#20320;&#30340;&#20135;&#21697;&#26381;&#21153;&#22120;&#19978;&#20877;&#23454;&#26045;&#19968;&#36941;&#36825;&#20123;&#27493;&#39588;&#12290;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn46&quot;&gt;&#21551;&#21160;&#25968;&#25454;&#24211;&#30340;&#20132;&#20114;&#30028;&#38754;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn47&quot;&gt;&#25191;&#34892;&#22312;&#24320;&#21457;&#29615;&#22659;&#27493;&#39588;&#20013;&#65292;&#31532;&#19977;&#27493;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ALTER&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt;&#35821;&#21477;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn48&quot;&gt;&#23558;&#26032;&#30340;&#23383;&#27573;&#21152;&#20837;&#21040;&#27169;&#22411;&#20013;&#12290; &#22914;&#26524;&#20320;&#20351;&#29992;&#20102;&#26576;&#31181;&#29256;&#26412;&#25511;&#21046;&#24037;&#20855;&#65292;&#24182;&#19988;&#22312;&#31532;&#19968;&#27493;&#20013;&#65292;&#24050;&#32463;&#25552;&#20132;&#20102;&#20320;&#22312;&#24320;&#21457;&#29615;&#22659;&#19978;&#30340;&#20462;&#25913;&#65292;&#29616;&#22312;&#65292;&#21487;&#20197;&#22312;&#29983;&#20135;&#29615;&#22659;&#20013;&#26356;&#26032;&#20320;&#30340;&#20195;&#30721;&#20102;&#65288;&#20363;&#22914;&#65292;&#22914;&#26524;&#20320;&#20351;&#29992;Subversion&#65292;&#25191;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;svn&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;update&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;4&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn49&quot;&gt;&#37325;&#26032;&#21551;&#21160;Web server&#65292;&#20351;&#20462;&#25913;&#29983;&#25928;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#35753;&#25105;&#20204;&#23454;&#36341;&#19979;&#65292;&#27604;&#22914;&#28155;&#21152;&#19968;&#20010;num_pages&#23383;&#27573;&#21040;&#31532;&#20116;&#31456;&#20013;Book&#27169;&#22411;&#12290;&#39318;&#20808;&#65292;&#25105;&#20204;&#20250;&#25226;&#24320;&#21457;&#29615;&#22659;&#20013;&#30340;&#27169;&#22411;&#25913;&#25104;&#22914;&#19979;&#24418;&#24335;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn52&quot;&gt;class Book(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publication_date = models.DateField()
    **num_pages = models.IntegerField(blank=True, null=True)**

    def __unicode__(self):
        return self.title
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;(&#27880;&#24847; &#38405;&#35835;&#31532;&#20845;&#31456;&#30340;&#8220;&#35774;&#32622;&#21487;&#36873;&#23383;&#27573;&#8221;&#20197;&#21450;&#26412;&#31456;&#19979;&#38754;&#30340;&#8220;&#28155;&#21152;&#38750;&#31354;&#21015;&#8221;&#23567;&#33410;&#20197;&#20102;&#35299;&#25105;&#20204;&#22312;&#36825;&#37324;&#28155;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blank=True&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;null=True&lt;/span&gt;&lt;/tt&gt;&#30340;&#21407;&#22240;&#12290;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&#28982;&#21518;&#65292;&#25105;&#20204;&#36816;&#34892;&#21629;&#20196;manage.py sqlall books &#26469;&#26597;&#30475;CREATE TABLE&#35821;&#21477;&#12290;
&#35821;&#21477;&#30340;&#20855;&#20307;&#20869;&#23481;&#21462;&#20915;&#19982;&#20320;&#25152;&#20351;&#29992;&#30340;&#25968;&#25454;&#24211;&#65292; &#22823;&#27010;&#26159;&#36825;&#20010;&#26679;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn56&quot;&gt;CREATE TABLE &quot;books_book&quot; (
    &quot;id&quot; serial NOT NULL PRIMARY KEY,
    &quot;title&quot; varchar(100) NOT NULL,
    &quot;publisher_id&quot; integer NOT NULL REFERENCES &quot;books_publisher&quot; (&quot;id&quot;),
    &quot;publication_date&quot; date NOT NULL,
    &quot;num_pages&quot; integer NULL
);
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#26032;&#21152;&#30340;&#23383;&#27573;&#34987;&#36825;&#26679;&#34920;&#31034;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn59&quot;&gt;&quot;num_pages&quot; integer NULL
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#25105;&#20204;&#35201;&#22312;&#24320;&#21457;&#29615;&#22659;&#19978;&#36816;&#34892;&#25968;&#25454;&#24211;&#23458;&#25143;&#31471;&#65292;&#22914;&#26524;&#26159;PostgreSQL&#65292;&#36816;&#34892; psql,&#65292;&#28982;&#21518;&#65292;&#25105;&#25191;&#34892;&#22914;&#19979;&#35821;&#21477;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn62&quot;&gt;ALTER TABLE books_book ADD COLUMN num_pages integer;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#28155;&#21152; &#38750;NULL &#23383;&#27573;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#36825;&#37324;&#26377;&#20010;&#24494;&#22937;&#20043;&#22788;&#20540;&#24471;&#19968;&#25552;&#12290; &#22312;&#25105;&#20204;&#28155;&#21152;&#23383;&#27573;num_pages&#30340;&#26102;&#20505;&#65292;&#25105;&#20204;&#20351;&#29992;&#20102; blank=True &#21644; null=True &#36873;&#39033;&#12290; &#36825;&#26159;&#22240;&#20026;&#22312;&#25105;&#20204;&#31532;&#19968;&#27425;&#21019;&#24314;&#23427;&#30340;&#26102;&#20505;&#65292;&#36825;&#20010;&#25968;&#25454;&#24211;&#23383;&#27573;&#20250;&#21547;&#26377;&#31354;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#28982;&#32780;&#65292;&#24819;&#35201;&#28155;&#21152;&#19981;&#33021;&#21547;&#26377;&#31354;&#20540;&#30340;&#23383;&#27573;&#20063;&#26159;&#21487;&#20197;&#30340;&#12290; &#35201;&#24819;&#23454;&#29616;&#36825;&#26679;&#30340;&#25928;&#26524;&#65292;&#20320;&#24517;&#39035;&#20808;&#21019;&#24314; NULL &#22411;&#30340;&#23383;&#27573;&#65292;&#28982;&#21518;&#23558;&#35813;&#23383;&#27573;&#30340;&#20540;&#22635;&#20805;&#20026;&#26576;&#20010;&#40664;&#35748;&#20540;&#65292;&#28982;&#21518;&#20877;&#23558;&#35813;&#23383;&#27573;&#25913;&#20026; NOT NULL &#22411;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn67&quot;&gt;BEGIN;
ALTER TABLE books_book ADD COLUMN num_pages integer;
UPDATE books_book SET num_pages=0;
ALTER TABLE books_book ALTER COLUMN num_pages SET NOT NULL;
COMMIT;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#22914;&#26524;&#20320;&#36825;&#26679;&#20570;&#65292;&#35760;&#24471;&#20320;&#19981;&#35201;&#22312;&#27169;&#22411;&#20013;&#28155;&#21152; blank=True &#21644; null=True &#36873;&#39033;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#25191;&#34892;ALTER TABLE&#20043;&#21518;&#65292;&#25105;&#20204;&#35201;&#39564;&#35777;&#19968;&#19979;&#20462;&#25913;&#32467;&#26524;&#26159;&#21542;&#27491;&#30830;&#12290;&#21551;&#21160;python&#24182;&#25191;&#34892;&#19979;&#38754;&#30340;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn71&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from mysite.books.models import Book
&amp;gt;&amp;gt;&amp;gt; Book.objects.all()[:5]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&#22914;&#26524;&#27809;&#26377;&#24322;&#24120;&#21457;&#29983;&#65292;&#25105;&#20204;&#23558;&#20999;&#25442;&#21040;&#29983;&#20135;&#26381;&#21153;&#22120;&#65292;&#28982;&#21518;&#22312;&#29983;&#20135;&#29615;&#22659;&#30340;&#25968;&#25454;&#24211;&#20013;&#25191;&#34892;&#21629;&#20196;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ALTER&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;TABLE&lt;/span&gt;&lt;/tt&gt; &#28982;&#21518;&#25105;&#20204;&#26356;&#26032;&#29983;&#20135;&#29615;&#22659;&#20013;&#30340;&#27169;&#22411;&#65292;&#26368;&#21518;&#37325;&#21551;web&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn73&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&#21024;&#38500;&#23383;&#27573;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#20174;Model&#20013;&#21024;&#38500;&#19968;&#20010;&#23383;&#27573;&#35201;&#27604;&#28155;&#21152;&#23481;&#26131;&#24471;&#22810;&#12290; &#21024;&#38500;&#23383;&#27573;&#65292;&#20165;&#20165;&#21482;&#35201;&#20197;&#19979;&#20960;&#20010;&#27493;&#39588;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#21024;&#38500;&#23383;&#27573;&#65292;&#28982;&#21518;&#37325;&#26032;&#21551;&#21160;&#20320;&#30340;web&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#29992;&#20197;&#19979;&#21629;&#20196;&#20174;&#25968;&#25454;&#24211;&#20013;&#21024;&#38500;&#23383;&#27573;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn78&quot;&gt;ALTER TABLE books_book DROP COLUMN num_pages;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&#35831;&#20445;&#35777;&#25805;&#20316;&#30340;&#39034;&#24207;&#27491;&#30830;&#12290; &#22914;&#26524;&#20320;&#20808;&#20174;&#25968;&#25454;&#24211;&#20013;&#21024;&#38500;&#23383;&#27573;&#65292;Django&#23558;&#20250;&#31435;&#21363;&#25243;&#20986;&#24322;&#24120;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn80&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#21024;&#38500;&#22810;&#23545;&#22810;&#20851;&#32852;&#23383;&#27573;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#30001;&#20110;&#22810;&#23545;&#22810;&#20851;&#32852;&#23383;&#27573;&#19981;&#21516;&#20110;&#26222;&#36890;&#23383;&#27573;&#65292;&#25152;&#20197;&#21024;&#38500;&#25805;&#20316;&#26159;&#19981;&#21516;&#30340;&#12290;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&#20174;&#20320;&#30340;&#27169;&#22411;&#20013;&#21024;&#38500;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ManyToManyField&lt;/span&gt;&lt;/tt&gt;&#65292;&#28982;&#21518;&#37325;&#21551;web&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#29992;&#19979;&#38754;&#30340;&#21629;&#20196;&#20174;&#25968;&#25454;&#24211;&#21024;&#38500;&#20851;&#32852;&#34920;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn85&quot;&gt;DROP TABLE books_book_authors;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#20687;&#19978;&#38754;&#19968;&#26679;&#65292;&#27880;&#24847;&#25805;&#20316;&#30340;&#39034;&#24207;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn87&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#21024;&#38500;&#27169;&#22411;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#21024;&#38500;&#25972;&#20010;&#27169;&#22411;&#35201;&#27604;&#21024;&#38500;&#19968;&#20010;&#23383;&#27573;&#23481;&#26131;&#12290; &#21024;&#38500;&#19968;&#20010;&#27169;&#22411;&#21482;&#35201;&#20197;&#19979;&#20960;&#20010;&#27493;&#39588;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#20174;&#25991;&#20214;&#20013;&#21024;&#38500;&#20320;&#24819;&#35201;&#21024;&#38500;&#30340;&#27169;&#22411;&#65292;&#28982;&#21518;&#37325;&#21551;web &#26381;&#21153;&#22120;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;models.py&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn90&quot;&gt;&#28982;&#21518;&#29992;&#20197;&#19979;&#21629;&#20196;&#20174;&#25968;&#25454;&#24211;&#20013;&#21024;&#38500;&#34920;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn92&quot;&gt;DROP TABLE books_book;
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&#24403;&#20320;&#38656;&#35201;&#20174;&#25968;&#25454;&#24211;&#20013;&#21024;&#38500;&#20219;&#20309;&#26377;&#20381;&#36182;&#30340;&#34920;&#26102;&#35201;&#27880;&#24847;&#65288;&#20063;&#23601;&#26159;&#20219;&#20309;&#19982;&#34920;books_book&#26377;&#22806;&#38190;&#30340;&#34920; &#65289;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&#27491;&#22914;&#22312;&#21069;&#38754;&#37096;&#20998;&#65292;&#19968;&#23450;&#35201;&#25353;&#36825;&#26679;&#30340;&#39034;&#24207;&#20570;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;managers&quot;&gt;
&lt;span id=&quot;cn95&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn95&quot;&gt;Managers&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#22312;&#35821;&#21477;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book.objects.all()&lt;/span&gt;&lt;/tt&gt;&#20013;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;objects&lt;/span&gt;&lt;/tt&gt;&#26159;&#19968;&#20010;&#29305;&#27530;&#30340;&#23646;&#24615;&#65292;&#38656;&#35201;&#36890;&#36807;&#23427;&#26597;&#35810;&#25968;&#25454;&#24211;&#12290; &#22312;&#31532;5&#31456;&#65292;&#25105;&#20204;&#21482;&#26159;&#31616;&#35201;&#22320;&#35828;&#36825;&#26159;&#27169;&#22359;&#30340;manager &#12290;&#29616;&#22312;&#26159;&#26102;&#20505;&#28145;&#20837;&#20102;&#35299;managers&#26159;&#20160;&#20040;&#21644;&#22914;&#20309;&#20351;&#29992;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#24635;&#20043;&#65292;&#27169;&#22359;manager&#26159;&#19968;&#20010;&#23545;&#35937;&#65292;Django&#27169;&#22359;&#36890;&#36807;&#23427;&#36827;&#34892;&#25968;&#25454;&#24211;&#26597;&#35810;&#12290; &#27599;&#20010;Django&#27169;&#22359;&#33267;&#23569;&#26377;&#19968;&#20010;manager&#65292;&#20320;&#21487;&#20197;&#21019;&#24314;&#33258;&#23450;&#20041;manager&#20197;&#23450;&#21046;&#25968;&#25454;&#24211;&#35775;&#38382;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#19979;&#38754;&#26159;&#20320;&#21019;&#24314;&#33258;&#23450;&#20041;manager&#30340;&#20004;&#20010;&#21407;&#22240;&#65306; &#22686;&#21152;&#39069;&#22806;&#30340;manager&#26041;&#27861;&#65292;&#21644;/&#25110;&#20462;manager&#36820;&#22238;&#30340;&#21021;&#22987;QuerySet&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;manager&quot;&gt;
&lt;span id=&quot;cn99&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#22686;&#21152;&#39069;&#22806;&#30340;Manager&#26041;&#27861;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#22686;&#21152;&#39069;&#22806;&#30340;manager&#26041;&#27861;&#26159;&#20026;&#27169;&#22359;&#28155;&#21152;&#34920;&#32423;&#21151;&#33021;&#30340;&#39318;&#36873;&#21150;&#27861;&#12290; &#65288;&#33267;&#20110;&#34892;&#32423;&#21151;&#33021;&#65292;&#20063;&#23601;&#26159;&#21482;&#20316;&#29992;&#20110;&#27169;&#22411;&#23545;&#35937;&#23454;&#20363;&#30340;&#20989;&#25968;&#65292;&#19968;&#20250;&#20799;&#23558;&#22312;&#26412;&#31456;&#21518;&#38754;&#35299;&#37322;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&#20363;&#22914;,&#25105;&#20204;&#20026;Book&#27169;&#22411;&#23450;&#20041;&#20102;&#19968;&#20010;title_count()&#26041;&#27861;&#65292;&#23427;&#38656;&#35201;&#19968;&#20010;&#20851;&#38190;&#23383;&#65292;&#36820;&#22238;&#21253;&#21547;&#36825;&#20010;&#20851;&#38190;&#23383;&#30340;&#20070;&#30340;&#25968;&#37327;&#12290; &#65288;&#36825;&#20010;&#20363;&#23376;&#26377;&#28857;&#29301;&#24378;&#65292;&#19981;&#36807;&#23427;&#21487;&#20197;&#35828;&#26126;managers&#22914;&#20309;&#24037;&#20316;&#12290;&#65289;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn103&quot;&gt;# models.py

from django.db import models

# ... Author and Publisher models here ...

**class BookManager(models.Manager):**
    **def title_count(self, keyword):**
        **return self.filter(title__icontains=keyword).count()**

class Book(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publication_date = models.DateField()
    num_pages = models.IntegerField(blank=True, null=True)
    **objects = BookManager()**

    def __unicode__(self):
        return self.title
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&#26377;&#20102;&#36825;&#20010;manager&#65292;&#25105;&#20204;&#29616;&#22312;&#21487;&#20197;&#36825;&#26679;&#20570;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn106&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Book.objects.title_count(&apos;django&apos;)
4
&amp;gt;&amp;gt;&amp;gt; Book.objects.title_count(&apos;python&apos;)
18
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#19979;&#38754;&#26159;&#32534;&#30721;&#35813;&#27880;&#24847;&#30340;&#19968;&#20123;&#22320;&#26041;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn108&quot;&gt;&#25105;&#20204;&#24314;&#31435;&#20102;&#19968;&#20010;BookManager&#31867;&#65292;&#23427;&#32487;&#25215;&#20102;django.db.models.Manager&#12290;&#36825;&#20010;&#31867;&#21482;&#26377;&#19968;&#20010;title_count()&#26041;&#27861;&#65292;&#29992;&#26469;&#20570;&#32479;&#35745;&#12290; &#27880;&#24847;&#65292;&#36825;&#20010;&#26041;&#27861;&#20351;&#29992;&#20102;self.filter()&#65292;&#27492;&#22788;self&#25351;manager&#26412;&#36523;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn109&quot;&gt;&#25105;&#20204;&#25226;BookManager()&#36171;&#20540;&#32473;&#27169;&#22411;&#30340;objects&#23646;&#24615;&#12290; &#23427;&#23558;&#21462;&#20195;&#27169;&#22411;&#30340;&#40664;&#35748;manager&#65288;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;objects&lt;/span&gt;&lt;/tt&gt;&#65289;&#22914;&#26524;&#25105;&#20204;&#27809;&#26377;&#29305;&#21035;&#23450;&#20041;&#65292;&#23427;&#23558;&#20250;&#34987;&#33258;&#21160;&#21019;&#24314;&#12290; &#25105;&#20204;&#25226;&#23427;&#21629;&#21517;&#20026;objects&#65292;&#36825;&#26159;&#20026;&#20102;&#19982;&#33258;&#21160;&#21019;&#24314;&#30340;manager&#20445;&#25345;&#19968;&#33268;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&#20026;&#20160;&#20040;&#25105;&#20204;&#35201;&#28155;&#21152;&#19968;&#20010;title_count()&#26041;&#27861;&#21602;?&#26159;&#20026;&#20102;&#23558;&#32463;&#24120;&#20351;&#29992;&#30340;&#26597;&#35810;&#36827;&#34892;&#23553;&#35013;&#65292;&#36825;&#26679;&#25105;&#20204;&#23601;&#19981;&#24517;&#37325;&#22797;&#32534;&#30721;&#20102;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;manager-querysets&quot;&gt;
&lt;span id=&quot;cn111&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&#20462;&#25913;&#21021;&#22987;Manager QuerySets&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn112&quot;&gt;manager&#30340;&#22522;&#26412;QuerySet&#36820;&#22238;&#31995;&#32479;&#20013;&#30340;&#25152;&#26377;&#23545;&#35937;&#12290; &#20363;&#22914;,`` Book.objects.all()`` &#36820;&#22238;&#25968;&#25454;&#24211;book&#20013;&#30340;&#25152;&#26377;&#20070;&#26412;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#36890;&#36807;&#35206;&#30422;Manager.get_query_set()&#26041;&#27861;&#26469;&#37325;&#20889;manager&#30340;&#22522;&#26412;QuerySet&#12290; get_query_set()&#25353;&#29031;&#20320;&#30340;&#35201;&#27714;&#36820;&#22238;&#19968;&#20010;QuerySet&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#20363;&#22914;,&#19979;&#38754;&#30340;&#27169;&#22411;&#26377;* &#20004;&#20010;* manager&#12290;&#19968;&#20010;&#36820;&#22238;&#25152;&#26377;&#23545;&#20687;&#65292;&#21478;&#19968;&#20010;&#21482;&#36820;&#22238;&#20316;&#32773;&#26159;Roald Dahl&#30340;&#20070;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn116&quot;&gt;from django.db import models

**# First, define the Manager subclass.**
**class DahlBookManager(models.Manager):**
    **def get_query_set(self):**
        **return super(DahlBookManager, self).get_query_set().filter(author=&apos;Roald Dahl&apos;)**

**# Then hook it into the Book model explicitly.**
class Book(models.Model):
    title = models.CharField(max_length=100)
    author = models.CharField(max_length=50)
    # ...

    **objects = models.Manager() # The default manager.**
    **dahl_objects = DahlBookManager() # The Dahl-specific manager.**
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&#22312;&#36825;&#20010;&#31034;&#20363;&#27169;&#22411;&#20013;,Book.objects.all()&#36820;&#22238;&#20102;&#25968;&#25454;&#24211;&#20013;&#30340;&#25152;&#26377;&#20070;&#26412;,&#32780;Book.dahl_objects.all()&#21482;&#36820;&#22238;&#20102;&#19968;&#26412;. &#27880;&#24847;&#25105;&#20204;&#26126;&#30830;&#22320;&#23558;objects&#35774;&#32622;&#25104;manager&#30340;&#23454;&#20363;&#65292;&#22240;&#20026;&#22914;&#26524;&#25105;&#20204;&#19981;&#36825;&#20040;&#20570;&#65292;&#37027;&#20040;&#21807;&#19968;&#21487;&#29992;&#30340;manager&#23601;&#23558;&#26159;dah1_objects&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&#24403;&#28982;,&#30001;&#20110;get_query_set()&#36820;&#22238;&#30340;&#26159;&#19968;&#20010;QuerySet&#23545;&#35937;&#65292;&#25152;&#20197;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992;filter()&#65292;exclude()&#21644;&#20854;&#20182;&#19968;&#20999;QuerySet&#30340;&#26041;&#27861;&#12290; &#20687;&#36825;&#20123;&#35821;&#27861;&#37117;&#26159;&#27491;&#30830;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn120&quot;&gt;Book.dahl_objects.all()
Book.dahl_objects.filter(title=&apos;Matilda&apos;)
Book.dahl_objects.count()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn121&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#20063;&#25351;&#20986;&#20102;&#20854;&#20182;&#26377;&#36259;&#30340;&#25216;&#26415;&#65306; &#22312;&#21516;&#19968;&#20010;&#27169;&#22411;&#20013;&#20351;&#29992;&#22810;&#20010;manager&#12290; &#21482;&#35201;&#20320;&#24895;&#24847;&#65292;&#20320;&#21487;&#20197;&#20026;&#20320;&#30340;&#27169;&#22411;&#28155;&#21152;&#22810;&#20010;manager()&#23454;&#20363;&#12290; &#36825;&#26159;&#19968;&#20010;&#20026;&#27169;&#22411;&#28155;&#21152;&#36890;&#29992;&#28388;&#22120;&#30340;&#31616;&#21333;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn122&quot;&gt;&#20363;&#22914;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn124&quot;&gt;class MaleManager(models.Manager):
    def get_query_set(self):
        return super(MaleManager, self).get_query_set().filter(sex=&apos;M&apos;)

class FemaleManager(models.Manager):
    def get_query_set(self):
        return super(FemaleManager, self).get_query_set().filter(sex=&apos;F&apos;)

class Person(models.Model):
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    sex = models.CharField(max_length=1, choices=((&apos;M&apos;, &apos;Male&apos;), (&apos;F&apos;, &apos;Female&apos;)))
    people = models.Manager()
    men = MaleManager()
    women = FemaleManager()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#20801;&#35768;&#20320;&#25191;&#34892;`` Person.men.all()`` &#65292;`` Person.women.all()`` &#65292;`` Person.people.all()`` &#26597;&#35810;&#65292;&#29983;&#25104;&#20320;&#24819;&#35201;&#30340;&#32467;&#26524;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn126&quot;&gt;&#22914;&#26524;&#20320;&#20351;&#29992;&#33258;&#23450;&#20041;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Manager&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#65292;&#35831;&#27880;&#24847;&#65292;Django&#36935;&#21040;&#30340;&#31532;&#19968;&#20010;Manager(&#20197;&#23427;&#22312;&#27169;&#22411;&#20013;&#34987;&#23450;&#20041;&#30340;&#20301;&#32622;&#20026;&#20934;)&#20250;&#26377;&#19968;&#20010;&#29305;&#27530;&#29366;&#24577;&#12290; Django&#23558;&#20250;&#25226;&#31532;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Manager&lt;/span&gt;&lt;/tt&gt; &#23450;&#20041;&#20026;&#40664;&#35748;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Manager&lt;/span&gt;&lt;/tt&gt; &#65292;Django&#30340;&#35768;&#22810;&#37096;&#20998;(&#20294;&#26159;&#19981;&#21253;&#25324;admin&#24212;&#29992;)&#23558;&#20250;&#26126;&#30830;&#22320;&#20026;&#27169;&#22411;&#20351;&#29992;&#36825;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manager&lt;/span&gt;&lt;/tt&gt;&#12290; &#32467;&#35770;&#26159;&#65292;&#20320;&#24212;&#35813;&#23567;&#24515;&#22320;&#36873;&#25321;&#20320;&#30340;&#40664;&#35748;manager&#12290;&#22240;&#20026;&#35206;&#30422;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_query_set()&lt;/span&gt;&lt;/tt&gt; &#20102;&#65292;&#20320;&#21487;&#33021;&#25509;&#21463;&#21040;&#19968;&#20010;&#26080;&#29992;&#30340;&#36820;&#22238;&#23545;&#20687;&#65292;&#20320;&#24517;&#39035;&#36991;&#20813;&#36825;&#31181;&#24773;&#20917;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn127&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&#27169;&#22411;&#26041;&#27861;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#20026;&#20102;&#32473;&#20320;&#30340;&#23545;&#20687;&#28155;&#21152;&#19968;&#20010;&#34892;&#32423;&#21151;&#33021;&#65292;&#37027;&#23601;&#23450;&#20041;&#19968;&#20010;&#33258;&#23450;&#20041;&#26041;&#27861;&#12290;
&#26377;&#37492;&#20110;manager&#32463;&#24120;&#34987;&#29992;&#26469;&#29992;&#19968;&#20123;&#25972;&#34920;&#25805;&#20316;&#65288;table-wide&#65289;&#65292;&#27169;&#22411;&#26041;&#27861;&#24212;&#35813;&#21482;&#23545;&#29305;&#27530;&#27169;&#22411;&#23454;&#20363;&#36215;&#20316;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#36825;&#26159;&#19968;&#39033;&#22312;&#27169;&#22411;&#30340;&#19968;&#20010;&#22320;&#26041;&#38598;&#20013;&#19994;&#21153;&#36923;&#36753;&#30340;&#25216;&#26415;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#26368;&#22909;&#29992;&#20363;&#23376;&#26469;&#35299;&#37322;&#19968;&#19979;&#12290; &#36825;&#20010;&#27169;&#22411;&#26377;&#19968;&#20123;&#33258;&#23450;&#20041;&#26041;&#27861;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn132&quot;&gt;from django.contrib.localflavor.us.models import USStateField
from django.db import models

class Person(models.Model):
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    birth_date = models.DateField()
    address = models.CharField(max_length=100)
    city = models.CharField(max_length=50)
    state = USStateField() # Yes, this is U.S.-centric...

    def baby_boomer_status(self):
        &quot;Returns the person&apos;s baby-boomer status.&quot;
        import datetime
        if datetime.date(1945, 8, 1) &amp;lt;= self.birth_date &amp;lt;= datetime.date(1964, 12, 31):
            return &quot;Baby boomer&quot;
        if self.birth_date &amp;lt; datetime.date(1945, 8, 1):
            return &quot;Pre-boomer&quot;
        return &quot;Post-boomer&quot;

    def is_midwestern(self):
        &quot;Returns True if this person is from the Midwest.&quot;
        return self.state in (&apos;IL&apos;, &apos;WI&apos;, &apos;MI&apos;, &apos;IN&apos;, &apos;OH&apos;, &apos;IA&apos;, &apos;MO&apos;)

    def _get_full_name(self):
        &quot;Returns the person&apos;s full name.&quot;
        return u&apos;%s %s&apos; % (self.first_name, self.last_name)
    full_name = property(_get_full_name)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#20363;&#23376;&#20013;&#30340;&#26368;&#21518;&#19968;&#20010;&#26041;&#27861;&#26159;&#19968;&#20010;property&#12290; &#24819;&#20102;&#35299;&#26356;&#22810;&#20851;&#20110;&#23646;&#24615;&#30340;&#20449;&#24687;&#35831;&#35775;&#38382;&lt;a class=&quot;reference external&quot; href=&quot;http://www.python.org/download/releases/2.2/descrintro/#property&quot;&gt;http://www.python.org/download/releases/2.2/descrintro/#property&lt;/a&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn134&quot;&gt;&#36825;&#26159;&#29992;&#27861;&#30340;&#23454;&#20363;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn136&quot;&gt;&amp;gt;&amp;gt;&amp;gt; p = Person.objects.get(first_name=&apos;Barack&apos;, last_name=&apos;Obama&apos;)
&amp;gt;&amp;gt;&amp;gt; p.birth_date
datetime.date(1961, 8, 4)
&amp;gt;&amp;gt;&amp;gt; p.baby_boomer_status()
&apos;Baby boomer&apos;
&amp;gt;&amp;gt;&amp;gt; p.is_midwestern()
True
&amp;gt;&amp;gt;&amp;gt; p.full_name  # Note this isn&apos;t a method -- it&apos;s treated as an attribute
u&apos;Barack Obama&apos;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;sql&quot;&gt;
&lt;span id=&quot;cn137&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn137&quot;&gt;&#25191;&#34892;&#21407;&#22987;SQL&#26597;&#35810;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#26377;&#26102;&#20505;&#20320;&#20250;&#21457;&#29616;Django&#25968;&#25454;&#24211;API&#24102;&#32473;&#20320;&#30340;&#20063;&#21482;&#26377;&#36825;&#20040;&#22810;&#65292;&#37027;&#20320;&#21487;&#20197;&#20026;&#20320;&#30340;&#25968;&#25454;&#24211;&#20889;&#19968;&#20123;&#33258;&#23450;&#20041;SQL&#26597;&#35810;&#12290; &#20320;&#21487;&#20197;&#36890;&#36807;&#23548;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.db.connection&lt;/span&gt;&lt;/tt&gt;&#23545;&#20687;&#26469;&#36731;&#26494;&#23454;&#29616;&#65292;&#23427;&#20195;&#34920;&#24403;&#21069;&#25968;&#25454;&#24211;&#36830;&#25509;&#12290; &#35201;&#20351;&#29992;&#23427;&#65292;&#38656;&#35201;&#36890;&#36807;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;connection.cursor()&lt;/span&gt;&lt;/tt&gt;&#24471;&#21040;&#19968;&#20010;&#28216;&#26631;&#23545;&#20687;&#12290; &#28982;&#21518;&#65292;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cursor.execute(sql,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;[params])&lt;/span&gt;&lt;/tt&gt;&#26469;&#25191;&#34892;SQL&#35821;&#21477;&#65292;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cursor.fetchone()&lt;/span&gt;&lt;/tt&gt;&#25110;&#32773;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cursor.fetchall()&lt;/span&gt;&lt;/tt&gt;&#26469;&#36820;&#22238;&#35760;&#24405;&#38598;&#12290; &#20363;&#22914;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn140&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.db import connection
&amp;gt;&amp;gt;&amp;gt; cursor = connection.cursor()
&amp;gt;&amp;gt;&amp;gt; cursor.execute(&quot;&quot;&quot;
...    SELECT DISTINCT first_name
...    FROM people_person
...    WHERE last_name = %s&quot;&quot;&quot;, [&apos;Lennon&apos;])
&amp;gt;&amp;gt;&amp;gt; row = cursor.fetchone()
&amp;gt;&amp;gt;&amp;gt; print row
[&apos;John&apos;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn141&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;connection&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cursor&lt;/span&gt;&lt;/tt&gt;&#20960;&#20046;&#23454;&#29616;&#20102;&#26631;&#20934;Python DB-API&#65292;&#20320;&#21487;&#20197;&#35775;&#38382;` &lt;a class=&quot;reference external&quot; href=&quot;http://www.python.org/peps/pep-0249.html&quot;&gt;http://www.python.org/peps/pep-0249.html&lt;/a&gt; &amp;lt;&lt;a class=&quot;reference external&quot; href=&quot;http://www.python.org/peps/pep-0249.html&quot;&gt;http://www.python.org/peps/pep-0249.html&lt;/a&gt;&amp;gt;`__&#26469;&#33719;&#21462;&#26356;&#22810;&#20449;&#24687;&#12290; &#22914;&#26524;&#20320;&#23545;Python DB-API&#19981;&#29087;&#24713;&#65292;&#35831;&#27880;&#24847;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cursor.execute()&lt;/span&gt;&lt;/tt&gt; &#30340;SQL&#35821;&#21477;&#20013;&#20351;&#29992;`` &#8220;%s&#8221;`` &#65292;&#32780;&#19981;&#35201;&#22312;SQL&#20869;&#30452;&#25509;&#28155;&#21152;&#21442;&#25968;&#12290; &#22914;&#26524;&#20320;&#20351;&#29992;&#36825;&#39033;&#25216;&#26415;&#65292;&#25968;&#25454;&#24211;&#22522;&#30784;&#24211;&#23558;&#20250;&#33258;&#21160;&#28155;&#21152;&#24341;&#21495;&#65292;&#21516;&#26102;&#22312;&#24517;&#35201;&#30340;&#24773;&#20917;&#19979;&#36716;&#24847;&#20320;&#30340;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#19981;&#35201;&#25226;&#20320;&#30340;&#35270;&#22270;&#20195;&#30721;&#21644;django.db.connection&#35821;&#21477;&#28151;&#26434;&#22312;&#19968;&#36215;&#65292;&#25226;&#23427;&#20204;&#25918;&#22312;&#33258;&#23450;&#20041;&#27169;&#22411;&#25110;&#32773;&#33258;&#23450;&#20041;manager&#26041;&#27861;&#20013;&#26159;&#20010;&#19981;&#38169;&#30340;&#20027;&#24847;&#12290; &#27604;&#22914;&#65292;&#19978;&#38754;&#30340;&#20363;&#23376;&#21487;&#20197;&#34987;&#25972;&#21512;&#25104;&#19968;&#20010;&#33258;&#23450;&#20041;manager&#26041;&#27861;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn144&quot;&gt;from django.db import connection, models

class PersonManager(models.Manager):
    def first_names(self, last_name):
        cursor = connection.cursor()
        cursor.execute(&quot;&quot;&quot;
            SELECT DISTINCT first_name
            FROM people_person
            WHERE last_name = %s&quot;&quot;&quot;, [last_name])
        return [row[0] for row in cursor.fetchone()]

class Person(models.Model):
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    objects = PersonManager()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn145&quot;&gt;&#28982;&#21518;&#36825;&#26679;&#20351;&#29992;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn147&quot;&gt;&amp;gt;&amp;gt;&amp;gt; Person.objects.first_names(&apos;Lennon&apos;)
[&apos;John&apos;, &apos;Cynthia&apos;]
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn148&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn148&quot;&gt;&#25509;&#19979;&#26469;&#20570;&#20160;&#20040;&#65311;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&#22312;&lt;a class=&quot;reference external&quot; href=&quot;../chapter11/&quot;&gt;&#19979;&#19968;&#31456;&lt;/a&gt; &#25105;&#20204;&#23558;&#35762;&#35299;Django&#30340;&#36890;&#29992;&#35270;&#22270;&#26694;&#26550;&#65292;&#20351;&#29992;&#23427;&#21019;&#24314;&#24120;&#35265;&#30340;&#32593;&#31449;&#21487;&#20197;&#33410;&#30465;&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter11</id>
        <title type="html">chapter11</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter11"/>
        <published>2015-02-26T23:21:36+08:00</published>
        <updated>2015-02-26T23:21:36+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;11&#31456; &#36890;&#29992;&#35270;&#22270;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#36825;&#37324;&#38656;&#35201;&#20877;&#27425;&#22238;&#21040;&#26412;&#20070;&#30340;&#20027;&#39064;&#65306; &#22312;&#26368;&#22351;&#30340;&#24773;&#20917;&#19979;&#65292; Web &#24320;&#21457;&#26159;&#19968;&#39033;&#26080;&#32842;&#32780;&#19988;&#21333;&#35843;&#30340;&#24037;&#20316;&#12290; &#21040;&#30446;&#21069;&#20026;&#27490;&#65292;&#25105;&#20204;&#24050;&#32463;&#20171;&#32461;&#20102; Django &#24590;&#26679;&#22312;&#27169;&#22411;&#21644;&#27169;&#26495;&#30340;&#23618;&#38754;&#19978;&#20943;&#23567;&#24320;&#21457;&#30340;&#21333;&#35843;&#24615;&#65292;&#20294;&#26159; Web &#24320;&#21457;&#22312;&#35270;&#22270;&#30340;&#23618;&#38754;&#19978;&#65292;&#20063;&#32463;&#21382;&#30528;&#36825;&#31181;&#20196;&#20154;&#21388;&#20518;&#30340;&#20107;&#24773;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;Django&#30340;&lt;em&gt;&#36890;&#29992;&#35270;&#22270;&lt;/em&gt; &#21487;&#20197;&#20943;&#23569;&#36825;&#20123;&#30171;&#33510;&#12290; &#23427;&#25277;&#35937;&#20986;&#19968;&#20123;&#22312;&#35270;&#22270;&#24320;&#21457;&#20013;&#24120;&#29992;&#30340;&#20195;&#30721;&#21644;&#27169;&#24335;&#65292;&#36825;&#26679;&#23601;&#21487;&#20197;&#22312;&#26080;&#38656;&#32534;&#20889;&#22823;&#37327;&#20195;&#30721;&#30340;&#24773;&#20917;&#19979;&#65292;&#24555;&#36895;&#32534;&#20889;&#20986;&#24120;&#29992;&#30340;&#25968;&#25454;&#35270;&#22270;&#12290; &#20107;&#23454;&#19978;&#65292;&#21069;&#38754;&#31456;&#33410;&#20013;&#30340;&#20960;&#20046;&#25152;&#26377;&#35270;&#22270;&#30340;&#31034;&#20363;&#37117;&#21487;&#20197;&#22312;&#36890;&#29992;&#35270;&#22270;&#30340;&#24110;&#21161;&#19979;&#37325;&#20889;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#22312;&#31532;&#20843;&#31456;&#31616;&#21333;&#30340;&#21521;&#22823;&#23478;&#20171;&#32461;&#20102;&#24590;&#26679;&#20351;&#35270;&#22270;&#26356;&#21152;&#30340;&#8220;&#36890;&#29992;&#8221;&#12290; &#22238;&#39038;&#19968;&#19979;&#65292;&#25105;&#20204;&#20250;&#21457;&#29616;&#19968;&#20123;&#27604;&#36739;&#24120;&#35265;&#30340;&#20219;&#21153;&#65292;&#27604;&#22914;&#26174;&#31034;&#19968;&#31995;&#21015;&#23545;&#35937;&#65292;&#20889;&#19968;&#27573;&#20195;&#30721;&#26469;&#26174;&#31034; &lt;em&gt;&#20219;&#20309;&lt;/em&gt; &#23545;&#35937;&#20869;&#23481;&#12290; &#35299;&#20915;&#21150;&#27861;&#23601;&#26159;&#20256;&#36882;&#19968;&#20010;&#39069;&#22806;&#30340;&#21442;&#25968;&#21040;URLConf&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;Django&#20869;&#24314;&#36890;&#29992;&#35270;&#22270;&#21487;&#20197;&#23454;&#29616;&#22914;&#19979;&#21151;&#33021;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn5&quot;&gt;&#23436;&#25104;&#24120;&#29992;&#30340;&#31616;&#21333;&#20219;&#21153;&#65306; &#37325;&#23450;&#21521;&#21040;&#21478;&#19968;&#20010;&#39029;&#38754;&#20197;&#21450;&#28210;&#26579;&#19968;&#20010;&#25351;&#23450;&#30340;&#27169;&#26495;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn6&quot;&gt;&#26174;&#31034;&#21015;&#34920;&#21644;&#26576;&#20010;&#29305;&#23450;&#23545;&#35937;&#30340;&#35814;&#32454;&#20869;&#23481;&#39029;&#38754;&#12290; &#31532;8&#31456;&#20013;&#25552;&#21040;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;event_list&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;entry_list&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#23601;&#26159;&#21015;&#34920;&#35270;&#22270;&#30340;&#19968;&#20010;&#20363;&#23376;&#12290; &#19968;&#20010;&#21333;&#19968;&#30340; event &#39029;&#38754;&#23601;&#26159;&#25105;&#20204;&#25152;&#35828;&#30340;&#35814;&#32454;&#20869;&#23481;&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn7&quot;&gt;&#21576;&#29616;&#22522;&#20110;&#26085;&#26399;&#30340;&#25968;&#25454;&#30340;&#24180;/&#26376;/&#26085;&#24402;&#26723;&#39029;&#38754;&#65292;&#20851;&#32852;&#30340;&#35814;&#24773;&#39029;&#38754;&#65292;&#26368;&#26032;&#39029;&#38754;&#12290; Django Weblogs (&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/weblog/&quot;&gt;http://www.djangoproject.com/weblog/&lt;/a&gt;)&#30340;&#24180;&#12289;&#26376;&#12289;&#26085;&#30340;&#24402;&#26723;&#23601;&#26159;&#20351;&#29992;&#36890;&#29992;&#35270;&#22270; &#26550;&#26500;&#30340;&#65292;&#23601;&#20687;&#26159;&#20856;&#22411;&#30340;&#26032;&#38395;&#25253;&#32440;&#24402;&#26723;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#32508;&#19978;&#25152;&#36848;&#65292;&#36825;&#20123;&#35270;&#22270;&#20026;&#24320;&#21457;&#32773;&#26085;&#24120;&#24320;&#21457;&#20013;&#24120;&#35265;&#30340;&#20219;&#21153;&#25552;&#20379;&#20102;&#26131;&#29992;&#30340;&#25509;&#21475;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn9&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#20351;&#29992;&#36890;&#29992;&#35270;&#22270;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#20351;&#29992;&#36890;&#29992;&#35270;&#22270;&#30340;&#26041;&#27861;&#26159;&#22312;URLconf&#25991;&#20214;&#20013;&#21019;&#24314;&#37197;&#32622;&#23383;&#20856;&#65292;&#28982;&#21518;&#25226;&#36825;&#20123;&#23383;&#20856;&#20316;&#20026;URLconf&#20803;&#32452;&#30340;&#31532;&#19977;&#20010;&#25104;&#21592;&#12290; &#65288;&#23545;&#20110;&#36825;&#20010;&#25216;&#24039;&#30340;&#24212;&#29992;&#21487;&#20197;&#21442;&#30475;&#31532;&#20843;&#31456;&#21521;&#35270;&#22270;&#20256;&#36882;&#39069;&#22806;&#36873;&#39033;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#20363;&#22914;&#65292;&#19979;&#38754;&#26159;&#19968;&#20010;&#21576;&#29616;&#38745;&#24577;&#8220;&#20851;&#20110;&#8221;&#39029;&#38754;&#30340;URLconf&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn13&quot;&gt;from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^about/$&apos;, direct_to_template, {
        &apos;template&apos;: &apos;about.html&apos;
    })
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&#19968;&#30524;&#30475;&#19978;&#21435;&#20284;&#20046;&#26377;&#28857;&#19981;&#21487;&#24605;&#35758;&#65292;&#19981;&#38656;&#35201;&#32534;&#20889;&#20195;&#30721;&#30340;&#35270;&#22270;&#65281;
&#23427;&#21644;&#31532;&#20843;&#31456;&#20013;&#30340;&#20363;&#23376;&#23436;&#20840;&#19968;&#26679;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;direct_to_template&lt;/span&gt;&lt;/tt&gt;&#35270;&#22270;&#20165;&#20165;&#26159;&#30452;&#25509;&#20174;&#20256;&#36882;&#36807;&#26469;&#30340;&#39069;&#22806;&#21442;&#25968;&#33719;&#21462;&#20449;&#24687;&#24182;&#29992;&#20110;&#28210;&#26579;&#35270;&#22270;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#22240;&#20026;&#36890;&#29992;&#35270;&#22270;&#37117;&#26159;&#26631;&#20934;&#30340;&#35270;&#22270;&#20989;&#25968;&#65292;&#25105;&#20204;&#21487;&#20197;&#22312;&#25105;&#20204;&#33258;&#24049;&#30340;&#35270;&#22270;&#20013;&#37325;&#29992;&#23427;&#12290; &#20363;&#22914;&#65292;&#25105;&#20204;&#25193;&#23637; about&#20363;&#23376;&#65292;&#25226;&#26144;&#23556;&#30340;URL&#20174; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/about//&lt;/span&gt;&lt;/tt&gt;&#20462;&#25913;&#21040;&#19968;&#20010;&#38745;&#24577;&#28210;&#26579; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;about/.html&lt;/span&gt;&lt;/tt&gt; &#12290; &#25105;&#20204;&#39318;&#20808;&#20462;&#25913;URL&#37197;&#32622;&#20197;&#25351;&#21521;&#26032;&#30340;&#35270;&#22270;&#20989;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn17&quot;&gt;from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
**from mysite.books.views import about_pages**

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^about/$&apos;, direct_to_template, {
        &apos;template&apos;: &apos;about.html&apos;
    }),
    **(r&apos;^about/(\w+)/$&apos;, about_pages),**
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#25105;&#20204;&#32534;&#20889; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;about_pages&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#30340;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn20&quot;&gt;from django.http import Http404
from django.template import TemplateDoesNotExist
from django.views.generic.simple import direct_to_template

def about_pages(request, page):
    try:
        return direct_to_template(request, template=&quot;about/%s.html&quot; % page)
    except TemplateDoesNotExist:
        raise Http404()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#22312;&#36825;&#37324;&#25105;&#20204;&#35937;&#20351;&#29992;&#20854;&#20182;&#20989;&#25968;&#19968;&#26679;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;direct_to_template&lt;/span&gt;&lt;/tt&gt; &#12290; &#22240;&#20026;&#23427;&#36820;&#22238;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#65292;&#25105;&#20204;&#21482;&#38656;&#35201;&#31616;&#21333;&#30340;&#36820;&#22238;&#23427;&#23601;&#22909;&#20102;&#12290; &#36825;&#37324;&#21807;&#19968;&#26377;&#28857;&#26840;&#25163;&#30340;&#20107;&#24773;&#26159;&#35201;&#22788;&#29702;&#25214;&#19981;&#21040;&#27169;&#26495;&#30340;&#24773;&#20917;&#12290; &#25105;&#20204;&#19981;&#24076;&#26395;&#19968;&#20010;&#19981;&#23384;&#22312;&#30340;&#27169;&#26495;&#23548;&#33268;&#19968;&#20010;&#26381;&#21153;&#31471;&#38169;&#35823;&#65292;&#25152;&#20197;&#25105;&#20204;&#25429;&#33719;TemplateDoesNotExist&#24322;&#24120;&#24182;&#19988;&#36820;&#22238;404&#38169;&#35823;&#26469;&#20316;&#20026;&#26367;&#20195;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&#36825;&#37324;&#26377;&#27809;&#26377;&#23433;&#20840;&#24615;&#38382;&#39064;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#30524;&#23574;&#30340;&#35835;&#32773;&#21487;&#33021;&#24050;&#32463;&#27880;&#24847;&#21040;&#19968;&#20010;&#21487;&#33021;&#30340;&#23433;&#20840;&#28431;&#27934;&#65306; &#25105;&#20204;&#30452;&#25509;&#20351;&#29992;&#20174;&#23458;&#25143;&#31471;&#27983;&#35272;&#22120;&#24471;&#21040;&#30340;&#25968;&#25454;&#26500;&#36896;&#27169;&#26495;&#21517;&#31216;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template=&quot;about/%s.html&quot;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;page&lt;/span&gt;&lt;/tt&gt; )&#12290;&#20045;&#30475;&#36215;&#26469;&#65292;&#36825;&#20687;&#26159;&#19968;&#20010;&#32463;&#20856;&#30340; &lt;em&gt;&#30446;&#24405;&#36328;&#36234;&#65288;directory traversal&#65289;&lt;/em&gt; &#25915;&#20987;&#65288;&#35814;&#24773;&#35831;&#30475;&#31532;20&#31456;&#65289;&#12290; &#20107;&#23454;&#30495;&#26159;&#36825;&#26679;&#21527;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#23436;&#20840;&#19981;&#26159;&#12290; &#26159;&#30340;&#65292;&#19968;&#20010;&#24694;&#24847;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;page&lt;/span&gt;&lt;/tt&gt; &#20540;&#21487;&#20197;&#23548;&#33268;&#30446;&#24405;&#36328;&#36234;&#65292;&#20294;&#26159;&#23613;&#31649; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;page&lt;/span&gt;&lt;/tt&gt; &lt;em&gt;&#26159;&lt;/em&gt; &#20174;&#35831;&#27714;&#30340;URL&#20013;&#33719;&#21462;&#30340;&#65292;&#20294;&#24182;&#19981;&#26159;&#25152;&#26377;&#30340;&#20540;&#37117;&#20250;&#34987;&#25509;&#21463;&#12290; &#36825;&#23601;&#26159;URL&#37197;&#32622;&#30340;&#20851;&#38190;&#25152;&#22312;&#65306; &#25105;&#20204;&#20351;&#29992;&#27491;&#21017;&#34920;&#36798;&#24335; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\w+&lt;/span&gt;&lt;/tt&gt; &#26469;&#20174;URL&#37324;&#21305;&#37197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;page&lt;/span&gt;&lt;/tt&gt; &#65292;&#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\w&lt;/span&gt;&lt;/tt&gt; &#21482;&#25509;&#21463;&#23383;&#31526;&#21644;&#25968;&#23383;&#12290; &#22240;&#27492;&#65292;&#20219;&#20309;&#24694;&#24847;&#30340;&#23383;&#31526; &#65288;&#20363;&#22914;&#22312;&#36825;&#37324;&#26159;&#28857; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.&lt;/span&gt;&lt;/tt&gt; &#21644;&#27491;&#26012;&#32447; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/&lt;/span&gt;&lt;/tt&gt; &#65289;&#23558;&#22312;URL&#35299;&#26512;&#26102;&#34987;&#25298;&#32477;&#65292;&#26681;&#26412;&#19981;&#20250;&#20256;&#36882;&#32473;&#35270;&#22270;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn25&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#23545;&#35937;&#30340;&#36890;&#29992;&#35270;&#22270;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;direct_to_template&lt;/span&gt;&lt;/tt&gt; &#27627;&#26080;&#30097;&#38382;&#26159;&#38750;&#24120;&#26377;&#29992;&#30340;&#65292;&#20294;Django&#36890;&#29992;&#35270;&#22270;&#26368;&#26377;&#29992;&#30340;&#22320;&#26041;&#26159;&#21576;&#29616;&#25968;&#25454;&#24211;&#20013;&#30340;&#25968;&#25454;&#12290;
&#22240;&#20026;&#36825;&#20010;&#24212;&#29992;&#23454;&#22312;&#22826;&#26222;&#36941;&#20102;&#65292;Django&#24102;&#26377;&#24456;&#22810;&#20869;&#24314;&#30340;&#36890;&#29992;&#35270;&#22270;&#26469;&#24110;&#21161;&#20320;&#24456;&#23481;&#26131; &#22320;&#29983;&#25104;&#23545;&#35937;&#30340;&#21015;&#34920;&#21644;&#26126;&#32454;&#35270;&#22270;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&#35753;&#25105;&#20204;&#20808;&#30475;&#30475;&#20854;&#20013;&#30340;&#19968;&#20010;&#36890;&#29992;&#35270;&#22270;&#65306; &#23545;&#35937;&#21015;&#34920;&#35270;&#22270;&#12290; &#25105;&#20204;&#20351;&#29992;&#31532;&#20116;&#31456;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher&lt;/span&gt;&lt;/tt&gt; &#26469;&#20030;&#20363;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn29&quot;&gt;class Publisher(models.Model):
    name = models.CharField(max_length=30)
    address = models.CharField(max_length=50)
    city = models.CharField(max_length=60)
    state_province = models.CharField(max_length=30)
    country = models.CharField(max_length=50)
    website = models.URLField()

    def __unicode__(self):
        return self.name

    class Meta:
        ordering = [&apos;name&apos;]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#35201;&#20026;&#25152;&#26377;&#30340;&#20986;&#29256;&#21830;&#21019;&#24314;&#19968;&#20010;&#21015;&#34920;&#39029;&#38754;&#65292;&#25105;&#20204;&#20351;&#29992;&#19979;&#38754;&#30340;URL&#37197;&#32622;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn32&quot;&gt;from django.conf.urls.defaults import *
from django.views.generic import list_detail
from mysite.books.models import Publisher

publisher_info = {
    &apos;queryset&apos;: Publisher.objects.all(),
}

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^publishers/$&apos;, list_detail.object_list, publisher_info)
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#36825;&#23601;&#26159;&#25152;&#35201;&#32534;&#20889;&#30340;&#25152;&#26377;Python&#20195;&#30721;&#12290; &#24403;&#28982;&#65292;&#25105;&#20204;&#36824;&#38656;&#35201;&#32534;&#20889;&#19968;&#20010;&#27169;&#26495;&#12290; &#25105;&#20204;&#21487;&#20197;&#36890;&#36807;&#22312;&#39069;&#22806;&#21442;&#25968;&#23383;&#20856;&#20013;&#21253;&#21547;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_name&lt;/span&gt;&lt;/tt&gt;&#38190;&#26469;&#26174;&#24335;&#22320;&#21578;&#35785;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;object_list&lt;/span&gt;&lt;/tt&gt;&#35270;&#22270;&#20351;&#29992;&#21738;&#20010;&#27169;&#26495;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn35&quot;&gt;from django.conf.urls.defaults import *
from django.views.generic import list_detail
from mysite.books.models import Publisher

publisher_info = {
    &apos;queryset&apos;: Publisher.objects.all(),
    **&apos;template_name&apos;: &apos;publisher_list_page.html&apos;,**
}

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^publishers/$&apos;, list_detail.object_list, publisher_info)
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&#22312;&#32570;&#23569;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_name&lt;/span&gt;&lt;/tt&gt;&#30340;&#24773;&#20917;&#19979;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;object_list&lt;/span&gt;&lt;/tt&gt;&#36890;&#29992;&#35270;&#22270;&#23558;&#33258;&#21160;&#20351;&#29992;&#19968;&#20010;&#23545;&#35937;&#21517;&#31216;&#12290; &#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#36825;&#20010;&#25512;&#23548;&#20986;&#30340;&#27169;&#26495;&#21517;&#31216;&#23558;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;books/publisher_list.html&quot;&lt;/span&gt;&lt;/tt&gt; &#65292;&#20854;&#20013;books&#37096;&#20998;&#26159;&#23450;&#20041;&#36825;&#20010;&#27169;&#22411;&#30340;app&#30340;&#21517;&#31216;&#65292; publisher&#37096;&#20998;&#26159;&#36825;&#20010;&#27169;&#22411;&#21517;&#31216;&#30340;&#23567;&#20889;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#36825;&#20010;&#27169;&#26495;&#23558;&#25353;&#29031; context &#20013;&#21253;&#21547;&#30340;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;object_list&lt;/span&gt;&lt;/tt&gt; &#26469;&#28210;&#26579;&#65292;&#36825;&#20010;&#21464;&#37327;&#21253;&#21547;&#25152;&#26377;&#30340;&#20070;&#31821;&#23545;&#35937;&#12290; &#19968;&#20010;&#38750;&#24120;&#31616;&#21333;&#30340;&#27169;&#26495;&#30475;&#36215;&#26469;&#35937;&#19979;&#38754;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn39&quot;&gt;{% extends &quot;base.html&quot; %}

{% block content %}
    &amp;lt;h2&amp;gt;Publishers&amp;lt;/h2&amp;gt;
    &amp;lt;ul&amp;gt;
        {% for publisher in object_list %}
            &amp;lt;li&amp;gt;{{ publisher.name }}&amp;lt;/li&amp;gt;
        {% endfor %}
    &amp;lt;/ul&amp;gt;
{% endblock %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn40&quot;&gt;(&#27880;&#24847;&#65292;&#36825;&#37324;&#25105;&#20204;&#20551;&#23450;&#23384;&#22312;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;base.html&lt;/span&gt;&lt;/tt&gt;&#27169;&#26495;&#65292;&#23427;&#21644;&#25105;&#20204;&#31532;&#22235;&#31456;&#20013;&#30340;&#19968;&#26679;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#36825;&#23601;&#26159;&#25152;&#26377;&#35201;&#20570;&#30340;&#20107;&#12290; &#35201;&#20351;&#29992;&#36890;&#29992;&#35270;&#22270;&#37239;&#37239;&#30340;&#29305;&#24615;&#21482;&#38656;&#35201;&#20462;&#25913;&#21442;&#25968;&#23383;&#20856;&#24182;&#20256;&#36882;&#32473;&#36890;&#29992;&#35270;&#22270;&#20989;&#25968;&#12290; &#38468;&#24405;D&#26159;&#36890;&#29992;&#35270;&#22270;&#30340;&#23436;&#20840;&#21442;&#32771;&#36164;&#26009;&#65307;&#26412;&#31456;&#25509;&#19979;&#26469;&#30340;&#31456;&#33410;&#23558;&#35762;&#21040;&#33258;&#23450;&#20041;&#21644;&#25193;&#23637;&#36890;&#29992;&#35270;&#22270;&#30340;&#19968;&#20123;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn42&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#25193;&#23637;&#36890;&#29992;&#35270;&#22270;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&#27627;&#26080;&#30097;&#38382;&#65292;&#20351;&#29992;&#36890;&#29992;&#35270;&#22270;&#21487;&#20197;&#20805;&#20998;&#21152;&#24555;&#24320;&#21457;&#36895;&#24230;&#12290; &#28982;&#32780;&#65292;&#22312;&#22810;&#25968;&#30340;&#24037;&#31243;&#20013;&#65292;&#20063;&#20250;&#20986;&#29616;&#36890;&#29992;&#35270;&#22270;&#19981;&#33021; &#28385;&#36275;&#38656;&#27714;&#30340;&#24773;&#20917;&#12290; &#23454;&#38469;&#19978;&#65292;&#21018;&#25509;&#35302;Django&#30340;&#24320;&#21457;&#32773;&#26368;&#24120;&#35265;&#30340;&#38382;&#39064;&#23601;&#26159;&#24590;&#26679;&#20351;&#29992;&#36890;&#29992;&#35270;&#22270;&#26469;&#22788;&#29702;&#26356;&#22810;&#30340;&#24773;&#20917;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#24184;&#36816;&#30340;&#26159;&#65292;&#20960;&#20046;&#27599;&#31181;&#24773;&#20917;&#37117;&#26377;&#30456;&#24212;&#30340;&#26041;&#27861;&#26469;&#31616;&#26131;&#22320;&#25193;&#23637;&#36890;&#29992;&#35270;&#22270;&#20197;&#22788;&#29702;&#36825;&#20123;&#24773;&#20917;&#12290; &#36825;&#26102;&#24635;&#26159;&#20351;&#29992;&#19979;&#38754;&#30340; &#36825;&#20123;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;context&quot;&gt;
&lt;span id=&quot;cn45&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#21046;&#20316;&#21451;&#22909;&#30340;&#27169;&#26495;Context&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#20320;&#20063;&#35768;&#24050;&#32463;&#27880;&#24847;&#21040;&#33539;&#20363;&#20013;&#30340;&#20986;&#29256;&#21830;&#21015;&#34920;&#27169;&#26495;&#22312;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;object_list&lt;/span&gt;&lt;/tt&gt; &#37324;&#20445;&#23384;&#25152;&#26377;&#30340;&#20070;&#31821;&#12290;&#36825;&#20010;&#26041;&#27861;&#24037;&#20316;&#30340;&#24456;&#22909;&#65292;&#21482;&#26159;&#23545;&#32534;&#20889;&#27169;&#26495;&#30340;&#20154;&#19981;&#22826;&#21451;&#22909;&#12290; &#20182;&#20204;&#24517;&#39035;&#30693;&#36947;&#36825;&#37324;&#27491;&#22312;&#22788;&#29702;&#30340;&#26159;&#20070;&#31821;&#12290; &#26356;&#22909;&#30340;&#21464;&#37327;&#21517;&#24212;&#35813;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;publisher_list&lt;/span&gt;&lt;/tt&gt;&#65292;&#36825;&#26679;&#21464;&#37327;&#25152;&#20195;&#34920;&#30340;&#20869;&#23481;&#23601;&#26174;&#32780;&#26131;&#35265;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#24456;&#23481;&#26131;&#22320;&#20687;&#19979;&#38754;&#36825;&#26679;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_object_name&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#30340;&#21517;&#31216;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn49&quot;&gt;from django.conf.urls.defaults import *
from django.views.generic import list_detail
from mysite.books.models import Publisher

publisher_info = {
    &apos;queryset&apos;: Publisher.objects.all(),
    &apos;template_name&apos;: &apos;publisher_list_page.html&apos;,
    &apos;template_object_name&apos;: &apos;publisher&apos;,
}

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^publishers/$&apos;, list_detail.object_list, publisher_info)
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#22312;&#27169;&#26495;&#20013;&#65292;&#36890;&#29992;&#35270;&#22270;&#20250;&#36890;&#36807;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_object_name&lt;/span&gt;&lt;/tt&gt;&#21518;&#36861;&#21152;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_list&lt;/span&gt;&lt;/tt&gt;&#30340;&#26041;&#24335;&#26469;&#21019;&#24314;&#19968;&#20010;&#34920;&#31034;&#21015;&#34920;&#39033;&#30446;&#30340;&#21464;&#37327;&#21517;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&#20351;&#29992;&#26377;&#29992;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_object_name&lt;/span&gt;&lt;/tt&gt; &#24635;&#26159;&#20010;&#22909;&#24819;&#27861;&#12290; &#20320;&#30340;&#35774;&#35745;&#27169;&#26495;&#30340;&#21512;&#20316;&#20249;&#20276;&#20250;&#24863;&#35874;&#20320;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn52&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#28155;&#21152;&#39069;&#22806;&#30340;Context&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#20320;&#24120;&#24120;&#38656;&#35201;&#21576;&#29616;&#27604;&#36890;&#29992;&#35270;&#22270;&#25552;&#20379;&#30340;&#26356;&#22810;&#30340;&#39069;&#22806;&#20449;&#24687;&#12290; &#20363;&#22914;&#65292;&#32771;&#34385;&#19968;&#19979;&#22312;&#27599;&#20010;&#20986;&#29256;&#21830;&#30340;&#35814;&#32454;&#39029;&#38754;&#26174;&#31034;&#25152;&#26377;&#20854;&#20182;&#20986;&#29256;&#21830;&#21015;&#34920;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;object_detail&lt;/span&gt;&lt;/tt&gt; &#36890;&#29992;&#35270;&#22270;&#20026;context&#25552;&#20379;&#20102;&#20986;&#29256;&#21830;&#20449;&#24687;&#65292;&#20294;&#26159;&#30475;&#36215;&#26469;&#27809;&#26377;&#21150;&#27861;&#22312;&#27169;&#26495;&#20013; &#33719;&#21462; &lt;em&gt;&#25152;&#26377;&lt;/em&gt; &#20986;&#29256;&#21830;&#21015;&#34920;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&#36825;&#26159;&#35299;&#20915;&#26041;&#27861;&#65306; &#25152;&#26377;&#30340;&#36890;&#29992;&#35270;&#22270;&#37117;&#26377;&#19968;&#20010;&#39069;&#22806;&#30340;&#21487;&#36873;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;extra_context&lt;/span&gt;&lt;/tt&gt; &#12290;&#36825;&#20010;&#21442;&#25968;&#26159;&#19968;&#20010;&#23383;&#20856;&#25968;&#25454;&#31867;&#22411;&#65292;&#21253;&#21547;&#35201;&#28155;&#21152;&#21040;&#27169;&#26495;&#30340;context&#20013;&#30340;&#39069;&#22806;&#30340;&#23545;&#35937;&#12290; &#25152;&#20197;&#35201;&#32473;&#35270;&#22270;&#25552;&#20379;&#25152;&#26377;&#20986;&#29256;&#21830;&#30340;&#21015;&#34920;&#65292;&#25105;&#20204;&#23601;&#29992;&#36825;&#26679;&#30340;info&#23383;&#20856;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn56&quot;&gt;publisher_info = {
    &apos;queryset&apos;: Publisher.objects.all(),
    &apos;template_object_name&apos;: &apos;publisher&apos;,
    **&apos;extra_context&apos;: {&apos;book_list&apos;: Book.objects.all()}**
}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#36825;&#26679;&#23601;&#25226;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;book_list&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#25918;&#21040;&#27169;&#26495;&#30340;context&#20013;&#12290;
&#36825;&#20010;&#26041;&#27861;&#21487;&#20197;&#29992;&#26469;&#20256;&#36882;&#20219;&#24847;&#25968;&#25454; &#21040;&#36890;&#29992;&#35270;&#22270;&#27169;&#26495;&#20013;&#21435;&#65292;&#38750;&#24120;&#26041;&#20415;&#12290; &#36825;&#26159;&#38750;&#24120;&#26041;&#20415;&#30340;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&#19981;&#36807;&#65292;&#36825;&#37324;&#26377;&#19968;&#20010;&#24456;&#38544;&#34109;&#30340;BUG&#65292;&#19981;&#30693;&#36947;&#20320;&#21457;&#29616;&#20102;&#27809;&#26377;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#25105;&#20204;&#29616;&#22312;&#26469;&#30475;&#19968;&#19979;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;extra_context&lt;/span&gt;&lt;/tt&gt; &#37324;&#21253;&#21547;&#25968;&#25454;&#24211;&#26597;&#35810;&#30340;&#38382;&#39064;&#12290;
&#22240;&#20026;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher.objects.all()&lt;/span&gt;&lt;/tt&gt; &#25918;&#22312;URLconf&#20013;&#65292;&#23427;&#21482;&#20250;&#25191;&#34892;&#19968;&#27425;&#65288;&#24403;URLconf&#31532;&#19968;&#27425;&#21152;&#36733;&#30340;&#26102;&#20505;&#65289;&#12290; &#24403;&#20320;&#28155;&#21152;&#25110;&#21024;&#38500;&#20986;&#29256;&#21830;&#65292;&#20320;&#20250;&#21457;&#29616;&#22312;&#37325;&#21551;Web&#26381;&#21153;&#22120;&#20043;&#21069;&#65292;&#36890;&#29992;&#35270;&#22270;&#19981;&#20250;&#21453;&#26144;&#20986;&#36825;&#20123;&#20462;&#25913;&#65288;&#26377;&#20851;QuerySet&#20309;&#26102;&#34987;&#32531;&#23384;&#21644;&#36171;&#20540;&#30340;&#26356;&#22810;&#20449;&#24687;&#35831;&#21442;&#32771;&#38468;&#24405;C&#20013;&#8220;&#32531;&#23384;&#19982;&#26597;&#35810;&#38598;&#8221;&#19968;&#33410;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#22791;&#27880;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&#36825;&#20010;&#38382;&#39064;&#19981;&#36866;&#29992;&#20110;&#36890;&#29992;&#35270;&#22270;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;queryset&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#12290; &#22240;&#20026;Django&#30693;&#36947;&#26377;&#20123;&#29305;&#21035;&#30340; QuerySet &lt;em&gt;&#27704;&#36828;&#19981;&#33021;&lt;/em&gt; &#34987;&#32531;&#23384;&#65292;&#36890;&#29992;&#35270;&#22270;&#22312;&#28210;&#26579;&#21069;&#37117;&#20570;&#20102;&#32531;&#23384;&#28165;&#38500;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#30340;&#21150;&#27861;&#26159;&#22312; &lt;em&gt;extra_context&lt;/em&gt; &#20013;&#29992;&#19968;&#20010;&#22238;&#35843;&#65288;callback&#65289;&#26469;&#20195;&#26367;&#20351;&#29992;&#19968;&#20010;&#21464;&#37327;&#12290;
&#20219;&#20309;&#20256;&#36882;&#32473;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;extra_context&lt;/span&gt;&lt;/tt&gt;&#30340;&#21487;&#35843;&#29992;&#23545;&#35937;&#65288;&#20363;&#22914;&#19968;&#20010;&#20989;&#25968;&#65289;&#37117;&#20250;&#22312;&#27599;&#27425;&#35270;&#22270;&#28210;&#26579;&#21069;&#25191;&#34892;&#65288;&#32780;&#19981;&#26159;&#21482;&#25191;&#34892;&#19968;&#27425;&#65289;&#12290; &#20320;&#21487;&#20197;&#35937;&#36825;&#26679;&#23450;&#20041;&#19968;&#20010;&#20989;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn64&quot;&gt;**def get_books():**
    **return Book.objects.all()**

publisher_info = {
    &apos;queryset&apos;: Publisher.objects.all(),
    &apos;template_object_name&apos;: &apos;publisher&apos;,
    &apos;extra_context&apos;: **{&apos;book_list&apos;: get_books}**
}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#25110;&#32773;&#20320;&#21487;&#20197;&#20351;&#29992;&#21478;&#19968;&#20010;&#19981;&#26159;&#37027;&#20040;&#28165;&#26224;&#20294;&#26159;&#24456;&#31616;&#30701;&#30340;&#26041;&#27861;&#65292;&#20107;&#23454;&#19978; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Publisher.objects.all&lt;/span&gt;&lt;/tt&gt; &#26412;&#36523;&#23601;&#26159;&#21487;&#20197;&#35843;&#29992;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn67&quot;&gt;publisher_info = {
    &apos;queryset&apos;: Publisher.objects.all(),
    &apos;template_object_name&apos;: &apos;publisher&apos;,
    &apos;extra_context&apos;: **{&apos;book_list&apos;: Book.objects.all}**
}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#27880;&#24847; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Book.objects.all&lt;/span&gt;&lt;/tt&gt; &#21518;&#38754;&#27809;&#26377;&#25324;&#21495;&#65307;&#36825;&#34920;&#31034;&#36825;&#26159;&#19968;&#20010;&#20989;&#25968;&#30340;&#24341;&#29992;&#65292;&#24182;&#27809;&#26377;&#30495;&#27491;&#35843;&#29992;&#23427;&#65288;&#36890;&#29992;&#35270;&#22270;&#23558;&#20250;&#22312;&#28210;&#26579;&#26102;&#35843;&#29992;&#23427;&#65289;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn69&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#26174;&#31034;&#23545;&#35937;&#30340;&#23376;&#38598;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#29616;&#22312;&#35753;&#25105;&#20204;&#26469;&#20180;&#32454;&#30475;&#30475;&#36825;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;queryset&lt;/span&gt;&lt;/tt&gt; &#12290; &#22823;&#22810;&#25968;&#36890;&#29992;&#35270;&#22270;&#26377;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;queryset&lt;/span&gt;&lt;/tt&gt;&#21442;&#25968;&#65292;&#36825;&#20010;&#21442;&#25968;&#21578;&#35785;&#35270;&#22270;&#35201;&#26174;&#31034;&#23545;&#35937;&#30340;&#38598;&#21512; &#65288;&#26377;&#20851;QuerySet&#30340;&#35299;&#37322;&#35831;&#30475;&#31532;&#20116;&#31456;&#30340; &#8220;&#36873;&#25321;&#23545;&#35937;&#8221;&#31456;&#33410;&#65292;&#35814;&#32454;&#36164;&#26009;&#35831;&#21442;&#30475;&#38468;&#24405;B&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#20030;&#19968;&#20010;&#31616;&#21333;&#30340;&#20363;&#23376;&#65292;&#25105;&#20204;&#25171;&#31639;&#23545;&#20070;&#31821;&#21015;&#34920;&#25353;&#20986;&#29256;&#26085;&#26399;&#25490;&#24207;&#65292;&#26368;&#36817;&#30340;&#25490;&#22312;&#26368;&#21069;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn73&quot;&gt;book_info = {
    &apos;queryset&apos;: Book.objects.order_by(&apos;-publication_date&apos;),
}

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^publishers/$&apos;, list_detail.object_list, publisher_info),
    **(r&apos;^books/$&apos;, list_detail.object_list, book_info),**
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#36825;&#26159;&#19968;&#20010;&#30456;&#24403;&#31616;&#21333;&#30340;&#20363;&#23376;&#65292;&#20294;&#26159;&#24456;&#35828;&#26126;&#38382;&#39064;&#12290; &#24403;&#28982;&#65292;&#20320;&#36890;&#24120;&#36824;&#24819;&#20570;&#27604;&#37325;&#26032;&#25490;&#24207;&#26356;&#22810;&#30340;&#20107;&#12290; &#22914;&#26524;&#20320;&#24819;&#35201;&#21576;&#29616;&#26576;&#20010;&#29305;&#23450;&#20986;&#29256;&#21830;&#20986;&#29256;&#30340;&#25152;&#26377;&#20070;&#31821;&#21015;&#34920;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#21516;&#26679;&#30340;&#25216;&#26415;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn76&quot;&gt;**apress_books = {**
    **&apos;queryset&apos;: Book.objects.filter(publisher__name=&apos;Apress Publishing&apos;),**
    **&apos;template_name&apos;: &apos;books/apress_list.html&apos;**
**}**

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^publishers/$&apos;, list_detail.object_list, publisher_info),
    **(r&apos;^books/apress/$&apos;, list_detail.object_list, apress_books),**
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#27880;&#24847; &#22312;&#20351;&#29992;&#19968;&#20010;&#36807;&#28388;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;queryset&lt;/span&gt;&lt;/tt&gt; &#30340;&#21516;&#26102;&#65292;&#25105;&#20204;&#36824;&#20351;&#29992;&#20102;&#19968;&#20010;&#33258;&#23450;&#20041;&#30340;&#27169;&#26495;&#21517;&#31216;&#12290; &#22914;&#26524;&#25105;&#20204;&#19981;&#36825;&#20040;&#20570;&#65292;&#36890;&#29992;&#35270;&#22270;&#23601;&#20250;&#29992;&#20197;&#21069;&#30340;&#27169;&#26495;&#65292;&#36825;&#21487;&#33021;&#19981;&#26159;&#25105;&#20204;&#24819;&#35201;&#30340;&#32467;&#26524;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#21516;&#26679;&#35201;&#27880;&#24847;&#30340;&#26159;&#36825;&#24182;&#19981;&#26159;&#19968;&#20010;&#22788;&#29702;&#20986;&#29256;&#21830;&#30456;&#20851;&#20070;&#31821;&#30340;&#26368;&#22909;&#26041;&#27861;&#12290; &#22914;&#26524;&#25105;&#20204;&#24819;&#35201;&#28155;&#21152;&#21478;&#19968;&#20010; &#20986;&#29256;&#21830;&#39029;&#38754;&#65292;&#25105;&#20204;&#23601;&#24471;&#22312;URL&#37197;&#32622;&#20013;&#20889;URL&#37197;&#32622;&#65292;&#22914;&#26524;&#26377;&#24456;&#22810;&#30340;&#20986;&#29256;&#21830;&#65292;&#36825;&#20010;&#26041;&#27861;&#23601;&#19981;&#33021; &#25509;&#21463;&#20102;&#12290;
&#22312;&#25509;&#19979;&#26469;&#30340;&#31456;&#33410;&#25105;&#20204;&#23558;&#26469;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn79&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&#29992;&#20989;&#25968;&#21253;&#35013;&#26469;&#22788;&#29702;&#22797;&#26434;&#30340;&#25968;&#25454;&#36807;&#28388;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#21478;&#19968;&#20010;&#24120;&#35265;&#30340;&#38656;&#27714;&#26159;&#25353;URL&#37324;&#30340;&#20851;&#38190;&#23383;&#26469;&#36807;&#28388;&#25968;&#25454;&#23545;&#35937;&#12290; &#20043;&#21069;&#65292;&#25105;&#20204;&#22312;URLconf&#20013;&#30828;&#32534;&#30721;&#20102;&#20986;&#29256;&#21830;&#30340;&#21517;&#23383;&#65292;&#20294;&#26159;&#22914;&#26524;&#25105;&#20204;&#24819;&#29992;&#19968;&#20010;&#35270;&#22270;&#23601;&#26174;&#31034;&#26576;&#20010;&#20219;&#24847;&#25351;&#23450;&#30340;&#20986;&#29256;&#21830;&#30340;&#25152;&#26377;&#20070;&#31821;&#65292;&#37027;&#35813;&#24590;&#20040;&#21150;&#21602;&#65311; &#25105;&#20204;&#21487;&#20197;&#36890;&#36807;&#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;object_list&lt;/span&gt;&lt;/tt&gt; &#36890;&#29992;&#35270;&#22270;&#36827;&#34892;&#21253;&#35013;&#26469;&#36991;&#20813; &#20889;&#19968;&#22823;&#22534;&#30340;&#25163;&#24037;&#20195;&#30721;&#12290; &#25353;&#24815;&#20363;&#65292;&#25105;&#20204;&#20808;&#20174;&#20889;URL&#37197;&#32622;&#24320;&#22987;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn82&quot;&gt;urlpatterns = patterns(&apos;&apos;,
    (r&apos;^publishers/$&apos;, list_detail.object_list, publisher_info),
    **(r&apos;^books/(\w+)/$&apos;, books_by_publisher),**
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#25509;&#19979;&#26469;&#65292;&#25105;&#20204;&#20889; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;books_by_publisher&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#35270;&#22270;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn85&quot;&gt;from django.shortcuts import get_object_or_404
from django.views.generic import list_detail
from mysite.books.models import Book, Publisher

def books_by_publisher(request, name):

    # Look up the publisher (and raise a 404 if it can&apos;t be found).
    publisher = get_object_or_404(Publisher, name__iexact=name)

    # Use the object_list view for the heavy lifting.
    return list_detail.object_list(
        request,
        queryset = Book.objects.filter(publisher=publisher),
        template_name = &apos;books/books_by_publisher.html&apos;,
        template_object_name = &apos;book&apos;,
        extra_context = {&apos;publisher&apos;: publisher}
    )
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#36825;&#26679;&#20889;&#27809;&#38382;&#39064;&#65292;&#22240;&#20026;&#36890;&#29992;&#35270;&#22270;&#23601;&#26159;Python&#20989;&#25968;&#12290; &#21644;&#20854;&#20182;&#30340;&#35270;&#22270;&#20989;&#25968;&#19968;&#26679;&#65292;&#36890;&#29992;&#35270;&#22270;&#20063;&#26159;&#25509;&#21463;&#19968;&#20123; &#21442;&#25968;&#24182;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290; &#22240;&#27492;&#65292;&#36890;&#36807;&#21253;&#35013;&#36890;&#29992;&#35270;&#22270;&#20989;&#25968;&#21487;&#20197;&#20570;&#26356;&#22810;&#30340;&#20107;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#27880;&#24847;&#22312;&#21069;&#38754;&#36825;&#20010;&#20363;&#23376;&#20013;&#25105;&#20204;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;extra_context&lt;/span&gt;&lt;/tt&gt;&#20013;&#20256;&#36882;&#20102;&#24403;&#21069;&#20986;&#29256;&#21830;&#36825;&#20010;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn89&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#22788;&#29702;&#39069;&#22806;&#24037;&#20316;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn90&quot;&gt;&#25105;&#20204;&#20877;&#26469;&#30475;&#30475;&#26368;&#21518;&#19968;&#20010;&#24120;&#29992;&#27169;&#24335;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#24819;&#35937;&#19968;&#19979;&#25105;&#20204;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#37324;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;last_accessed&lt;/span&gt;&lt;/tt&gt; &#23383;&#27573;&#65292;&#25105;&#20204;&#29992;&#36825;&#20010;&#23383;&#27573;&#26469;&#35760;&#24405;&#26368;&#36817;&#19968;&#27425;&#23545;author&#30340;&#35775;&#38382;&#12290; &#24403;&#28982;&#36890;&#29992;&#35270;&#22270; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;object_detail&lt;/span&gt;&lt;/tt&gt; &#24182;&#19981;&#33021;&#22788;&#29702;&#36825;&#20010;&#38382;&#39064;&#65292;&#20294;&#26159;&#25105;&#20204;&#20173;&#28982;&#21487;&#20197;&#24456;&#23481;&#26131;&#22320;&#32534;&#20889;&#19968;&#20010;&#33258;&#23450;&#20041;&#30340;&#35270;&#22270;&#26469;&#26356;&#26032;&#36825;&#20010;&#23383;&#27573;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#39318;&#20808;&#65292;&#25105;&#20204;&#38656;&#35201;&#22312;URL&#37197;&#32622;&#37324;&#35774;&#32622;&#25351;&#21521;&#21040;&#26032;&#30340;&#33258;&#23450;&#20041;&#35270;&#22270;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn94&quot;&gt;from mysite.books.views import author_detail

urlpatterns = patterns(&apos;&apos;,
    # ...
    **(r&apos;^authors/(?P&amp;lt;author_id&amp;gt;\d+)/$&apos;, author_detail),**
    # ...
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#25509;&#19979;&#26469;&#20889;&#21253;&#35013;&#20989;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn97&quot;&gt;import datetime
from django.shortcuts import get_object_or_404
from django.views.generic import list_detail
from mysite.books.models import Author

def author_detail(request, author_id):
    # Delegate to the generic view and get an HttpResponse.
    response = list_detail.object_detail(
        request,
        queryset = Author.objects.all(),
        object_id = author_id,
    )

    # Record the last accessed date. We do this *after* the call
    # to object_detail(), not before it, so that this won&apos;t be called
    # unless the Author actually exists. (If the author doesn&apos;t exist,
    # object_detail() will raise Http404, and we won&apos;t reach this point.)
    now = datetime.datetime.now()
    Author.objects.filter(id=author_id).update(last_accessed=now)

    return response
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#38500;&#38750;&#20320;&#28155;&#21152; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;last_accessed&lt;/span&gt;&lt;/tt&gt; &#23383;&#27573;&#21040;&#20320;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Author&lt;/span&gt;&lt;/tt&gt; &#27169;&#22411;&#24182;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;books/author_detail.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#65292;&#21542;&#21017;&#36825;&#27573;&#20195;&#30721;&#19981;&#33021;&#30495;&#27491;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#29992;&#21516;&#26679;&#30340;&#26041;&#27861;&#20462;&#25913;&#36890;&#29992;&#35270;&#22270;&#30340;&#36820;&#22238;&#20540;&#12290;
&#22914;&#26524;&#25105;&#20204;&#24819;&#35201;&#25552;&#20379;&#19968;&#20010;&#20379;&#19979;&#36733;&#29992;&#30340; &#32431;&#25991;&#26412;&#29256;&#26412;&#30340;author&#21015;&#34920;&#65292;&#25105;&#20204;&#21487;&#20197;&#29992;&#19979;&#38754;&#36825;&#20010;&#35270;&#22270;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn102&quot;&gt;def author_list_plaintext(request):
    response = list_detail.object_list(
        request,
        queryset = Author.objects.all(),
        mimetype = &apos;text/plain&apos;,
        template_name = &apos;books/author_list.txt&apos;
    )
    response[&quot;Content-Disposition&quot;] = &quot;attachment; filename=authors.txt&quot;
    return response
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#36825;&#20010;&#26041;&#27861;&#20043;&#25152;&#20197;&#24037;&#20316;&#26159;&#22240;&#20026;&#36890;&#29992;&#35270;&#22270;&#36820;&#22238;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#21487;&#20197;&#35937;&#19968;&#20010;&#23383;&#20856; &#19968;&#26679;&#30340;&#35774;&#32622;HTTP&#30340;&#22836;&#37096;&#12290; &#38543;&#20415;&#35828;&#19968;&#19979;&#65292;&#36825;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Content-Disposition&lt;/span&gt;&lt;/tt&gt; &#30340;&#21547;&#20041;&#26159; &#21578;&#35785;&#27983;&#35272;&#22120;&#19979;&#36733;&#24182;&#20445;&#23384;&#36825;&#20010;&#39029;&#38754;&#65292;&#32780;&#19981;&#26159;&#22312;&#27983;&#35272;&#22120;&#20013;&#26174;&#31034;&#23427;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn104&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&#22312;&#36825;&#19968;&#31456;&#25105;&#20204;&#21482;&#35762;&#20102;Django&#24102;&#30340;&#36890;&#29992;&#35270;&#22270;&#20854;&#20013;&#19968;&#37096;&#20998;&#65292;&#19981;&#36807;&#36825;&#20123;&#26041;&#27861;&#20063;&#36866;&#29992;&#20110;&#20854;&#20182;&#30340; &#36890;&#29992;&#35270;&#22270;&#12290; &#38468;&#24405;C&#35814;&#32454;&#22320;&#20171;&#32461;&#20102;&#25152;&#26377;&#21487;&#29992;&#30340;&#35270;&#22270;&#65292;&#22914;&#26524;&#20320;&#24819;&#20102;&#35299;&#36825;&#20123;&#24378;&#22823;&#30340;&#29305;&#24615;&#65292;&#25512;&#33616;&#20320;&#38405;&#35835;&#19968;&#19979;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#36825;&#26412;&#20070;&#30340;&#39640;&#32423;&#35821;&#27861;&#37096;&#20998;&#21040;&#27492;&#32467;&#26463;&#12290; &#22312;&lt;a class=&quot;reference external&quot; href=&quot;../chapter12/&quot;&gt;&#19979;&#19968;&#31456;&lt;/a&gt;, &#25105;&#20204;&#35762;&#35299;&#20102;Django&#24212;&#29992;&#30340;&#37096;&#32626;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter12</id>
        <title type="html">chapter12</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter12"/>
        <published>2015-02-26T23:20:44+08:00</published>
        <updated>2015-02-26T23:20:44+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;django&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#21313;&#20108;&#31456;&#65306; &#37096;&#32626;Django&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#26412;&#31456;&#21253;&#21547;&#21019;&#24314;&#19968;&#20010;django&#31243;&#24207;&#26368;&#24517;&#19981;&#21487;&#23569;&#30340;&#27493;&#39588; &#22312;&#26381;&#21153;&#22120;&#19978;&#37096;&#32626;&#23427;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#22914;&#26524;&#20320;&#19968;&#30452;&#36319;&#30528;&#25105;&#20204;&#30340;&#20363;&#23376;&#20570;&#65292;&#20320;&#21487;&#33021;&#27491;&#22312;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;runserver&lt;/span&gt;&lt;/tt&gt; &#20294;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;runserver&lt;/span&gt;&lt;/tt&gt; &#35201;&#37096;&#32626;&#20320;&#30340;django&#31243;&#24207;&#65292;&#20320;&#38656;&#35201;&#25346;&#25509;&#21040;&#24037;&#19994;&#29992;&#30340;&#26381;&#21153;&#22120; &#22914;&#65306;Apache &#22312;&#26412;&#31456;&#65292;&#25105;&#20204;&#23558;&#23637;&#31034;&#22914;&#20309;&#20570;&#65292;&#20294;&#26159;&#65292;&#22312;&#20570;&#20043;&#21069;&#25105;&#20204;&#35201;&#32473;&#20320;&#19968;&#20010;(&#35201;&#20570;&#30340;&#20107;&#30340;)&#28165;&#21333;.&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id1&quot;&gt;
&lt;span id=&quot;cn3&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#20934;&#22791;&#20320;&#30340;&#20195;&#30721;&#24211;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#24456;&#24184;&#36816;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;runserver&lt;/span&gt;&lt;/tt&gt; &#20294;&#26159;&#65292;&#22312;&#24320;&#22987;&#21069;&#65292;&#26377;&#19968;&#20123;**&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;debug&quot;&gt;
&lt;span id=&quot;cn5&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&#20851;&#38381;Debug&#27169;&#24335;.&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&#25105;&#20204;&#22312;&#31532;2&#31456;,&#29992;&#21629;&#20196; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt;&lt;/tt&gt;&#21019;&#24314;&#20102;&#19968;&#20010;&#39033;&#30446; , &#20854;&#20013;&#21019;&#24314;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;settings.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#40664;&#35748;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; . django&#20250;&#26681;&#25454;&#36825;&#20010;&#35774;&#32622;&#26469;&#25913;&#21464;&#20182;&#20204;&#30340;&#34892;&#20026;&#65292; &#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#27169;&#24335;&#34987;&#24320;&#21551;. &#20363;&#22914;&#65292; &#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#34987;&#35774;&#32622;&#25104; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; , &#37027;&#20040;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn7&quot;&gt;&#25152;&#26377;&#30340;&#25968;&#25454;&#24211;&#26597;&#35810;&#23558;&#34987;&#20445;&#23384;&#22312;&#20869;&#23384;&#20013;&#65292; &#20197;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.db.connection.queries&lt;/span&gt;&lt;/tt&gt; &#30340;&#24418;&#24335;. &#20320;&#21487;&#20197;&#24819;&#35937;&#65292;&#36825;&#20010;&#21507;&#20869;&#23384;!&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn8&quot;&gt;&#20219;&#20309;404&#38169;&#35823;&#37117;&#23558;&#21576;&#29616;django&#30340;&#29305;&#27530;&#30340;404&#39029;&#38754;(&#31532;3&#31456;&#26377;)&#32780;&#19981;&#26159;&#26222;&#36890;&#30340;404&#39029;&#38754;&#12290; &#36825;&#20010;&#39029;&#38754;&#21253;&#21547;&#28508;&#22312;&#30340;&#25935;&#24863;&#20449;&#24687;&#65292;&#20294;&#26159;&#19981;&#20250;&#26292;&#38706;&#22312;&#20844;&#20849;&#20114;&#32852;&#32593;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn9&quot;&gt;&#20320;&#30340;&#24212;&#29992;&#20013;&#20219;&#20309;&#26410;&#25429;&#33719;&#30340;&#24322;&#24120;&#65292;&#20174;&#22522;&#26412;&#30340;python&#35821;&#27861;&#38169;&#35823;&#21040;&#25968;&#25454;&#24211;&#38169;&#35823;&#20197;&#21450;&#27169;&#26495;&#35821;&#27861;&#38169;&#35823;&#37117;&#20250;&#36820;&#22238;&#28418;&#20142;&#30340;Django&#38169;&#35823;&#39029;&#38754;&#12290; &#36825;&#20010;&#39029;&#38754;&#21253;&#21547;&#20102;&#27604;404&#38169;&#35823;&#39029;&#38754;&#26356;&#22810;&#30340;&#25935;&#24863;&#20449;&#24687;&#65292;&#25152;&#20197;&#36825;&#20010;&#39029;&#38754;&#32477;&#23545;&#19981;&#35201;&#20844;&#24320;&#26292;&#38706;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#31616;&#21333;&#30340;&#35828;&#65292;&#25226;`` DEBUG`` &#35774;&#32622;&#25104;`` True`` &#30456;&#24403;&#20110;&#21578;&#35785;Django&#20320;&#30340;&#32593;&#31449;&#21482;&#20250;&#34987;&#21487;&#20449;&#20219;&#30340;&#24320;&#21457;&#20154;&#21592;&#20351;&#29992;&#12290; Internet&#37324;&#20805;&#28385;&#20102;&#19981;&#21487;&#20449;&#36182;&#30340;&#20107;&#29289;&#65292;&#24403;&#20320;&#20934;&#22791;&#37096;&#32626;&#20320;&#30340;&#24212;&#29992;&#26102;&#65292;&#39318;&#35201;&#30340;&#20107;&#24773;&#23601;&#26159;&#25226;`` DEBUG`` &#35774;&#32622;&#20026;`` False`` &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn11&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#26469;&#20851;&#38381;&#27169;&#26495;Debug&#27169;&#24335;&#12290;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&#31867;&#20284;&#22320;&#65292;&#20320;&#24212;&#35813;&#22312;&#29983;&#20135;&#29615;&#22659;&#20013;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DEBUG&lt;/span&gt;&lt;/tt&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt; &#22914;&#26524;&#36825;&#20010;&#35774;&#20026;`` True`` &#65292;&#20026;&#20102;&#22312;&#37027;&#20010;&#22909;&#30475;&#30340;&#38169;&#35823;&#39029;&#38754;&#19978;&#26174;&#31034;&#36275;&#22815;&#30340;&#19996;&#35199;&#65292;Django&#30340;&#27169;&#29256;&#31995;&#32479;&#23601;&#20250;&#20026;&#27599;&#19968;&#20010;&#27169;&#29256;&#20445;&#23384;&#19968;&#20123;&#39069;&#22806;&#30340;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn13&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&#23454;&#29616;&#19968;&#20010;404&#27169;&#26495;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&#22914;&#26524;`` DEBUG`` &#35774;&#32622;&#20026;`` True`` &#65292;Django&#20250;&#26174;&#31034;&#37027;&#20010;&#33258;&#24102;&#30340;404&#38169;&#35823;&#39029;&#38754;&#12290; &#20294;&#22914;&#26524;`` DEBUG`` &#34987;&#35774;&#32622;&#25104;`` False`` &#65292;&#37027;&#23427;&#30340;&#34892;&#20026;&#23601;&#19981;&#19968;&#26679;&#20102;&#65306; &#20182;&#20250;&#26174;&#31034;&#19968;&#20010;&#22312;&#20320;&#30340;&#27169;&#29256;&#26681;&#30446;&#24405;&#20013;&#21517;&#23383;&#21483;`` 404.html`` &#30340;&#27169;&#29256; &#25152;&#20197;&#65292;&#24403;&#20320;&#20934;&#22791;&#37096;&#32626;&#20320;&#30340;&#24212;&#29992;&#26102;&#65292;&#20320;&#20250;&#38656;&#35201;&#21019;&#24314;&#36825;&#20010;&#27169;&#29256;&#24182;&#22312;&#37324;&#38754;&#25918;&#19968;&#20123;&#26377;&#24847;&#20041;&#30340;&#8220;&#39029;&#38754;&#26410;&#25214;&#21040;&#8221;&#30340;&#20449;&#24687;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#36825;&#37324;&#26377;&#19968;&#20010;`` 404.html``&#30340;&#31034;&#20363;&#65292;&#20320;&#21487;&#20197;&#20174;&#23427;&#24320;&#22987;&#12290; &#20551;&#23450;&#20320;&#20351;&#29992;&#30340;&#27169;&#26495;&#32487;&#25215;&#24182;&#23450;&#20041;&#19968;&#20010; `` base.html``,&#35813;&#39029;&#38754;&#30001;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;title&lt;/span&gt;&lt;/tt&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;content&lt;/span&gt;&lt;/tt&gt;&#20004;&#22359;&#32452;&#25104;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn17&quot;&gt;{% extends &quot;base.html&quot; %}

{% block title %}Page not found{% endblock %}

{% block content %}
&amp;lt;h1&amp;gt;Page not found&amp;lt;/h1&amp;gt;

&amp;lt;p&amp;gt;Sorry, but the requested page could not be found.&amp;lt;/p&amp;gt;
{% endblock %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#35201;&#27979;&#35797;&#20320;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;404.html&lt;/span&gt;&lt;/tt&gt;&#39029;&#38754;&#26159;&#21542;&#27491;&#24120;&#24037;&#20316;&#65292;&#20165;&#20165;&#38656;&#35201;&#23558;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DEBUG&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026;`` False`` &#65292;&#24182;&#19988;&#35775;&#38382;&#19968;&#20010;&#24182;&#19981;&#23384;&#22312;&#30340;URL&#12290; &#65288;&#23427;&#23558;&#22312;`` sunserver`` &#19978;&#24037;&#20316;&#30340;&#21644;&#24320;&#21457;&#26381;&#21153;&#22120;&#19978;&#19968;&#26679;&#22909;&#65289;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn19&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#23454;&#29616;&#19968;&#20010;500&#27169;&#26495;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#31867;&#20284;&#30340;&#65292;&#22914;&#26524;`` DEBUG`` &#35774;&#32622;&#20026;`` False`` &#65292;Djang&#19981;&#20877;&#20250;&#26174;&#31034;&#23427;&#33258;&#24102;&#30340;&#24212;&#23545;&#26410;&#22788;&#29702;&#30340;Python&#24322;&#24120;&#30340;&#38169;&#35823;&#21453;&#39304;&#39029;&#38754;&#12290; &#20316;&#20026;&#20195;&#26367;&#65292;&#23427;&#20250;&#26597;&#25214;&#19968;&#20010;&#21517;&#20026;`` 500.html`` &#30340;&#27169;&#26495;&#24182;&#19988;&#26174;&#31034;&#23427;&#12290; &#20687;`` 404.html`` &#19968;&#26679;&#65292;&#36825;&#20010;&#27169;&#26495;&#24212;&#35813;&#34987;&#25918;&#32622;&#22312;&#20320;&#30340;&#27169;&#26495;&#26681;&#30446;&#24405;&#19979;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#36825;&#37324;&#26377;&#19968;&#20010;&#20851;&#20110;500.html&#30340;&#27604;&#36739;&#26840;&#25163;&#30340;&#38382;&#39064;&#12290;&#20320;&#27704;&#36828;&#19981;&#33021;&#30830;&#23450;`` &#20026;&#20160;&#20040;``&#20250;&#26174;&#31034;&#36825;&#20010;&#27169;&#26495;&#65292;&#25152;&#20197;&#23427;&#19981;&#24212;&#35813;&#20570;&#20219;&#20309;&#38656;&#35201;&#36830;&#25509;&#25968;&#25454;&#24211;&#65292;&#25110;&#32773;&#20381;&#36182;&#20219;&#20309;&#21487;&#33021;&#34987;&#30772;&#22351;&#30340;&#22522;&#30784;&#26500;&#20214;&#30340;&#20107;&#24773;&#12290; &#65288;&#20363;&#22914;&#65306;&#23427;&#19981;&#24212;&#35813;&#20351;&#29992;&#33258;&#23450;&#20041;&#27169;&#26495;&#26631;&#31614;&#12290;&#65289;&#22914;&#26524;&#23427;&#29992;&#21040;&#20102;&#27169;&#26495;&#32487;&#25215;&#65292;&#37027;&#20040;&#29238;&#27169;&#26495;&#20063;&#23601;&#19981;&#24212;&#35813;&#20381;&#36182;&#21487;&#33021;&#34987;&#30772;&#22351;&#30340;&#22522;&#30784;&#26500;&#20214;&#12290;
&#22240;&#27492;&#65292;&#26368;&#22909;&#30340;&#26041;&#27861;&#23601;&#26159;&#36991;&#20813;&#27169;&#26495;&#32487;&#25215;&#65292;&#24182;&#19988;&#29992;&#19968;&#20123;&#38750;&#24120;&#31616;&#21333;&#30340;&#19996;&#35199;&#12290; &#36825;&#26159;&#19968;&#20010;`` 500.html`` &#30340;&#20363;&#23376;&#65292;&#21487;&#20197;&#25226;&#23427;&#20316;&#20026;&#19968;&#20010;&#36215;&#28857;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn23&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;
    &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&amp;gt;
&amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Page unavailable&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Page unavailable&amp;lt;/h1&amp;gt;

    &amp;lt;p&amp;gt;Sorry, but the requested page is unavailable due to a
    server hiccup.&amp;lt;/p&amp;gt;

    &amp;lt;p&amp;gt;Our engineers have been notified, so check back later.&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn24&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#35774;&#32622;&#38169;&#35823;&#35686;&#21578;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#24403;&#20320;&#20351;&#29992;Django&#21046;&#20316;&#30340;&#32593;&#31449;&#36816;&#34892;&#20013;&#20986;&#29616;&#20102;&#24322;&#24120;&#65292;&#20320;&#20250;&#24076;&#26395;&#21435;&#20102;&#35299;&#20197;&#20415;&#20110;&#20462;&#27491;&#23427;&#12290; &#40664;&#35748;&#24773;&#20917;&#19979;&#65292;Django&#22312;&#20320;&#30340;&#20195;&#30721;&#24341;&#21457;&#26410;&#22788;&#29702;&#30340;&#24322;&#24120;&#26102;&#65292;&#23558;&#20250;&#21457;&#36865;&#19968;&#23553;Email&#33267;&#24320;&#21457;&#32773;&#22242;&#38431;&#12290;&#20294;&#20320;&#38656;&#35201;&#21435;&#20570;&#20004;&#20214;&#20107;&#26469;&#35774;&#32622;&#36825;&#31181;&#34892;&#20026;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&#39318;&#20808;&#65292;&#25913;&#21464;&#20320;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ADMINS&lt;/span&gt;&lt;/tt&gt;&#35774;&#32622;&#29992;&#26469;&#24341;&#20837;&#20320;&#30340;E-mail&#22320;&#22336;&#65292;&#20197;&#21450;&#37027;&#20123;&#20219;&#20309;&#38656;&#35201;&#34987;&#27880;&#24847;&#30340;&#32852;&#31995;&#20154;&#30340;E-mail&#22320;&#22336;&#12290; &#36825;&#20010;&#35774;&#32622;&#37319;&#29992;&#20102;&#31867;&#20284;&#20110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;(&#22995;&#21517;,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Email)&lt;/span&gt;&lt;/tt&gt;&#20803;&#32452;&#65292;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn28&quot;&gt;ADMINS = (
    (&apos;John Lennon&apos;, &apos;jlennon@example.com&apos;),
    (&apos;Paul McCartney&apos;, &apos;pmacca@example.com&apos;),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#31532;&#20108;&#65292;&#30830;&#20445;&#20320;&#30340;&#26381;&#21153;&#22120;&#37197;&#32622;&#20026;&#21457;&#36865;&#30005;&#23376;&#37038;&#20214;&#12290; &#35774;&#32622;&#22909;postfix,sendmail&#25110;&#20854;&#20182;&#26412;&#20070;&#33539;&#22260;&#20043;&#22806;&#20294;&#26159;&#19982;Django&#35774;&#32622;&#30456;&#20851;&#30340;&#37038;&#20214;&#26381;&#21153;&#22120;,&#20320;&#38656;&#35201;&#23558;&#23558; EMAIL_HOST&#35774;&#32622;&#20026;&#20320;&#30340;&#37038;&#20214;&#26381;&#21153;&#22120;&#30340;&#27491;&#30830;&#30340;&#20027;&#26426;&#21517;. &#40664;&#35748;&#27169;&#24335;&#19979;&#26159;&#35774;&#32622;&#20026;&#8217;localhost&#8217;, &#36825;&#20010;&#35774;&#32622;&#23545;&#22823;&#22810;&#25968;&#30340;&#20849;&#20139;&#20027;&#26426;&#31995;&#32479;&#29615;&#22659;&#36866;&#29992;. &#21462;&#20915;&#20110;&#20320;&#30340;&#23433;&#25490;&#30340;&#22797;&#26434;&#24615;,&#20320;&#21487;&#33021;&#36824;&#38656;&#35201;&#35774;&#32622; EMAIL_HOST_USER,EMAIL_HOST_PASSWORD,EMAIL_PORT&#25110;EMAIL_USE_TLS&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#20320;&#36824;&#21487;&#20197;&#35774;&#32622;EMAIL_SUBJECT_PREFIX&#20197;&#25511;&#21046;Django&#20351;&#29992;&#30340; error e-mail&#30340;&#21069;&#32512;&#12290; &#40664;&#35748;&#24773;&#20917;&#19979;&#23427;&#34987;&#35774;&#32622;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;[Django]&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn31&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#35774;&#32622;&#36830;&#25509;&#20013;&#26029;&#35686;&#25253;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#22914;&#26524;&#20320;&#23433;&#35013;&#26377;CommonMiddleware(&#27604;&#22914;&#65292;&#20320;&#30340;MIDDLEWARE_CLASSES&#35774;&#32622;&#21253;&#21547;&#20102;&#8217;django.middleware.common.CommonMiddleware&#8217;&#30340;&#24773;&#20917;&#19979;&#65292;&#40664;&#35748;&#23601;&#23433;&#35013;&#20102;CommonMiddleware),&#20320;&#23601;&#20855;&#26377;&#20102;&#35774;&#32622;&#36825;&#20010;&#36873;&#39033;&#30340;&#33021;&#21147;&#65306;&#26377;&#20154;&#22312;&#35775;&#38382;&#20320;&#30340;Django&#32593;&#31449;&#30340;&#19968;&#20010;&#38750;&#31354;&#30340;&#38142;&#25509;&#32780;&#23548;&#33268;&#19968;&#20010;404&#38169;&#35823;&#30340;&#21457;&#29983;&#21644;&#36830;&#25509;&#20013;&#26029;&#30340;&#24773;&#20917;&#65292;&#20320;&#23558;&#25910;&#21040;&#19968;&#23553;&#37038;&#20214;. &#22914;&#26524;&#20320;&#24819;&#28608;&#27963;&#36825;&#20010;&#29305;&#24615;&#65292;&#35774;&#32622;SEND_BROKEN_LINK_EMAILS &#20026;True(&#40664;&#35748;&#20026;False),&#24182;&#35774;&#32622;&#20320;&#30340;MANAGERS&#20026;&#26576;&#20010;&#20154;&#25110;&#26576;&#20123;&#20154;&#30340;&#37038;&#20214;&#22320;&#22336;&#65292;&#36825;&#20123;&#37038;&#20214;&#22320;&#22336;&#23558;&#20250;&#25910;&#21040;&#25253;&#21578;&#36830;&#25509;&#20013;&#26029;&#38169;&#35823;&#30340;&#37038;&#20214;.
MANAGERS&#20351;&#29992;&#21644;ADMINS &#21516;&#26679;&#30340;&#35821;&#27861;.&#20363;&#22914;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn34&quot;&gt;MANAGERS = (
    (&apos;George Harrison&apos;, &apos;gharrison@example.com&apos;),
    (&apos;Ringo Starr&apos;, &apos;ringo@example.com&apos;),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#35831;&#27880;&#24847;&#65292;&#38169;&#35823;&#30340;Email&#20250;&#20196;&#20154;&#24863;&#21040;&#21453;&#24863;&#65292;&#23545;&#20110;&#20219;&#20309;&#20154;&#26469;&#35828;&#37117;&#26159;&#36825;&#26679;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn36&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&#20351;&#29992;&#38024;&#23545;&#20135;&#21697;&#30340;&#19981;&#21516;&#30340;&#35774;&#32622;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#22312;&#27492;&#20070;&#20013;&#65292;&#25105;&#20204;&#20165;&#20165;&#22788;&#29702;&#19968;&#20010;&#21333;&#19968;&#30340;&#35774;&#32622;&#25991;&#20214; settings.py&#25991;&#20214;&#30001;django-admin.py startproject&#21629;&#20196;&#29983;&#25104;&#12290;&#20294;&#26159;&#24403;&#20320;&#20934;&#22791;&#35201;&#36827;&#34892;&#37197;&#32622;&#30340;&#26102;&#20505;&#65292;&#20320;&#23558;&#21457;&#29616;&#20320;&#38656;&#35201;&#22810;&#20010;&#37197;&#32622;&#25991;&#20214;&#20197;&#20351;&#20320;&#30340;&#24320;&#21457;&#29615;&#22659;&#21644;&#20135;&#21697;&#29615;&#22659;&#30456;&#29420;&#31435;&#12290; &#27604;&#22914;&#65292;&#20320;&#21487;&#33021;&#19981;&#24819;&#27599;&#27425;&#22312;&#26412;&#22320;&#26426;&#22120;&#19978;&#27979;&#35797;&#20195;&#30721;&#25913;&#21464;&#30340;&#26102;&#20505;&#23558;DEBUG&#20174;False &#25913;&#20026;True&#12290;Django&#36890;&#36807;&#20351;&#29992;&#22810;&#20010;&#37197;&#32622;&#25991;&#20214;&#32780;&#20351;&#24471;&#36825;&#31181;&#24773;&#20917;&#24456;&#23481;&#26131;&#24471;&#21040;&#36991;&#20813;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#22914;&#26524;&#20320;&#24819;&#25226;&#20320;&#30340;&#37197;&#32622;&#25991;&#20214;&#25353;&#29031;&#20135;&#21697;&#35774;&#32622;&#21644;&#24320;&#21457;&#35774;&#32622;&#32452;&#32455;&#36215;&#26469;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;&#19979;&#38754;&#19977;&#31181;&#26041;&#27861;&#30340;&#20854;&#20013;&#19968;&#31181;&#36798;&#21040;&#36825;&#20010;&#30446;&#30340;&#12290;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn39&quot;&gt;&#35774;&#32622;&#25104;&#20004;&#20010;&#20840;&#38754;&#30340;&#65292;&#24444;&#27492;&#29420;&#31435;&#30340;&#37197;&#32622;&#25991;&#20214;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn40&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn40&quot;&gt;&#35774;&#32622;&#19968;&#20010;&#22522;&#26412;&#30340;&#37197;&#32622;&#25991;&#20214;&#65288;&#27604;&#22914;&#65292;&#20026;&#20102;&#24320;&#21457;)&#21644;&#31532;&#20108;&#20010;&#65288;&#20026;&#20102;&#20135;&#21697;)&#37197;&#32622;&#25991;&#20214;&#65292;&#31532;&#20108;&#20010;&#37197;&#32622;&#25991;&#20214;&#20165;&#20165;&#20174;&#22522;&#26412;&#30340;&#37027;&#20010;&#37197;&#32622;&#25991;&#20214;&#23548;&#20837;&#37197;&#32622;&#65292;&#24182;&#23545;&#38656;&#35201;&#23450;&#20041;&#30340;&#36827;&#34892;&#22797;&#20889;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn41&quot;&gt;&#20351;&#29992;&#19968;&#20010;&#21333;&#29420;&#30340;&#37197;&#32622;&#25991;&#20214;&#65292;&#27492;&#37197;&#32622;&#25991;&#20214;&#21253;&#21547;&#19968;&#20010;Python&#30340;&#36923;&#36753;&#21028;&#26029;&#26681;&#25454;&#19978;&#19979;&#25991;&#29615;&#22659;&#25913;&#21464;&#35774;&#32622;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#25105;&#20204;&#23558;&#20250;&#22312;&#20381;&#27425;&#35299;&#37322;&#36825;&#20960;&#31181;&#26041;&#24335;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&#39318;&#20808;&#65292;&#26368;&#22522;&#26412;&#30340;&#26041;&#27861;&#26159;&#23450;&#20041;&#20004;&#20010;&#21333;&#29420;&#30340;&#37197;&#32622;&#25991;&#20214;&#12290; &#22914;&#26524;&#20320;&#26159;&#36319;&#38543;&#20043;&#21069;&#30340;&#20363;&#23376;&#20570;&#19979;&#26469;&#30340;&#65292;&#37027;&#20040;&#20320;&#24050;&#32463;&#26377;&#20102;&#19968;&#20010;settings.py&#20102;&#65292;&#29616;&#22312;&#20320;&#21482;&#38656;&#35201;&#23558;&#23427;&#22797;&#21046;&#19968;&#20221;&#24182;&#21629;&#21517;&#20026;settings_production.py&#65288;&#25991;&#20214;&#21517;&#21487;&#20197;&#25353;&#29031;&#20320;&#33258;&#24049;&#30340;&#21916;&#22909;&#23450;&#20041;),&#22312;&#36825;&#20010;&#26032;&#25991;&#20214;&#20013;&#25913;&#21464;DEBUG&#31561;&#35774;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#31532;&#20108;&#31181;&#26041;&#27861;&#27604;&#36739;&#31867;&#20284;&#65292;&#20294;&#26159;&#20943;&#23569;&#20102;&#35768;&#22810;&#20887;&#20313;&#12290; &#20316;&#20026;&#20351;&#29992;&#20004;&#20010;&#20869;&#23481;&#22823;&#37096;&#20998;&#30456;&#21516;&#30340;&#37197;&#32622;&#25991;&#20214;&#30340;&#26367;&#20195;&#26041;&#24335;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#19968;&#20010;&#25991;&#20214;&#20026;&#22522;&#26412;&#25991;&#20214;&#65292;&#21478;&#22806;&#19968;&#20010;&#25991;&#20214;&#20174;&#22522;&#26412;&#25991;&#20214;&#20013;&#23548;&#20837;&#30456;&#20851;&#35774;&#23450;&#12290; &#20363;&#22914;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn46&quot;&gt;# settings.py

DEBUG = True
TEMPLATE_DEBUG = DEBUG

DATABASE_ENGINE = &apos;postgresql_psycopg2&apos;
DATABASE_NAME = &apos;devdb&apos;
DATABASE_USER = &apos;&apos;
DATABASE_PASSWORD = &apos;&apos;
DATABASE_PORT = &apos;&apos;

# ...

# settings_production.py

from settings import *

DEBUG = TEMPLATE_DEBUG = False
DATABASE_NAME = &apos;production&apos;
DATABASE_USER = &apos;app&apos;
DATABASE_PASSWORD = &apos;letmein&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#27492;&#22788;&#65292;settings_production.py &#20174;settings.py &#23548;&#20837;&#25152;&#26377;&#30340;&#35774;&#23450;&#65292;&#20165;&#20165;&#21482;&#26159;&#37325;&#26032;&#23450;&#20041;&#20102;&#20135;&#21697;&#27169;&#24335;&#19979;&#38656;&#35201;&#29305;&#27530;&#22788;&#29702;&#30340;&#35774;&#32622;&#12290; &#22312;&#36825;&#20010;&#26696;&#20363;&#20013;&#65292;DEBUG &#34987;&#35774;&#32622;&#20026;False&#65292;&#20294;&#26159;&#25105;&#20204;&#24050;&#32463;&#23545;&#20135;&#21697;&#27169;&#24335;&#35774;&#32622;&#20102;&#19981;&#21516;&#30340;&#25968;&#25454;&#24211;&#35775;&#38382;&#21442;&#25968;&#12290; &#65288;&#21518;&#32773;&#23558;&#21521;&#20320;&#28436;&#31034;&#20320;&#21487;&#20197;&#37325;&#26032;&#23450;&#20041; &#20219;&#20309; &#35774;&#32622;&#65292;&#24182;&#19981;&#21482;&#26159;&#35937; DEBUG &#36825;&#26679;&#30340;&#22522;&#26412;&#35774;&#32622;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#26368;&#32456;&#65292;&#26368;&#31934;&#31616;&#30340;&#36798;&#21040;&#20004;&#20010;&#37197;&#32622;&#29615;&#22659;&#35774;&#23450;&#30340;&#26041;&#26696;&#26159;&#20351;&#29992;&#19968;&#20010;&#37197;&#32622;&#25991;&#20214;&#65292;&#22312;&#27492;&#37197;&#32622;&#25991;&#20214;&#20013;&#26681;&#25454;&#19981;&#21516;&#30340;&#29615;&#22659;&#36827;&#34892;&#35774;&#32622;&#12290; &#19968;&#20010;&#36798;&#21040;&#36825;&#20010;&#30446;&#30340;&#30340;&#26041;&#27861;&#26159;&#26816;&#26597;&#24403;&#21069;&#30340;&#20027;&#26426;&#21517;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn50&quot;&gt;# settings.py

import socket

if socket.gethostname() == &apos;my-laptop&apos;:
    DEBUG = TEMPLATE_DEBUG = True
else:
    DEBUG = TEMPLATE_DEBUG = False

# ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&#22312;&#36825;&#37324;&#65292;&#25105;&#20204;&#20174;python&#26631;&#20934;&#24211;&#23548;&#20837;&#20102;socket &#27169;&#22359;&#65292;&#20351;&#29992;&#23427;&#26469;&#26816;&#26597;&#24403;&#21069;&#31995;&#32479;&#30340;&#20027;&#26426;&#21517;&#12290; &#25105;&#20204;&#21487;&#20197;&#36890;&#36807;&#26816;&#26597;&#20027;&#26426;&#21517;&#26469;&#30830;&#35748;&#20195;&#30721;&#26159;&#21542;&#36816;&#34892;&#22312;&#20135;&#21697;&#26381;&#21153;&#22120;&#19978;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#19968;&#20010;&#20851;&#38190;&#26159;&#37197;&#32622;&#25991;&#20214;&#20165;&#20165;&#26159;&#21253;&#21547;python&#20195;&#30721;&#30340;&#25991;&#20214;&#12290;&#20320;&#21487;&#20197;&#20174;&#20854;&#20182;&#25991;&#20214;&#23548;&#20837;&#36825;&#20123;python&#20195;&#30721;&#65292;&#21487;&#20197;&#36890;&#36807;&#36825;&#20123;&#20195;&#30721;&#25191;&#34892;&#20219;&#24847;&#30340;&#36923;&#36753;&#21028;&#26029;&#31561;&#25805;&#20316;&#12290; &#22914;&#26524;&#20320;&#25171;&#31639;&#25353;&#29031;&#36825;&#31181;&#26041;&#26696;&#36208;&#19979;&#21435;&#65292;&#35831;&#30830;&#23450;&#36825;&#20123;&#37197;&#32622;&#25991;&#20214;&#20013;&#30340;&#20195;&#30721;&#26159;&#36275;&#22815;&#23433;&#20840;&#65288;&#38450;&#24377;)&#30340;&#12290; &#22914;&#26524;&#36825;&#20010;&#37197;&#32622;&#25991;&#20214;&#25243;&#20986;&#20219;&#20309;&#30340;&#24322;&#24120;&#65292;Django&#37117;&#26377;&#21487;&#33021;&#20250;&#21457;&#29983;&#24456;&#20005;&#37325;&#30340;&#23849;&#28291;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#37325;&#21629;&#21517;settings.py&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&#38543;&#20415;&#23558;&#20320;&#30340;settings.py&#37325;&#21629;&#21517;&#20026;settings_dev.py&#25110;settings/dev.py&#25110;foobar.py&#65292;Django &#24182;&#19981;&#22312;&#20046;&#20320;&#30340;&#37197;&#32622;&#25991;&#20214;&#21462;&#20160;&#20040;&#21517;&#23383;&#65292;&#21482;&#35201;&#20320;&#21578;&#35785;&#23427;&#20320;&#20351;&#29992;&#30340;&#21738;&#20010;&#37197;&#32622;&#25991;&#20214;&#23601;&#21487;&#20197;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#20294;&#26159;&#22914;&#26524;&#20320;&#30495;&#30340;&#37325;&#21629;&#21517;&#20102;&#30001;django-admin.py startproject &#21629;&#20196;&#21019;&#24314;&#30340;settings.py&#25991;&#20214;&#65292;&#20320;&#20250;&#21457;&#29616;manage.py&#20250;&#32473;&#20986;&#19968;&#20010;&#38169;&#35823;&#20449;&#24687;&#35828;&#25214;&#19981;&#21040;&#37197;&#32622;&#25991;&#20214;&#12290; &#37027;&#26159;&#30001;&#20110;&#23427;&#23581;&#35797;&#20174;&#36825;&#20010;&#25991;&#20214;&#20013;&#23548;&#20837;&#19968;&#20010;&#21483;&#20570;settings&#30340;&#27169;&#22359;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;&#20462;&#25913;manage.py &#25991;&#20214;&#65292;&#23558; import settings &#35821;&#21477;&#25913;&#20026;&#23548;&#20837;&#20320;&#33258;&#24049;&#30340;&#27169;&#22359;&#65292;&#25110;&#32773;&#20351;&#29992;django-admin.py&#32780;&#19981;&#26159;&#20351;&#29992;manage.py,&#22312;&#21518;&#19968;&#31181;&#26041;&#24335;&#20013;&#20320;&#38656;&#35201;&#35774;&#32622; DJANGO_SETTINGS_MODULE &#29615;&#22659;&#21464;&#37327;&#20026;&#20320;&#30340;&#37197;&#32622;&#25991;&#20214;&#25152;&#22312;&#30340;python &#36335;&#24452;.(&#27604;&#22914;&#8217;mysite.settings&#8217;&#65289;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django-settings-module&quot;&gt;
&lt;span id=&quot;cn56&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn56&quot;&gt;DJANGO_SETTINGS_MODULE&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#36890;&#36807;&#36825;&#31181;&#26041;&#24335;&#30340;&#20195;&#30721;&#25913;&#21464;&#21518;&#65292;&#26412;&#31456;&#30340;&#19979;&#19968;&#37096;&#20998;&#23558;&#38598;&#20013;&#22312;&#23545;&#20855;&#20307;&#29615;&#22659;(&#27604;&#22914;Apache)&#30340;&#21457;&#24067;&#25152;&#38656;&#35201;&#30340;&#25351;&#20196;&#19978;&#12290; &#36825;&#20123;&#25351;&#20196;&#38024;&#23545;&#27599;&#19968;&#31181;&#29615;&#22659;&#37117;&#19981;&#21516;&#65292;&#20294;&#26159;&#26377;&#19968;&#20214;&#20107;&#24773;&#26159;&#30456;&#21516;&#30340;&#12290; &#22312;&#27599;&#19968;&#31181;&#29615;&#22659;&#20013;&#65292;&#20320;&#37117;&#38656;&#35201;&#21578;&#35785;Web&#26381;&#21153;&#22120;&#20320;&#30340;DJANGO_SETTINGS_MODULE&#26159;&#20160;&#20040;,&#36825;&#26159;&#20320;&#30340;Django&#24212;&#29992;&#31243;&#24207;&#30340;&#36827;&#20837;&#28857;&#12290; DJANGO_SETTINGS_MODULE&#25351;&#21521;&#20320;&#30340;&#37197;&#32622;&#25991;&#20214;&#65292;&#22312;&#20320;&#30340;&#37197;&#32622;&#25991;&#20214;&#20013;&#25351;&#21521;&#20320;&#30340;ROOT_URLCONF,&#22312;ROOT_URLCONF&#20013;&#25351;&#21521;&#20102;&#20320;&#30340;&#35270;&#22270;&#20197;&#21450;&#20854;&#20182;&#30340;&#37096;&#20998;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn58&quot;&gt;DJANGO_SETTINGS_MODULE&#26159;&#20320;&#30340;&#37197;&#32622;&#25991;&#20214;&#30340;python&#30340;&#36335;&#24452; &#27604;&#22914;&#65292;&#20551;&#35774;mysite&#26159;&#22312;&#20320;&#30340;Python&#36335;&#24452;&#20013;&#65292;DJANGO_SETTINGS_MODULE&#23545;&#20110;&#25105;&#20204;&#27491;&#22312;&#36827;&#34892;&#30340;&#20363;&#23376;&#23601;&#26159;&#8217;mysite.settings&#8217;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;apache-mod-python-django&quot;&gt;
&lt;span id=&quot;cn59&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#29992;Apache&#21644;mod_python&#26469;&#37096;&#32626;Django&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#30446;&#21069;&#65292;Apache&#21644;mod_python&#26159;&#22312;&#29983;&#20135;&#26381;&#21153;&#22120;&#19978;&#37096;&#32626;Django&#30340;&#26368;&#20581;&#22766;&#25645;&#37197;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;mod_python (&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/mod_python/&quot;&gt;http://www.djangoproject.com/r/mod_python/&lt;/a&gt;)&#26159;&#19968;&#20010;&#22312;Apache&#20013;&#23884;&#20837;Python&#30340;Apache&#25554;&#20214;&#65292;&#23427;&#22312;&#26381;&#21153;&#22120;&#21551;&#21160;&#26102;&#23558;Python&#20195;&#30721;&#21152;&#36733;&#21040;&#20869;&#23384;&#20013;&#12290;
(&#35793;&#27880;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;Django &#38656;&#35201;Apaceh 2.x &#21644;mod_python 3.x&#25903;&#25345;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#22791;&#27880;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#22914;&#20309;&#37197;&#32622;Apache&#36229;&#20986;&#20102;&#26412;&#20070;&#30340;&#33539;&#22260;&#65292;&#22240;&#27492;&#19979;&#38754;&#23558;&#21482;&#31616;&#21333;&#20171;&#32461;&#24517;&#35201;&#30340;&#32454;&#33410;&#12290; &#24184;&#36816;&#30340;&#26159;&#65292;&#22914;&#26524;&#38656;&#35201;&#36827;&#19968;&#27493;&#23398;&#20064;Apache&#30340;&#30456;&#20851;&#30693;&#35782;&#65292;&#21487;&#20197;&#25214;&#21040;&#30456;&#24403;&#22810;&#30340;&#32477;&#20339;&#36164;&#28304;&#12290; &#25105;&#20204;&#21916;&#27426;&#21435;&#30340;&#20960;&#20010;&#22320;&#26041;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn65&quot;&gt;&#24320;&#28304;&#30340;Apache&#22312;&#32447;&#25991;&#26723;&#65292;&#20301;&#20110; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/apache/docs/&quot;&gt;http://www.djangoproject.com/r/apache/docs/&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn66&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn66&quot;&gt;&lt;em&gt;Pro Apache&#65292;&#31532;&#19977;&#29256;&lt;/em&gt; (Apress, 2004),&#20316;&#32773;Peter Wainwright, &#20301;&#20110; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/books/pro-apache/&quot;&gt;http://www.djangoproject.com/r/books/pro-apache/&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn67&quot;&gt;&lt;em&gt;Apache: The Definitive Guide, &#31532;&#19977;&#29256;&lt;/em&gt; (OReilly, 2002),&#20316;&#32773;Ben Laurie&#21644;Peter Laurie, &#20301;&#20110; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/books/apache-pra/&quot;&gt;http://www.djangoproject.com/r/books/apache-pra/&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn68&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#22522;&#26412;&#37197;&#32622;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#20026;&#20102;&#37197;&#32622;&#22522;&#20110; mod_python &#30340; Django&#65292;&#39318;&#20808;&#35201;&#23433;&#35013;&#26377;&#21487;&#29992;&#30340; mod_python &#27169;&#22359;&#30340; Apache&#12290; &#36825;&#36890;&#24120;&#24847;&#21619;&#30528;&#24212;&#35813;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LoadModule&lt;/span&gt;&lt;/tt&gt; &#25351;&#20196;&#22312; Apache &#37197;&#32622;&#25991;&#20214;&#20013;&#12290; &#23427;&#30475;&#36215;&#26469;&#23601;&#20687;&#26159;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn71&quot;&gt;LoadModule python_module /usr/lib/apache2/modules/mod_python.so
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;Then, edit your Apache configuration file and add a &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;Location&amp;gt;&lt;/span&gt;&lt;/tt&gt; directive that ties
a specific URL path to a specific Django installation. &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn74&quot;&gt;&amp;lt;Location &quot;/&quot;&amp;gt;
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonDebug Off
&amp;lt;/Location&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#35201;&#30830;&#20445;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DJANGO_SETTINGS_MODULE&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.settings&lt;/span&gt;&lt;/tt&gt; &#39033;&#30446;&#25442;&#25104;&#19982;&#20320;&#30340;&#31449;&#28857;&#30456;&#24212;&#30340;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#23427;&#21578;&#35785; Apache&#65292;&#20219;&#20309;&#22312; / &#36825;&#20010;&#36335;&#24452;&#20043;&#21518;&#30340; URL &#37117;&#20351;&#29992; Django &#30340; mod_python &#26469;&#22788;&#29702;&#12290; &#23427; &#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DJANGO_SETTINGS_MODULE&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#20256;&#36882;&#36807;&#21435;&#65292;&#20351;&#24471; mod_python &#30693;&#36947;&#36825;&#26102;&#24212;&#35813;&#20351;&#29992;&#21738;&#20010;&#37197;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#27880;&#24847;&#36825;&#37324;&#20351;&#29992; &lt;a href=&quot;#id9&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id10&quot;&gt;``&lt;/span&gt;&lt;/a&gt;`` &#25351;&#20196;&#32780;&#19981;&#26159; &lt;a href=&quot;#id11&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id12&quot;&gt;``&lt;/span&gt;&lt;/a&gt;`` &#12290;
&#21518;&#32773;&#29992;&#20110;&#25351;&#21521;&#20320;&#30340;&#25991;&#20214;&#31995;&#32479;&#20013;&#30340;&#19968;&#20010;&#20301;&#32622;&#65292;&#28982;&#32780; &lt;a href=&quot;#id13&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id14&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;#id15&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id16&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id9&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 403); &lt;em&gt;&lt;a href=&quot;#id10&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id11&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 403); &lt;em&gt;&lt;a href=&quot;#id12&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id13&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 403); &lt;em&gt;&lt;a href=&quot;#id14&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id15&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 403); &lt;em&gt;&lt;a href=&quot;#id16&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;system-message&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: ERROR/3 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 405)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;Unexpected indentation.&lt;/p&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#25351;&#21521;&#19968;&#20010; Web &#31449;&#28857;&#30340; URL &#20301;&#32622;&#12290; &lt;a href=&quot;#id17&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id18&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;#id19&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id20&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id17&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 405); &lt;em&gt;&lt;a href=&quot;#id18&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id19&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 405); &lt;em&gt;&lt;a href=&quot;#id20&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;Apache &#21487;&#33021;&#19981;&#20294;&#20250;&#36816;&#34892;&#22312;&#20320;&#27491;&#24120;&#30331;&#24405;&#30340;&#29615;&#22659;&#20013;&#65292;&#20063;&#20250;&#36816;&#34892;&#22312;&#20854;&#23427;&#19981;&#21516;&#30340;&#29992;&#25143;&#29615;&#22659;&#20013;&#65307;&#20063;&#21487;&#33021;&#20250;&#26377;&#19981;&#21516;&#30340;&#25991;&#20214;&#36335;&#24452;&#25110; sys.path&#12290; &#20320;&#38656;&#35201;&#21578;&#35785; mod_python &#22914;&#20309;&#21435;&#23547;&#25214;&#20320;&#30340;&#39033;&#30446;&#21450; Django &#30340;&#20301;&#32622;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn80&quot;&gt;PythonPath &quot;[&apos;/path/to/project&apos;, &apos;/path/to/django&apos;] + sys.path&quot;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#20320;&#20063;&#21487;&#20197;&#21152;&#20837;&#19968;&#20123;&#20854;&#23427;&#25351;&#20196;&#65292;&#27604;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PythonAutoReload&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Off&lt;/span&gt;&lt;/tt&gt; &#20197;&#25552;&#21319;&#24615;&#33021;&#12290; &#26597;&#30475; mod_python &#25991;&#26723;&#33719;&#24471;&#35814;&#32454;&#30340;&#25351;&#20196;&#21015;&#34920;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&#27880;&#24847;&#65292;&#20320;&#24212;&#35813;&#22312;&#25104;&#21697;&#26381;&#21153;&#22120;&#19978;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PythonDebug&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Off&lt;/span&gt;&lt;/tt&gt; &#12290;&#22914;&#26524;&#20320;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PythonDebug&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;On&lt;/span&gt;&lt;/tt&gt; &#30340;&#35805;&#65292;&#22312;&#31243;&#24207;&#20135;&#29983;&#38169;&#35823;&#26102;&#65292;&#20320;&#30340;&#29992;&#25143;&#20250;&#30475;&#21040;&#38590;&#30475;&#30340;&#65288;&#24182;&#19988;&#26159;&#26292;&#38706;&#30340;&#65289; Python &#22238;&#28335;&#20449;&#24687;&#12290; &#22914;&#26524;&#20320;&#25226; PythonDebug &#32622; On,&#24403;mod_python&#20986;&#29616;&#26576;&#20123;&#38169;&#35823;,&#20320;&#30340;&#29992;&#25143;&#20250;&#30475;&#21040;&#19985;&#38475;&#30340;&#65288;&#20063;&#20250;&#26292;&#38706;&#26576;&#20123;&#20449;&#24687;)Python&#30340;&#23545;&#38169;&#35823;&#30340;&#36861;&#36394;&#30340;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#37325;&#21551; Apache &#20043;&#21518;&#25152;&#26377;&#23545;&#20320;&#30340;&#31449;&#28857;&#30340;&#35831;&#27714;&#65288;&#25110;&#32773;&#26159;&#24403;&#20320;&#29992;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;VirtualHost&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#25351;&#20196;&#21518;&#21017;&#26159;&#34394;&#25311;&#20027;&#26426;&#65289;&#37117;&#20250;&#30001; Djanog &#26469;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;apache-django&quot;&gt;
&lt;span id=&quot;cn84&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#22312;&#21516;&#19968;&#20010; Apache &#30340;&#23454;&#20363;&#20013;&#36816;&#34892;&#22810;&#20010; Django &#31243;&#24207;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&#22312;&#21516;&#19968;&#20010; Apache &#23454;&#20363;&#20013;&#36816;&#34892;&#22810;&#20010; Django &#31243;&#24207;&#26159;&#23436;&#20840;&#21487;&#33021;&#30340;&#12290; &#24403;&#20320;&#26159;&#19968;&#20010;&#29420;&#31435;&#30340; Web &#24320;&#21457;&#20154;&#21592;&#24182;&#26377;&#22810;&#20010;&#19981;&#21516;&#30340;&#23458;&#25143;&#26102;&#65292;&#20320;&#21487;&#33021;&#20250;&#24819;&#36825;&#20040;&#20570;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#21482;&#35201;&#20687;&#19979;&#38754;&#36825;&#26679;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;VirtualHost&lt;/span&gt;&lt;/tt&gt; &#20320;&#21487;&#20197;&#23454;&#29616;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn88&quot;&gt;NameVirtualHost *

&amp;lt;VirtualHost *&amp;gt;
    ServerName www.example.com
    # ...
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
&amp;lt;/VirtualHost&amp;gt;

&amp;lt;VirtualHost *&amp;gt;
    ServerName www2.example.com
    # ...
    SetEnv DJANGO_SETTINGS_MODULE mysite.other_settings
&amp;lt;/VirtualHost&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#22914;&#26524;&#20320;&#38656;&#35201;&#22312;&#21516;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;VirtualHost&lt;/span&gt;&lt;/tt&gt; &#20013;&#36816;&#34892;&#20004;&#20010; Django &#31243;&#24207;&#65292;&#20320;&#38656;&#35201;&#29305;&#21035;&#30041;&#24847;&#19968;&#19979;&#20197; &#30830;&#20445; mod_python &#30340;&#20195;&#30721;&#32531;&#23384;&#19981;&#34987;&#24324;&#24471;&#20081;&#19971;&#20843;&#31967;&#12290; &#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PythonInterpreter&lt;/span&gt;&lt;/tt&gt; &#25351;&#20196;&#26469;&#23558;&#19981; &#21516;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;Location&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#25351;&#20196;&#20998;&#21035;&#35299;&#37322;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn91&quot;&gt;&amp;lt;VirtualHost *&amp;gt;
    ServerName www.example.com
    # ...
    &amp;lt;Location &quot;/something&quot;&amp;gt;
        SetEnv DJANGO_SETTINGS_MODULE mysite.settings
        PythonInterpreter mysite
    &amp;lt;/Location&amp;gt;

    &amp;lt;Location &quot;/otherthing&quot;&amp;gt;
        SetEnv DJANGO_SETTINGS_MODULE mysite.other_settings
        PythonInterpreter mysite_other
    &amp;lt;/Location&amp;gt;
&amp;lt;/VirtualHost&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#36825;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PythonInterpreter&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#20540;&#19981;&#37325;&#35201;&#65292;&#21482;&#35201;&#23427;&#20204;&#22312;&#20004;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Location&lt;/span&gt;&lt;/tt&gt; &#22359;&#20013;&#19981;&#21516;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;mod-python&quot;&gt;
&lt;span id=&quot;cn93&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&#29992; mod_python &#36816;&#34892;&#19968;&#20010;&#24320;&#21457;&#26381;&#21153;&#22120;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&#22240;&#20026; mod_python &#32531;&#23384;&#39044;&#36733;&#20837;&#20102; Python &#30340;&#20195;&#30721;&#65292;&#24403;&#22312; mod_python &#19978;&#21457;&#24067; Django &#31449;&#28857;&#26102;&#65292;&#20320;&#27599; &#25913;&#21160;&#20102;&#19968;&#27425;&#20195;&#30721;&#37117;&#35201;&#38656;&#35201;&#37325;&#21551; Apache &#19968;&#27425;&#12290; &#36825;&#36824;&#30495;&#26159;&#20214;&#40635;&#28902;&#20107;&#65292;&#25152;&#20197;&#36825;&#26377;&#20010;&#21150;&#27861;&#26469;&#36991;&#20813;&#23427;&#65306; &#21482;&#35201; &#21152;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MaxRequestsPerChild&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;1&lt;/span&gt;&lt;/tt&gt; &#21040;&#37197;&#32622;&#25991;&#20214;&#20013;&#24378;&#21046; Apache &#22312;&#27599;&#20010;&#35831;&#27714;&#26102;&#37117;&#37325;&#26032;&#36733;&#20837;&#25152;&#26377;&#30340; &#20195;&#30721;&#12290; &#20294;&#26159;&#19981;&#35201;&#22312;&#20135;&#21697;&#26381;&#21153;&#22120;&#19978;&#20351;&#29992;&#36825;&#20010;&#25351;&#20196;&#65292;&#36825;&#20250;&#25764;&#38144; Django &#30340;&#29305;&#26435;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#22914;&#26524;&#20320;&#26159;&#19968;&#20010;&#29992;&#20998;&#25955;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;print&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#65288;&#25105;&#20204;&#23601;&#26159;&#36825;&#26679;&#65289;&#26469;&#35843;&#35797;&#30340;&#31243;&#24207;&#21592;&#65292;&#27880;&#24847;&#36825; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;print&lt;/span&gt;&lt;/tt&gt; &#35821; &#21477;&#22312; mod_python &#20013;&#26159;&#26080;&#25928;&#30340;&#65307;&#23427;&#19981;&#20250;&#20687;&#20320;&#24076;&#26395;&#30340;&#37027;&#26679;&#20135;&#29983;&#19968;&#20010; Apache &#26085;&#24535;&#12290; &#22914;&#26524;&#20320;&#38656;&#35201;&#22312; mod_python &#20013;&#25171;&#21360;&#35843;&#35797;&#20449;&#24687;&#65292;&#21487;&#33021;&#38656;&#35201;&#29992;&#21040; Python &#26631;&#20934;&#26085;&#24535;&#21253;&#65288;Pythons standard logging package&#65289;&#12290; &#26356;&#22810;&#30340;&#20449;&#24687;&#35831;&#21442;&#35265; &lt;a class=&quot;reference external&quot; href=&quot;http://docs.python.org/lib/module-logging.html&quot;&gt;http://docs.python.org/lib/module-logging.html&lt;/a&gt; &#12290;&#21478;&#19968;&#20010;&#36873;&#25321;&#26159;&#22312;&#27169;&#26495;&#39029;&#38754;&#20013;&#21152;&#20837;&#35843;&#35797;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;apache-django-media&quot;&gt;
&lt;span id=&quot;cn96&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#20351;&#29992;&#30456;&#21516;&#30340;Apache&#23454;&#20363;&#26469;&#26381;&#21153;Django&#21644;Media&#25991;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;Django&#26412;&#36523;&#19981;&#29992;&#26469;&#26381;&#21153;media&#25991;&#20214;&#65307;&#24212;&#35813;&#25226;&#36825;&#39033;&#24037;&#20316;&#30041;&#32473;&#20320;&#36873;&#25321;&#30340;&#32593;&#32476;&#26381;&#21153;&#22120;&#12290; &#25105;&#20204;&#25512;&#33616;&#20351;&#29992;&#19968;&#20010;&#21333;&#29420;&#30340;&#32593;&#32476;&#26381;&#21153;&#22120;&#65288;&#21363;&#27809;&#26377;&#36816;&#34892;Django&#30340;&#19968;&#20010;&#65289;&#26469;&#26381;&#21153;media&#12290; &#24819;&#20102;&#35299;&#26356;&#22810;&#20449;&#24687;&#65292;&#30475;&#19979;&#38754;&#30340;&#31456;&#33410;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#19981;&#36807;&#65292;&#22914;&#26524;&#20320;&#27809;&#26377;&#20854;&#20182;&#36873;&#25321;&#65292;&#25152;&#20197;&#21482;&#33021;&#22312;&#21516;Django&#19968;&#26679;&#30340;Apache &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;VirtualHost&lt;/span&gt;&lt;/tt&gt; &#19978;&#26381;&#21153;media&#25991;&#20214;&#65292;&#36825;&#37324;&#20320;&#21487;&#20197;&#38024;&#23545;&#36825;&#20010;&#31449;&#28857;&#30340;&#29305;&#23450;&#37096;&#20998;&#20851;&#38381;mod_python&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn100&quot;&gt;&amp;lt;Location &quot;/media/&quot;&amp;gt;
    SetHandler None
&amp;lt;/Location&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Location&lt;/span&gt;&lt;/tt&gt; &#25913;&#25104;&#20320;&#30340;media&#25991;&#20214;&#25152;&#22788;&#30340;&#26681;&#30446;&#24405;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn102&quot;&gt;&#20320;&#20063;&#21487;&#20197;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;LocationMatch&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#26469;&#21305;&#37197;&#27491;&#21017;&#34920;&#36798;&#24335;&#12290; &#27604;&#22914;&#65292;&#19979;&#38754;&#30340;&#20889;&#27861;&#23558;Django&#23450;&#20041;&#21040;&#32593;&#31449;&#30340;&#26681;&#30446;&#24405;&#65292;&#24182;&#19988;&#26174;&#24335;&#22320;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;media&lt;/span&gt;&lt;/tt&gt; &#23376;&#30446;&#24405;&#20197;&#21450;&#20219;&#20309;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.jpg&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.gif&lt;/span&gt;&lt;/tt&gt; &#65292; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.png&lt;/span&gt;&lt;/tt&gt; &#32467;&#23614;&#30340;URL&#23631;&#34109;&#25481;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn104&quot;&gt;&amp;lt;Location &quot;/&quot;&amp;gt;
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
&amp;lt;/Location&amp;gt;

&amp;lt;Location &quot;/media/&quot;&amp;gt;
    SetHandler None
&amp;lt;/Location&amp;gt;

&amp;lt;LocationMatch &quot;\.(jpg|gif|png)$&quot;&amp;gt;
    SetHandler None
&amp;lt;/LocationMatch&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&#22312;&#25152;&#26377;&#36825;&#20123;&#20363;&#23376;&#20013;&#65292;&#20320;&#24517;&#39035;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DocumentRoot&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#26679;apache&#25165;&#33021;&#30693;&#36947;&#20320;&#23384;&#25918;&#38745;&#24577;&#25991;&#20214;&#30340;&#20301;&#32622;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id21&quot;&gt;
&lt;span id=&quot;cn106&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#38169;&#35823;&#22788;&#29702;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#24403;&#20320;&#20351;&#29992; Apache/mod_python &#26102;&#65292;&#38169;&#35823;&#20250;&#34987; Django &#25429;&#25417;&#65292;&#23427;&#20204;&#19981;&#20250;&#20256;&#25773;&#21040; Apache &#37027;&#37324;&#65292;&#20063;&#19981;&#20250;&#20986;&#29616;&#22312; Apache &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#38169;&#35823;&#26085;&#24535;&lt;/span&gt;&lt;/tt&gt; &#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&#38500;&#38750;&#20320;&#30340; Django &#35774;&#32622;&#30340;&#30830;&#20986;&#20102;&#38382;&#39064;&#12290; &#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#20320;&#20250;&#22312;&#27983;&#35272;&#22120;&#19978;&#30475;&#21040;&#19968;&#20010; &#20869;&#37096;&#26381;&#21153;&#22120;&#38169;&#35823;&#30340;&#39029;&#38754;&#65292;&#24182;&#22312; Apache &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#38169;&#35823;&#26085;&#24535;&lt;/span&gt;&lt;/tt&gt; &#20013;&#30475;&#21040; Python &#30340;&#23436;&#25972;&#22238;&#28335;&#20449;&#24687;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#38169;&#35823;&#26085;&#24535;&lt;/span&gt;&lt;/tt&gt; &#30340;&#22238;&#28335;&#20449;&#24687;&#26377;&#22810;&#34892;&#12290; &#24403;&#28982;&#65292;&#36825;&#20123;&#20449;&#24687;&#26159;&#38590;&#30475;&#19988;&#38590;&#20197;&#38405;&#35835;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id22&quot;&gt;
&lt;span id=&quot;cn109&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&#22788;&#29702;&#27573;&#38169;&#35823;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&#26377;&#26102;&#20505;&#65292;Apache&#20250;&#22312;&#20320;&#23433;&#35013;Django&#30340;&#26102;&#20505;&#21457;&#29983;&#27573;&#38169;&#35823;&#12290; &#36825;&#26102;&#65292;&#22522;&#26412;&#19978; &lt;em&gt;&#24635;&#26159;&lt;/em&gt; &#26377;&#20197;&#19979;&#20004;&#20010;&#19982;Django&#26412;&#36523;&#26080;&#20851;&#30340;&#21407;&#22240;&#20854;&#20013;&#20043;&#19968;&#25152;&#36896;&#25104;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn111&quot;&gt;&#26377;&#21487;&#33021;&#26159;&#22240;&#20026;&#65292;&#20320;&#20351;&#29992;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pyexpat&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#65288;&#36827;&#34892;XML&#35299;&#26512;&#65289;&#24182;&#19988;&#19982;Apache&#20869;&#32622;&#30340;&#29256;&#26412;&#30456;&#20914;&#31361;&#12290; &#35814;&#24773;&#35831;&#35265; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/articles/expat-apache-crash/&quot;&gt;http://www.djangoproject.com/r/articles/expat-apache-crash/&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn112&quot;&gt;&#20063;&#26377;&#21487;&#33021;&#26159;&#22312;&#21516;&#19968;&#20010;Apache&#36827;&#31243;&#20013;&#65292;&#21516;&#26102;&#20351;&#29992;&#20102;mod_python &#21644; mod_php&#65292;&#32780;&#19988;&#37117;&#20351;&#29992;MySQL&#20316;&#20026;&#25968;&#25454;&#24211;&#21518;&#31471;&#12290; &#22312;&#26377;&#20123;&#24773;&#20917;&#19979;&#65292;&#36825;&#20250;&#36896;&#25104;PHP&#21644;Python&#30340;MySQL&#27169;&#22359;&#30340;&#29256;&#26412;&#20914;&#31361;&#12290;
&#22312;mod_python&#30340;FAQ&#20013;&#26377;&#26356;&#35814;&#32454;&#30340;&#35299;&#37322;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#22914;&#26524;&#36824;&#26377;&#23433;&#35013;mod_python&#30340;&#38382;&#39064;&#65292;&#26377;&#19968;&#20010;&#22909;&#30340;&#24314;&#35758;&#65292;&#23601;&#26159;&#20808;&#21482;&#36816;&#34892;mod_python&#31449;&#28857;&#65292;&#32780;&#19981;&#20351;&#29992;Django&#26694;&#26550;&#12290; &#36825;&#26159;&#21306;&#20998;mod_python&#29305;&#23450;&#38382;&#39064;&#30340;&#22909;&#26041;&#27861;&#12290; &#19979;&#38754;&#30340;&#36825;&#31687;&#25991;&#31456;&#32473;&#20986;&#20102;&#26356;&#35814;&#32454;&#30340;&#35299;&#37322;&#12290; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/articles/getting-modpython-working/&quot;&gt;http://www.djangoproject.com/r/articles/getting-modpython-working/&lt;/a&gt;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#19979;&#19968;&#20010;&#27493;&#39588;&#24212;&#35813;&#26159;&#32534;&#36753;&#19968;&#27573;&#27979;&#35797;&#20195;&#30721;&#65292;&#25226;&#20320;&#25152;&#26377;django&#30456;&#20851;&#20195;&#30721;import&#36827;&#21435;&#65292;&#20320;&#30340;views,models,URLconf,RSS&#37197;&#32622;&#65292;&#31561;&#31561;&#12290; &#25226;&#36825;&#20123;imports&#25918;&#36827;&#20320;&#30340;handler&#20989;&#25968;&#20013;&#65292;&#28982;&#21518;&#20174;&#27983;&#35272;&#22120;&#36827;&#20837;&#20320;&#30340;URL&#12290; &#22914;&#26524;&#36825;&#20123;&#23548;&#33268;&#20102;crash&#65292;&#20320;&#23601;&#21487;&#20197;&#30830;&#23450;&#26159;import&#30340;django&#20195;&#30721;&#24341;&#36215;&#20102;&#38382;&#39064;&#12290; &#36880;&#20010;&#21435;&#25481;&#36825;&#20123;imports&#65292;&#30452;&#21040;&#19981;&#20877;&#20914;&#31361;&#65292;&#36825;&#26679;&#23601;&#33021;&#25214;&#21040;&#24341;&#36215;&#38382;&#39064;&#30340;&#37027;&#20010;&#27169;&#22359;&#12290; &#28145;&#20837;&#20102;&#35299;&#21508;&#27169;&#22359;&#65292;&#30475;&#30475;&#23427;&#20204;&#30340;imports&#12290; &#35201;&#24819;&#33719;&#24471;&#26356;&#22810;&#24110;&#21161;&#65292;&#20687;linux&#30340;ldconfig&#65292;Mac OS&#30340;otool&#21644;windows&#30340;ListDLLs&#65288;form sysInternals&#65289;&#37117;&#21487;&#20197;&#24110;&#20320;&#35782;&#21035;&#20849;&#20139;&#20381;&#36182;&#21644;&#21487;&#33021;&#30340;&#29256;&#26412;&#20914;&#31361;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;mod-wsgi&quot;&gt;
&lt;span id=&quot;cn115&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#19968;&#31181;&#26367;&#20195;&#26041;&#26696;&#65306; mod_wsgi&#27169;&#22359;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn116&quot;&gt;&#20316;&#20026;&#19968;&#20010;mod_python&#27169;&#22359;&#30340;&#26367;&#20195;&#65292;&#20320;&#21487;&#20197;&#32771;&#34385;&#20351;&#29992;mod_wsgi&#27169;&#22359;(&lt;a class=&quot;reference external&quot; href=&quot;http://code.google.com/p/modwsgi/&quot;&gt;http://code.google.com/p/modwsgi/&lt;/a&gt;),&#27492;&#27169;&#22359;&#24320;&#21457;&#30340;&#26102;&#38388;&#27604;mod_python&#30340;&#24320;&#21457;&#26102;&#38388;&#31163;&#29616;&#22312;&#26356;&#36817;&#19968;&#20123;&#65292;&#22312;Django&#31038;&#21306;&#24050;&#26377;&#19968;&#20123;&#20351;&#29992;&#12290; &#19968;&#20010;&#23436;&#25972;&#30340;&#27010;&#36848;&#36229;&#20986;&#20102;&#26412;&#20070;&#30340;&#33539;&#22260;&#65292;&#20320;&#21487;&#20197;&#20174;&#23448;&#26041;&#30340;Django&#25991;&#26723;&#26597;&#30475;&#21040;&#26356;&#22810;&#30340;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;fastcgi-django&quot;&gt;
&lt;span id=&quot;cn117&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&#20351;&#29992;FastCGI&#37096;&#32626;Django&#24212;&#29992;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&#23613;&#31649;&#23558;&#20351;&#29992;Apache&#21644;mod_python&#25645;&#24314;Django&#29615;&#22659;&#26159;&#26368;&#20855;&#40065;&#26834;&#24615;&#30340;&#65292;&#20294;&#22312;&#24456;&#22810;&#34394;&#25311;&#20027;&#26426;&#24179;&#21488;&#19978;&#65292;&#24448;&#24448;&#21482;&#33021;&#20351;&#29992;FastCGI&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#27492;&#22806;&#65292;&#22312;&#24456;&#22810;&#24773;&#20917;&#19979;&#65292;FastCGI&#33021;&#22815;&#25552;&#20379;&#27604;mod_python&#26356;&#20026;&#20248;&#36234;&#30340;&#23433;&#20840;&#24615;&#21644;&#25928;&#33021;&#12290; &#38024;&#23545;&#23567;&#22411;&#31449;&#28857;&#65292;&#30456;&#23545;&#20110;Apache&#26469;&#35828;FastCGI&#26356;&#20026;&#36731;&#37327;&#32423;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;fastcgi&quot;&gt;
&lt;span id=&quot;cn120&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn120&quot;&gt;FastCGI &#31616;&#20171;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn121&quot;&gt;&#22914;&#20309;&#33021;&#22815;&#30001;&#19968;&#20010;&#22806;&#37096;&#30340;&#24212;&#29992;&#31243;&#24207;&#24456;&#26377;&#25928;&#35299;&#37322;WEB &#26381;&#21153;&#22120;&#19978;&#30340;&#21160;&#24577;&#39029;&#38754;&#35831;&#27714;&#21602;&#65311; &#31572;&#26696;&#23601;&#26159;&#20351;&#29992;FastCGI! &#23427;&#30340;&#24037;&#20316;&#27493;&#39588;&#31616;&#21333;&#30340;&#25551;&#36848;&#36215;&#26469;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn122&quot;&gt;&#21644;mod_python&#19968;&#26679;&#65292;FastCGI&#20063;&#26159;&#39547;&#30041;&#22312;&#20869;&#23384;&#37324;&#20026;&#23458;&#25143;&#35831;&#27714;&#36820;&#22238;&#21160;&#24577;&#20449;&#24687;,&#32780;&#19988;&#20063;&#20813;&#25481;&#20102;&#20687;&#20256;&#32479;&#30340;CGI&#19968;&#26679;&#21551;&#21160;&#36827;&#31243;&#26102;&#20505;&#30340;&#26102;&#38388;&#33457;&#38144;&#12290; &#20294;&#20110;mod_python&#19981;&#21516;&#20043;&#22788;&#26159;&#23427;&#24182;&#19981;&#26159;&#20316;&#20026;&#27169;&#22359;&#36816;&#34892;&#22312;web&#26381;&#21153;&#22120;&#21516;&#19968;&#36827;&#31243;&#20869;&#30340;&#65292;&#32780;&#26159;&#26377;&#33258;&#24049;&#30340;&#29420;&#31435;&#36827;&#31243;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&#20026;&#20160;&#20040;&#35201;&#22312;&#19968;&#20010;&#29420;&#31435;&#30340;&#36827;&#31243;&#20013;&#36816;&#34892;&#20195;&#30721;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#22312;&#20197;&#20256;&#32479;&#30340;&#26041;&#24335;&#30340;&#20960;&#31181;&#20197;mod_*&#26041;&#24335;&#23884;&#20837;&#21040;Apache&#30340;&#33050;&#26412;&#35821;&#35328;&#20013;&#65288;&#24120;&#35265;&#30340;&#20363;&#22914;&#65306; PHP&#65292;Python/mod_python&#21644;Perl/mod_perl&#65289;&#65292;&#20182;&#20204;&#37117;&#26159;&#20197;apache&#25193;&#23637;&#27169;&#22359;&#30340;&#26041;&#24335;&#23558;&#33258;&#36523;&#23884;&#20837;&#21040;Apache&#36827;&#31243;&#20013;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#27599;&#19968;&#20010;Apache&#36827;&#31243;&#37117;&#26159;&#19968;&#20010;Apache&#24341;&#25806;&#30340;&#21103;&#26412;&#65292;&#23427;&#23436;&#20840;&#21253;&#25324;&#20102;&#25152;&#26377;Apache&#25152;&#20855;&#26377;&#30340;&#19968;&#20999;&#21151;&#33021;&#29305;&#24615;&#65288;&#21738;&#24597;&#26159;&#23545;Django&#27627;&#26080;&#22909;&#22788;&#30340;&#19996;&#35199;&#20063;&#19968;&#24182;&#21152;&#36733;&#36827;&#26469;&#65289;&#12290; &#32780;FastCGI&#23601;&#19981;&#19968;&#26679;&#20102;&#65292;&#23427;&#20165;&#20165;&#25226;Python&#21644;Django&#31561;&#24517;&#22791;&#30340;&#19996;&#19996;&#24324;&#21040;&#20869;&#23384;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn126&quot;&gt;&#20381;&#25454;FastCGI&#33258;&#36523;&#30340;&#29305;&#28857;&#21487;&#20197;&#30475;&#21040;&#65292;FastCGI&#36827;&#31243;&#21487;&#20197;&#19982;Web&#26381;&#21153;&#22120;&#30340;&#36827;&#31243;&#20998;&#21035;&#36816;&#34892;&#22312;&#19981;&#21516;&#30340;&#29992;&#25143;&#26435;&#38480;&#19979;&#12290; &#23545;&#20110;&#19968;&#20010;&#22810;&#20154;&#20849;&#29992;&#30340;&#31995;&#32479;&#26469;&#35828;&#65292;&#36825;&#20010;&#29305;&#24615;&#23545;&#20110;&#23433;&#20840;&#24615;&#26159;&#38750;&#24120;&#26377;&#22909;&#22788;&#30340;&#65292;&#22240;&#20026;&#20320;&#21487;&#20197;&#23433;&#20840;&#30340;&#20110;&#21035;&#20154;&#20998;&#20139;&#21644;&#37325;&#29992;&#20195;&#30721;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&#22914;&#26524;&#20320;&#24076;&#26395;&#20320;&#30340;Django&#20197;FastCGI&#30340;&#26041;&#24335;&#36816;&#34892;&#65292;&#37027;&#20040;&#20320;&#36824;&#24517;&#39035;&#23433;&#35013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flup&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;Python&#24211;&#65292;&#36825;&#20010;&#24211;&#23601;&#26159;&#29992;&#20110;&#22788;&#29702;FastCGI&#30340;&#12290; &#24456;&#22810;&#29992;&#25143;&#37117;&#25265;&#24616; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flup&lt;/span&gt;&lt;/tt&gt; &#30340;&#21457;&#24067;&#29256;&#22826;&#20037;&#20102;&#65292;&#32769;&#26159;&#19981;&#26356;&#26032;&#12290; &#20854;&#23454;&#19981;&#26159;&#30340;&#65292;&#20182;&#20204;&#19968;&#30452;&#22312;&#21162;&#21147;&#30340;&#24037;&#20316;&#30528;&#65292;&#36825;&#26159;&#27809;&#26377;&#25918;&#20986;&#26469;&#32780;&#24050;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id23&quot;&gt;
&lt;span id=&quot;cn128&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#36816;&#34892;&#20320;&#30340; FastCGI &#26381;&#21153;&#22120;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;FastCGI&#26159;&#20197;&#23458;&#25143;&#26426;/&#26381;&#21153;&#22120;&#26041;&#24335;&#36816;&#34892;&#30340;&#65292;&#24182;&#19988;&#22312;&#24456;&#22810;&#24773;&#20917;&#19979;&#65292;&#20320;&#24471;&#33258;&#24049;&#21435;&#21551;&#21160;FastCGI&#30340;&#26381;&#21153;&#36827;&#31243;&#12290; Web&#26381;&#21153;&#22120;&#65288;&#20363;&#22914;Apache,lighttpd&#31561;&#31561;&#65289;&#20165;&#20165;&#22312;&#26377;&#21160;&#24577;&#39029;&#38754;&#35775;&#38382;&#35831;&#27714;&#30340;&#26102;&#20505;&#25165;&#20250;&#21435;&#19982;&#20320;&#30340;Django-FastCGI&#36827;&#31243;&#20132;&#20114;&#12290; &#22240;&#20026;Fast-CGI&#24050;&#32463;&#19968;&#30452;&#39547;&#30041;&#22312;&#20869;&#23384;&#37324;&#38754;&#20102;&#30340;&#65292;&#25152;&#20197;&#23427;&#21709;&#24212;&#36215;&#26469;&#20063;&#26159;&#24456;&#24555;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#35760;&#24405;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#22312;&#34394;&#25311;&#20027;&#26426;&#19978;&#20351;&#29992;&#30340;&#35805;&#65292;&#20320;&#21487;&#33021;&#20250;&#34987;&#24378;&#21046;&#30340;&#20351;&#29992;Web server-managed FastCGI&#36827;&#31243;&#12290; &#22312;&#36825;&#26679;&#30340;&#24773;&#20917;&#19979;&#65292;&#35831;&#21442;&#38405;&#19979;&#38754;&#30340;&#8220;&#22312;Apache&#20849;&#20139;&#20027;&#26426;&#37324;&#36816;&#34892;Django&#8221;&#36825;&#19968;&#23567;&#33410;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn132&quot;&gt;web&#26381;&#21153;&#22120;&#26377;&#20004;&#31181;&#26041;&#24335;&#20110;FastCGI&#36827;&#31243;&#20132;&#20114;&#65306; &#20351;&#29992;Unix domain socket(&#22312;win32&#37324;&#38754;&#26159; &lt;em&gt;&#21629;&#21517;&#31649;&#36947;&lt;/em&gt; )&#25110;&#32773;&#20351;&#29992;TCP socket.&#20855;&#20307;&#20351;&#29992;&#21738;&#19968;&#20010;&#65292;&#37027;&#23601;&#26681;&#25454;&#20320;&#30340;&#20559;&#22909;&#32780;&#23450;&#20102;&#65292;&#20294;&#26159;TCP socket&#24324;&#19981;&#22909;&#30340;&#35805;&#24448;&#24448;&#20250;&#21457;&#29983;&#19968;&#20123;&#26435;&#38480;&#19978;&#30340;&#38382;&#39064;&#12290; What you choose
is a manner of preference; a TCP socket is usually easier due to permissions issues.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#24320;&#22987;&#20320;&#30340;&#26381;&#21153;&#22120;&#39033;&#30446;&#65292;&#39318;&#20808;&#36827;&#20837;&#20320;&#30340;&#39033;&#30446;&#30446;&#24405;&#19979;&#65288;&#20320;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#25152;&#22312;&#20043;&#22788;&#65289;&#65292;&#28982;&#21518;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;runfcgi&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn135&quot;&gt;./manage.py runfcgi [options]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn136&quot;&gt;&#24819;&#20102;&#35299;&#22914;&#20309;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;runfcgi&lt;/span&gt;&lt;/tt&gt; &#65292;&#36755;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;runfcgi&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;help&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn137&quot;&gt;&#20320;&#21487;&#20197;&#25351;&#23450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;socket&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773;&#21516;&#26102;&#25351;&#23450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;host&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;port&lt;/span&gt;&lt;/tt&gt; &#12290;&#24403;&#20320;&#35201;&#21019;&#24314;Web&#26381;&#21153;&#22120;&#26102;&#65292;&#20320;&#21482;&#38656;&#35201;&#23558;&#26381;&#21153;&#22120;&#25351;&#21521;&#24403;&#20320;&#22312;&#21551;&#21160;FastCGI&#26381;&#21153;&#22120;&#26102;&#30830;&#23450;&#30340;socket&#25110;&#32773;host/port&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#33539;&#20363;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&#22312;TCP&#31471;&#21475;&#19978;&#36816;&#34892;&#19968;&#20010;&#32447;&#31243;&#26381;&#21153;&#22120;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn141&quot;&gt;./manage.py runfcgi method=threaded host=127.0.0.1 port=3033
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#22312;Unix socket&#19978;&#36816;&#34892;prefork&#26381;&#21153;&#22120;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn144&quot;&gt;./manage.py runfcgi method=prefork socket=/home/user/mysite.sock pidfile=django.pid
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn145&quot;&gt;&#21551;&#21160;&#65292;&#20294;&#19981;&#20316;&#20026;&#21518;&#21488;&#36827;&#31243;&#65288;&#22312;&#35843;&#35797;&#26102;&#27604;&#36739;&#26041;&#20415;&#65289;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn147&quot;&gt;./manage.py runfcgi daemonize=false socket=/tmp/mysite.sock
&lt;/pre&gt;
&lt;div class=&quot;section&quot; id=&quot;id24&quot;&gt;
&lt;span id=&quot;cn148&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn148&quot;&gt;&#20572;&#27490;FastCGI&#30340;&#34892;&#31243;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&#22914;&#26524;&#20320;&#30340;FastCGI&#26159;&#22312;&#21069;&#21488;&#36816;&#34892;&#30340;&#65292;&#37027;&#20040;&#21482;&#38656;&#25353;Ctrl+C&#23601;&#21487;&#20197;&#24456;&#26041;&#20415;&#30340;&#20572;&#27490;&#36825;&#20010;&#36827;&#31243;&#20102;&#12290; &#20294;&#22914;&#26524;&#26159;&#22312;&#21518;&#21488;&#36816;&#34892;&#30340;&#35805;&#65292;&#20320;&#23601;&#35201;&#20351;&#29992;Unix&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;kill&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#26469;&#26432;&#25481;&#23427;&#12290; &#28982;&#32780;&#65292;&#24403;&#20320;&#27491;&#22312;&#22788;&#29702;&#21518;&#21488;&#36827;&#31243;&#26102;&#65292;&#20320;&#20250;&#38656;&#35201;&#23558;&#20854;&#20184;&#35832;&#20110;Unix &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;kill&lt;/span&gt;&lt;/tt&gt;&#30340;&#21629;&#20196;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn150&quot;&gt;&#22914;&#26524;&#20320;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;runfcgi&lt;/span&gt;&lt;/tt&gt; &#20013;&#25351;&#23450;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pidfile&lt;/span&gt;&lt;/tt&gt; &#36825;&#20010;&#36873;&#39033;&#65292;&#37027;&#20040;&#20320;&#21487;&#20197;&#36825;&#26679;&#26469;&#26432;&#27515;&#36825;&#20010;FastCGI&#21518;&#21488;&#36827;&#31243;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn152&quot;&gt;kill `cat $PIDFILE`
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn153&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;$PIDFILE&lt;/span&gt;&lt;/tt&gt; &#23601;&#26159;&#20320;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pidfile&lt;/span&gt;&lt;/tt&gt; &#25351;&#23450;&#30340;&#37027;&#20010;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&#20320;&#21487;&#20197;&#20351;&#29992;&#19979;&#38754;&#36825;&#20010;&#33050;&#26412;&#26041;&#20415;&#22320;&#37325;&#21551;Unix&#37324;&#30340;FastCGI&#23432;&#25252;&#36827;&#31243;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn156&quot;&gt;#!/bin/bash

# Replace these three settings.
PROJDIR=&quot;/home/user/myproject&quot;
PIDFILE=&quot;$PROJDIR/mysite.pid&quot;
SOCKET=&quot;$PROJDIR/mysite.sock&quot;

cd $PROJDIR
if [ -f $PIDFILE ]; then
    kill `cat -- $PIDFILE`
    rm -f -- $PIDFILE
fi

exec /usr/bin/env -   PYTHONPATH=&quot;../python:..&quot;   ./manage.py runfcgi socket=$SOCKET pidfile=$PIDFILE
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;apache-fastcgi-django&quot;&gt;
&lt;span id=&quot;cn157&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn157&quot;&gt;&#22312;Apache&#20013;&#20197;FastCGI&#30340;&#26041;&#24335;&#20351;&#29992;Django&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn158&quot;&gt;&#22312;Apache&#21644;FastCGI&#19978;&#20351;&#29992;Django&#65292;&#20320;&#38656;&#35201;&#23433;&#35013;&#21644;&#37197;&#32622;Apache&#65292;&#24182;&#19988;&#23433;&#35013;mod_fastcgi&#12290; &#35831;&#21442;&#35265;Apache&#21644;mod_fastcgi&#25991;&#26723;&#65306; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/mod_fastcgi/&quot;&gt;http://www.djangoproject.com/r/mod_fastcgi/&lt;/a&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&#24403;&#23436;&#25104;&#20102;&#23433;&#35013;&#65292;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;httpd.conf&lt;/span&gt;&lt;/tt&gt; &#65288;Apache&#30340;&#37197;&#32622;&#25991;&#20214;&#65289;&#26469;&#35753;Apache&#21644;Django FastCGI&#20114;&#30456;&#36890;&#20449;&#12290; &#20320;&#38656;&#35201;&#20570;&#20004;&#20214;&#20107;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn160&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn160&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FastCGIExternalServer&lt;/span&gt;&lt;/tt&gt; &#25351;&#26126;FastCGI&#30340;&#20301;&#32622;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn161&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn161&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mod_rewrite&lt;/span&gt;&lt;/tt&gt; &#20026;FastCGI&#25351;&#23450;&#21512;&#36866;&#30340;URL&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;section&quot; id=&quot;fastcgi-server&quot;&gt;
&lt;span id=&quot;cn162&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#25351;&#23450; FastCGI Server &#30340;&#20301;&#32622;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn163&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FastCGIExternalServer&lt;/span&gt;&lt;/tt&gt; &#21578;&#35785;Apache&#22914;&#20309;&#25214;&#21040;FastCGI&#26381;&#21153;&#22120;&#12290;
&#25353;&#29031;FastCGIExternalServer &#25991;&#26723;&#65288; &lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/mod_fastcgi/FastCGIExternalServer/&quot;&gt;http://www.djangoproject.com/r/mod_fastcgi/FastCGIExternalServer/&lt;/a&gt; &#65289;&#65292;&#20320;&#21487;&#20197;&#25351;&#26126; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;socket&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;host&lt;/span&gt;&lt;/tt&gt; &#12290;&#20197;&#19979;&#26159;&#20004;&#20010;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn165&quot;&gt;# Connect to FastCGI via a socket/named pipe:
FastCGIExternalServer /home/user/public_html/mysite.fcgi -socket /home/user/mysite.sock

# Connect to FastCGI via a TCP host/port:
FastCGIExternalServer /home/user/public_html/mysite.fcgi -host 127.0.0.1:3033
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn166&quot;&gt;&#22312;&#36825;&#20004;&#20010;&#20363;&#23376;&#20013;&#65292; /home/user/public_html/ &#30446;&#24405;&#24517;&#39035;&#23384;&#22312;&#65292;&#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/home/user/public_html/mysite.fcgi&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#19981;&#19968;&#23450;&#23384;&#22312;&#12290; &#23427;&#20165;&#20165;&#26159;&#19968;&#20010;Web&#26381;&#21153;&#22120;&#20869;&#37096;&#20351;&#29992;&#30340;&#25509;&#21475;&#65292;&#36825;&#20010;URL&#20915;&#23450;&#20102;&#23545;&#20110;&#21738;&#20123;URL&#30340;&#35831;&#27714;&#20250;&#34987;FastCGI&#22788;&#29702;&#65288;&#19979;&#19968;&#37096;&#20998;&#35814;&#32454;&#35752;&#35770;&#65289;&#12290; &#65288;&#19979;&#19968;&#31456;&#23558;&#20250;&#26377;&#26356;&#22810;&#26377;&#20851;&#20110;&#27492;&#30340;&#20171;&#32461;&#65289;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;mod-rewrite-fastcgi-url&quot;&gt;
&lt;span id=&quot;cn167&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn167&quot;&gt;&#20351;&#29992;mod_rewrite&#20026;FastCGI&#25351;&#23450;URL&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&#31532;&#20108;&#27493;&#26159;&#21578;&#35785;Apache&#20026;&#31526;&#21512;&#19968;&#23450;&#27169;&#24335;&#30340;URL&#20351;&#29992;FastCGI&#12290;
&#20026;&#20102;&#23454;&#29616;&#36825;&#19968;&#28857;&#65292;&#35831;&#20351;&#29992;mod_rewrite &#27169;&#22359;&#65292;&#24182;&#23558;&#36825;&#20123;URL&#37325;&#23450;&#21521;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.fcgi&lt;/span&gt;&lt;/tt&gt; &#65288;&#25110;&#32773;&#27491;&#22914;&#22312;&#21069;&#25991;&#20013;&#25551;&#36848;&#30340;&#37027;&#26679;&#65292;&#20351;&#29992;&#20219;&#20309;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FastCGIExternalServer&lt;/span&gt;&lt;/tt&gt; &#25351;&#23450;&#30340;&#20869;&#23481;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn169&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#37324;&#38754;&#65292;&#25105;&#20204;&#21578;&#35785;Apache&#20351;&#29992;FastCGI&#26469;&#22788;&#29702;&#37027;&#20123;&#22312;&#25991;&#20214;&#31995;&#32479;&#19978;&#19981;&#25552;&#20379;&#25991;&#20214;(&#35793;&#32773;&#27880;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn171&quot;&gt;&amp;lt;VirtualHost 12.34.56.78&amp;gt;
  ServerName example.com
  DocumentRoot /home/user/public_html
  Alias /media /home/user/python/django/contrib/admin/media
  RewriteEngine On
  RewriteRule ^/(media.*)$ /$1 [QSA,L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ /mysite.fcgi/$1 [QSA,L]
&amp;lt;/VirtualHost&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;fastcgi-lighttpd&quot;&gt;
&lt;span id=&quot;cn172&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn172&quot;&gt;FastCGI &#21644; lighttpd&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn173&quot;&gt;lighttpd (&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/lighttpd/&quot;&gt;http://www.djangoproject.com/r/lighttpd/&lt;/a&gt;) &#26159;&#19968;&#20010;&#36731;&#37327;&#32423;&#30340;Web&#26381;&#21153;&#22120;&#65292;&#36890;&#24120;&#34987;&#29992;&#26469;&#25552;&#20379;&#38745;&#24577;&#39029;&#38754;&#30340;&#35775;&#38382;&#12290; &#23427;&#22825;&#29983;&#25903;&#25345;FastCGI&#65292;&#22240;&#27492;&#38500;&#38750;&#20320;&#30340;&#31449;&#28857;&#38656;&#35201;&#19968;&#20123;Apache&#29305;&#26377;&#30340;&#29305;&#24615;&#65292;&#21542;&#21017;&#65292;lighttpd&#23545;&#20110;&#38745;&#24577;&#21644;&#21160;&#24577;&#39029;&#38754;&#26469;&#35828;&#37117;&#26159;&#29702;&#24819;&#30340;&#36873;&#25321;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#30830;&#20445; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mod_fastcgi&lt;/span&gt;&lt;/tt&gt; &#22312;&#27169;&#22359;&#21015;&#34920;&#20013;&#65292;&#23427;&#38656;&#35201;&#20986;&#29616;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mod_rewrite&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mod_access&lt;/span&gt;&lt;/tt&gt; &#65292;&#20294;&#26159;&#35201;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mod_accesslog&lt;/span&gt;&lt;/tt&gt; &#20043;&#21069;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn175&quot;&gt;&#23558;&#19979;&#38754;&#30340;&#20869;&#23481;&#28155;&#21152;&#21040;&#20320;&#30340;lighttpd&#30340;&#37197;&#32622;&#25991;&#20214;&#20013;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn177&quot;&gt;server.document-root = &quot;/home/user/public_html&quot;
fastcgi.server = (
    &quot;/mysite.fcgi&quot; =&amp;gt; (
        &quot;main&quot; =&amp;gt; (
            # Use host / port instead of socket for TCP fastcgi
            # &quot;host&quot; =&amp;gt; &quot;127.0.0.1&quot;,
            # &quot;port&quot; =&amp;gt; 3033,
            &quot;socket&quot; =&amp;gt; &quot;/home/user/mysite.sock&quot;,
            &quot;check-local&quot; =&amp;gt; &quot;disable&quot;,
        )
    ),
)
alias.url = (
    &quot;/media/&quot; =&amp;gt; &quot;/home/user/django/contrib/admin/media/&quot;,
)

url.rewrite-once = (
    &quot;^(/media.*)$&quot; =&amp;gt; &quot;$1&quot;,
    &quot;^/favicon\.ico$&quot; =&amp;gt; &quot;/media/favicon.ico&quot;,
    &quot;^(/.*)$&quot; =&amp;gt; &quot;/mysite.fcgi$1&quot;,
)
&lt;/pre&gt;
&lt;div class=&quot;section&quot; id=&quot;lighttpd-django&quot;&gt;
&lt;span id=&quot;cn178&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn178&quot;&gt;&#22312;&#19968;&#20010;lighttpd&#36827;&#31243;&#20013;&#36816;&#34892;&#22810;&#20010;Django&#31449;&#28857;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn179&quot;&gt;lighttpd&#20801;&#35768;&#20320;&#20351;&#29992;&#26465;&#20214;&#37197;&#32622;&#26469;&#20026;&#27599;&#20010;&#31449;&#28857;&#20998;&#21035;&#25552;&#20379;&#35774;&#32622;&#12290; &#20026;&#20102;&#25903;&#25345;FastCGI&#30340;&#22810;&#31449;&#28857;&#65292;&#21482;&#38656;&#35201;&#22312;FastCGI&#30340;&#37197;&#32622;&#25991;&#20214;&#20013;&#65292;&#20026;&#27599;&#20010;&#31449;&#28857;&#20998;&#21035;&#24314;&#31435;&#26465;&#20214;&#37197;&#32622;&#39033;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn181&quot;&gt;# If the hostname is &apos;www.example1.com&apos;...
$HTTP[&quot;host&quot;] == &quot;www.example1.com&quot; {
    server.document-root = &quot;/foo/site1&quot;
    fastcgi.server = (
       ...
    )
    ...
}

# If the hostname is &apos;www.example2.com&apos;...
$HTTP[&quot;host&quot;] == &quot;www.example2.com&quot; {
    server.document-root = &quot;/foo/site2&quot;
    fastcgi.server = (
       ...
    )
    ...
}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn182&quot;&gt;&#20320;&#20063;&#21487;&#20197;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;fastcgi.server&lt;/span&gt;&lt;/tt&gt; &#20013;&#25351;&#23450;&#22810;&#20010;&#20837;&#21475;&#65292;&#22312;&#21516;&#19968;&#20010;&#31449;&#28857;&#19978;&#23454;&#29616;&#22810;&#20010;Django&#23433;&#35013;&#12290; &#35831;&#20026;&#27599;&#19968;&#20010;&#23433;&#35013;&#25351;&#23450;&#19968;&#20010;FastCGI&#20027;&#26426;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id25&quot;&gt;
&lt;span id=&quot;cn183&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn183&quot;&gt;&#22312;&#20351;&#29992;Apache&#30340;&#20849;&#20139;&#20027;&#26426;&#26381;&#21153;&#21830;&#22788;&#36816;&#34892;Django&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn184&quot;&gt;&#35768;&#22810;&#20849;&#20139;&#20027;&#26426;&#30340;&#26381;&#21153;&#25552;&#20379;&#21830;&#19981;&#20801;&#35768;&#36816;&#34892;&#20320;&#33258;&#24049;&#30340;&#26381;&#21153;&#36827;&#31243;&#65292;&#20063;&#19981;&#20801;&#35768;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;httpd.conf&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#12290; &#23613;&#31649;&#22914;&#27492;&#65292;&#20173;&#28982;&#26377;&#21487;&#33021;&#36890;&#36807;Web&#26381;&#21153;&#22120;&#20135;&#29983;&#30340;&#23376;&#36827;&#31243;&#26469;&#36816;&#34892;Django&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#35760;&#24405;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#22914;&#26524;&#20320;&#35201;&#20351;&#29992;&#26381;&#21153;&#22120;&#30340;&#23376;&#36827;&#31243;&#65292;&#20320;&#27809;&#26377;&#24517;&#35201;&#33258;&#24049;&#21435;&#21551;&#21160;FastCGI&#26381;&#21153;&#22120;&#12290; Apache&#20250;&#33258;&#21160;&#20135;&#29983;&#19968;&#20123;&#23376;&#36827;&#31243;&#65292;&#20135;&#29983;&#30340;&#25968;&#37327;&#25353;&#29031;&#38656;&#27714;&#21644;&#37197;&#32622;&#20250;&#26377;&#25152;&#19981;&#21516;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn187&quot;&gt;&#22312;&#20320;&#30340;Web&#26681;&#30446;&#24405;&#19979;&#65292;&#23558;&#19979;&#38754;&#30340;&#20869;&#23481;&#22686;&#21152;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.htaccess&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#20013;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn189&quot;&gt;AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&#25509;&#30528;&#65292;&#21019;&#24314;&#19968;&#20010;&#33050;&#26412;&#65292;&#21578;&#30693;Apache&#22914;&#20309;&#36816;&#34892;&#20320;&#30340;FastCGI&#31243;&#24207;&#12290; &#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.fcgi&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#65292;&#24182;&#25226;&#23427;&#25918;&#22312;&#20320;&#30340;Web&#30446;&#24405;&#20013;&#65292;&#25171;&#24320;&#21487;&#25191;&#34892;&#26435;&#38480;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn192&quot;&gt;#!/usr/bin/python
import sys, os

# Add a custom Python path.
sys.path.insert(0, &quot;/home/user/python&quot;)

# Switch to the directory of your project. (Optional.)
# os.chdir(&quot;/home/user/myproject&quot;)

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ[&apos;DJANGO_SETTINGS_MODULE&apos;] = &quot;myproject.settings&quot;

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method=&quot;threaded&quot;, daemonize=&quot;false&quot;)
&lt;/pre&gt;
&lt;div class=&quot;section&quot; id=&quot;id26&quot;&gt;
&lt;span id=&quot;cn193&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&#37325;&#21551;&#26032;&#20135;&#29983;&#30340;&#36827;&#31243;&#26381;&#21153;&#22120;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn194&quot;&gt;&#22914;&#26524;&#20320;&#25913;&#21464;&#20102;&#31449;&#28857;&#19978;&#20219;&#20309;&#30340;python&#20195;&#30721;&#65292;&#20320;&#38656;&#35201;&#21578;&#30693;FastCGI&#12290; &#20294;&#26159;&#65292;&#36825;&#19981;&#38656;&#35201;&#37325;&#21551;Apache&#65292;&#32780;&#21482;&#38656;&#35201;&#37325;&#26032;&#19978;&#20256; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite.fcgi&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773;&#32534;&#36753;&#25913;&#25991;&#20214;&#65292;&#20351;&#24471;&#20462;&#25913;&#26102;&#38388;&#21457;&#29983;&#20102;&#21464;&#21270;&#65292;&#23427;&#20250;&#33258;&#21160;&#24110;&#20320;&#37325;&#21551;Django&#24212;&#29992;&#12290; &#20320;&#21487;&#20197;&#37325;&#26032;&#19978;&#20256;mysite.fcgi&#25110;&#32773;&#32534;&#36753;&#36825;&#20010;&#25991;&#20214;&#20197;&#25913;&#21464;&#35813;&#25991;&#20214;&#30340;&#26102;&#38388;&#25139;&#12290; &#24403;&#38463;&#24085;&#22855;&#26381;&#21153;&#22120;&#21457;&#29616;&#25991;&#26723;&#34987;&#26356;&#26032;&#20102;&#65292;&#23427;&#23558;&#20250;&#20026;&#20320;&#37325;&#21551;&#20320;&#30340;Django&#24212;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn195&quot;&gt;&#22914;&#26524;&#20320;&#25317;&#26377;Unix&#31995;&#32479;&#21629;&#20196;&#34892;&#30340;&#21487;&#25191;&#34892;&#26435;&#38480;&#65292;&#21482;&#38656;&#35201;&#31616;&#21333;&#22320;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;touch&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn197&quot;&gt;touch mysite.fcgi
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id27&quot;&gt;
&lt;span id=&quot;cn198&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&#21487;&#25193;&#23637;&#24615;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&#26082;&#28982;&#20320;&#24050;&#32463;&#30693;&#36947;&#22914;&#20309;&#22312;&#19968;&#21488;&#26381;&#21153;&#22120;&#19978;&#36816;&#34892;Django&#65292;&#35753;&#25105;&#20204;&#26469;&#30740;&#31350;&#19968;&#19979;&#65292;&#22914;&#20309;&#25193;&#23637;&#25105;&#20204;&#30340;Django&#23433;&#35013;&#12290; &#36825;&#19968;&#37096;&#20998;&#25105;&#20204;&#23558;&#35752;&#35770;&#65292;&#22914;&#20309;&#25226;&#19968;&#21488;&#26381;&#21153;&#22120;&#25193;&#23637;&#20026;&#19968;&#20010;&#22823;&#35268;&#27169;&#30340;&#26381;&#21153;&#22120;&#38598;&#32676;&#65292;&#36825;&#26679;&#23601;&#33021;&#28385;&#36275;&#27599;&#23567;&#26102;&#19978;&#30334;&#19975;&#30340;&#28857;&#20987;&#29575;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&#26377;&#19968;&#28857;&#24456;&#37325;&#35201;&#65292;&#27599;&#19968;&#20010;&#22823;&#22411;&#30340;&#31449;&#28857;&#22823;&#30340;&#24418;&#24335;&#21644;&#35268;&#27169;&#19981;&#21516;&#65292;&#22240;&#27492;&#21487;&#25193;&#23637;&#24615;&#20854;&#23454;&#24182;&#19981;&#26159;&#19968;&#31181;&#21315;&#31687;&#19968;&#24459;&#30340;&#34892;&#20026;&#12290; &#20197;&#19979;&#37096;&#20998;&#20250;&#28041;&#21450;&#21040;&#19968;&#20123;&#36890;&#29992;&#30340;&#21407;&#21017;&#65292;&#24182;&#19988;&#20250;&#25351;&#20986;&#19968;&#20123;&#19981;&#21516;&#36873;&#25321;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn201&quot;&gt;&#39318;&#20808;&#65292;&#25105;&#20204;&#26469;&#20570;&#19968;&#20010;&#22823;&#30340;&#20551;&#35774;&#65292;&#21482;&#38598;&#20013;&#22320;&#35752;&#35770;&#22312;Apache&#21644;mod_python&#19979;&#30340;&#21487;&#25193;&#23637;&#24615;&#38382;&#39064;&#12290; &#23613;&#31649;&#25105;&#20204;&#20063;&#30693;&#36947;&#19968;&#20123;&#25104;&#21151;&#30340;&#20013;&#22411;&#21644;&#22823;&#22411;&#30340;FastCGI&#31574;&#30053;&#65292;&#20294;&#26159;&#25105;&#20204;&#26356;&#21152;&#29087;&#24713;Apache&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id28&quot;&gt;
&lt;span id=&quot;cn202&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn202&quot;&gt;&#36816;&#34892;&#22312;&#19968;&#21488;&#21333;&#26426;&#26381;&#21153;&#22120;&#19978;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn203&quot;&gt;&#22823;&#22810;&#25968;&#30340;&#31449;&#28857;&#19968;&#24320;&#22987;&#37117;&#36816;&#34892;&#22312;&#21333;&#26426;&#26381;&#21153;&#22120;&#19978;&#65292;&#30475;&#36215;&#26469;&#20687;&#22270;20-1&#36825;&#26679;&#30340;&#26500;&#26550;&#12290;&lt;/p&gt;
&lt;img alt=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-1.png&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-1.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&#22270; 20-1&#65306; &#19968;&#20010;&#21333;&#26381;&#21153;&#22120;&#30340;Django&#23433;&#35013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn206&quot;&gt;&#36825;&#23545;&#20110;&#23567;&#22411;&#21644;&#20013;&#22411;&#30340;&#31449;&#28857;&#26469;&#35828;&#36824;&#19981;&#38169;&#65292;&#24182;&#19988;&#20063;&#24456;&#20415;&#23452;&#65292;&#19968;&#33324;&#26469;&#35828;&#65292;&#20320;&#21487;&#20197;&#22312;3000&#32654;&#20803;&#20197;&#19979;&#23601;&#25630;&#23450;&#19968;&#20999;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn207&quot;&gt;&#28982;&#32780;&#65292;&#24403;&#27969;&#37327;&#22686;&#21152;&#30340;&#26102;&#20505;&#65292;&#20320;&#20250;&#36805;&#36895;&#38519;&#20837;&#19981;&#21516;&#36719;&#20214;&#30340; &lt;em&gt;&#36164;&#28304;&#20105;&#22842;&lt;/em&gt; &#20043;&#20013;&#12290; &#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#21644;Web&#26381;&#21153;&#22120;&#37117; &lt;em&gt;&#21916;&#27426;&lt;/em&gt; &#33258;&#24049;&#25317;&#26377;&#25972;&#20010;&#26381;&#21153;&#22120;&#36164;&#28304;&#65292;&#22240;&#27492;&#24403;&#34987;&#23433;&#35013;&#22312;&#21333;&#26426;&#19978;&#26102;&#65292;&#23427;&#20204;&#24635;&#20250;&#20105;&#22842;&#30456;&#21516;&#30340;&#36164;&#28304;&#65288;RAM, CPU&#65289;&#65292;&#23427;&#20204;&#26356;&#24895;&#24847;&#29420;&#20139;&#36164;&#28304;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn208&quot;&gt;&#36890;&#36807;&#25226;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#25644;&#31227;&#21040;&#31532;&#20108;&#21488;&#20027;&#26426;&#19978;&#65292;&#21487;&#20197;&#24456;&#23481;&#26131;&#22320;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id29&quot;&gt;
&lt;span id=&quot;cn209&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&#20998;&#31163;&#20986;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&#23545;&#20110;Django&#26469;&#35828;&#65292;&#25226;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#20998;&#31163;&#24320;&#26469;&#24456;&#23481;&#26131;&#65306; &#21482;&#38656;&#35201;&#31616;&#21333;&#22320;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_HOST&lt;/span&gt;&lt;/tt&gt; &#65292;&#35774;&#32622;&#20026;&#26032;&#30340;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#30340;IP&#22320;&#22336;&#25110;&#32773;DNS&#22495;&#21517;&#12290; &#35774;&#32622;&#20026;IP&#22320;&#22336;&#24635;&#26159;&#19968;&#20010;&#22909;&#20027;&#24847;&#65292;&#22240;&#20026;&#20351;&#29992;DNS&#22495;&#21517;&#65292;&#36824;&#35201;&#29301;&#28041;&#21040;DNS&#26381;&#21153;&#22120;&#30340;&#21487;&#38752;&#24615;&#36830;&#25509;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn211&quot;&gt;&#20351;&#29992;&#20102;&#19968;&#20010;&#29420;&#31435;&#30340;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#20197;&#21518;&#65292;&#25105;&#20204;&#30340;&#26500;&#26550;&#21464;&#25104;&#20102;&#22270;20-2&#12290;&lt;/p&gt;
&lt;img alt=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-2.png&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-2.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn207&quot;&gt;&#22270; 20-2&#65306; &#23558;&#25968;&#25454;&#24211;&#31227;&#21040;&#21333;&#29420;&#30340;&#26381;&#21153;&#22120;&#19978;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn214&quot;&gt;&#36825;&#37324;&#65292;&#25105;&#20204;&#24320;&#22987;&#27493;&#20837; &lt;em&gt;n-tier&lt;/em&gt; &#26500;&#26550;&#12290; &#19981;&#35201;&#34987;&#36825;&#20010;&#35789;&#25152;&#21523;&#22351;&#65292;&#23427;&#21482;&#26159;&#35828;&#26126;&#20102;Web&#26632;&#30340;&#19981;&#21516;&#37096;&#20998;&#65292;&#34987;&#20998;&#31163;&#21040;&#20102;&#19981;&#21516;&#30340;&#29289;&#29702;&#26426;&#22120;&#19978;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn215&quot;&gt;&#25105;&#20204;&#20877;&#26469;&#30475;&#65292;&#22914;&#26524;&#21457;&#29616;&#38656;&#35201;&#19981;&#27490;&#19968;&#21488;&#30340;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#65292;&#32771;&#34385;&#20351;&#29992;&#36830;&#25509;&#27744;&#21644;&#25968;&#25454;&#24211;&#22791;&#20221;&#23558;&#26159;&#19968;&#20010;&#22909;&#20027;&#24847;&#12290; &#19981;&#24184;&#30340;&#26159;&#65292;&#26412;&#20070;&#27809;&#26377;&#36275;&#22815;&#30340;&#26102;&#38388;&#26469;&#35752;&#35770;&#36825;&#20010;&#38382;&#39064;&#65292;&#25152;&#20197;&#20320;&#21442;&#32771;&#25968;&#25454;&#24211;&#25991;&#26723;&#25110;&#32773;&#21521;&#31038;&#21306;&#27714;&#21161;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id30&quot;&gt;
&lt;span id=&quot;cn216&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn216&quot;&gt;&#36816;&#34892;&#19968;&#20010;&#29420;&#31435;&#30340;&#23186;&#20307;&#26381;&#21153;&#22120;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&#20351;&#29992;&#21333;&#26426;&#26381;&#21153;&#22120;&#20173;&#28982;&#30041;&#19979;&#20102;&#19968;&#20010;&#22823;&#38382;&#39064;&#65306; &#22788;&#29702;&#21160;&#24577;&#20869;&#23481;&#30340;&#23186;&#20307;&#36164;&#28304;&#65292;&#20063;&#26159;&#22312;&#21516;&#19968;&#21488;&#26426;&#22120;&#19978;&#23436;&#25104;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn218&quot;&gt;&#36825;&#20004;&#20010;&#27963;&#21160;&#26159;&#22312;&#19981;&#21516;&#30340;&#26465;&#20214;&#19979;&#36827;&#34892;&#30340;&#65292;&#22240;&#27492;&#25226;&#23427;&#20204;&#24378;&#34892;&#20945;&#21644;&#22312;&#21516;&#19968;&#21488;&#26426;&#22120;&#19978;&#65292;&#20320;&#19981;&#21487;&#33021;&#33719;&#24471;&#24456;&#22909;&#30340;&#24615;&#33021;&#12290; &#19979;&#19968;&#27493;&#65292;&#25105;&#20204;&#35201;&#25226;&#23186;&#20307;&#36164;&#28304;&#65288;&#20219;&#20309; &lt;em&gt;&#19981;&#26159;&lt;/em&gt; &#30001;Django&#35270;&#22270;&#20135;&#29983;&#30340;&#19996;&#35199;&#65289;&#20998;&#31163;&#21040;&#21035;&#30340;&#26381;&#21153;&#22120;&#19978;&#65288;&#35831;&#30475;&#22270;20-3&#65289;&#12290;&lt;/p&gt;
&lt;img alt=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-3.png&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-3.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn215&quot;&gt;&#22270; 20-3&#65306; &#20998;&#31163;&#20986;&#23186;&#20307;&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn221&quot;&gt;&#29702;&#24819;&#30340;&#24773;&#20917;&#26159;&#65292;&#36825;&#20010;&#23186;&#20307;&#26381;&#21153;&#22120;&#26159;&#19968;&#20010;&#23450;&#21046;&#30340;Web&#26381;&#21153;&#22120;&#65292;&#20026;&#20256;&#36865;&#38745;&#24577;&#23186;&#20307;&#36164;&#28304;&#20570;&#20102;&#20248;&#21270;&#12290; lighttpd&#21644;tux (&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/tux/&quot;&gt;http://www.djangoproject.com/r/tux/&lt;/a&gt;) &#37117;&#26159;&#26497;&#20339;&#30340;&#36873;&#25321;&#65292;&#24403;&#28982;&#30246;&#36523;&#30340;Apache&#26381;&#21153;&#22120;&#20063;&#21487;&#20197;&#24037;&#20316;&#30340;&#24456;&#22909;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn222&quot;&gt;&#23545;&#20110;&#25317;&#26377;&#22823;&#37327;&#38745;&#24577;&#20869;&#23481;&#65288;&#29031;&#29255;&#12289;&#35270;&#39057;&#31561;&#65289;&#30340;&#31449;&#28857;&#26469;&#35828;&#65292;&#23558;&#23186;&#20307;&#26381;&#21153;&#22120;&#20998;&#31163;&#20986;&#21435;&#26174;&#28982;&#26377;&#30528;&#26356;&#21152;&#37325;&#35201;&#30340;&#24847;&#20041;&#65292;&#32780;&#19988;&#24212;&#35813;&#26159;&#25193;&#22823;&#35268;&#27169;&#30340;&#26102;&#20505;&#25152;&#35201;&#37319;&#21462;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#31532;&#19968;&#27493;&#25514;&#26045;&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn223&quot;&gt;&#36825;&#19968;&#27493;&#38656;&#35201;&#19968;&#28857;&#28857;&#25216;&#24039;&#65292;Django&#30340;admin&#31649;&#29702;&#25509;&#21475;&#38656;&#35201;&#33021;&#22815;&#33719;&#24471;&#36275;&#22815;&#30340;&#26435;&#38480;&#26469;&#22788;&#29702;&#19978;&#20256;&#30340;&#23186;&#20307;&#65288;&#36890;&#36807;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MEDIA_ROOT&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290;&#22914;&#26524;&#23186;&#20307;&#36164;&#28304;&#22312;&#21478;&#22806;&#30340;&#19968;&#21488;&#26381;&#21153;&#22120;&#19978;&#65292;&#20320;&#38656;&#35201;&#33719;&#24471;&#36890;&#36807;&#32593;&#32476;&#20889;&#25805;&#20316;&#30340;&#26435;&#38480;&#12290; &#22914;&#26524;&#20320;&#30340;&#24212;&#29992;&#29301;&#28041;&#21040;&#25991;&#20214;&#19978;&#36733;&#65292;Django&#38656;&#35201;&#33021;&#22815;&#38754;&#21521;&#23186;&#20307;&#26381;&#21153;&#22120;&#25776;&#20889;&#19978;&#36733;&#23186;&#20307; &#22914;&#26524;&#23186;&#20307;&#26159;&#22312;&#21478;&#22806;&#19968;&#21488;&#26381;&#21153;&#22120;&#19978;&#30340;&#65292;&#20320;&#38656;&#35201;&#37096;&#32626;&#19968;&#31181;&#26041;&#27861;&#20351;&#24471;Django&#21487;&#20197;&#36890;&#36807;&#32593;&#32476;&#21435;&#20889;&#36825;&#20123;&#23186;&#20307;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id31&quot;&gt;
&lt;span id=&quot;cn224&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn224&quot;&gt;&#23454;&#29616;&#36127;&#25285;&#22343;&#34913;&#21644;&#25968;&#25454;&#20887;&#20313;&#22791;&#20221;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn225&quot;&gt;&#29616;&#22312;&#65292;&#25105;&#20204;&#24050;&#32463;&#23613;&#21487;&#33021;&#22320;&#36827;&#34892;&#20102;&#20998;&#35299;&#12290; &#36825;&#31181;&#19977;&#21488;&#26381;&#21153;&#22120;&#30340;&#26500;&#26550;&#21487;&#20197;&#25215;&#21463;&#24456;&#22823;&#30340;&#27969;&#37327;&#65292;&#27604;&#22914;&#27599;&#22825;1000&#19975;&#30340;&#28857;&#20987;&#29575;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn226&quot;&gt;&#36825;&#26159;&#20010;&#22909;&#20027;&#24847;&#12290; &#35831;&#30475;&#22270; 20-3&#65292;&#19968;&#26086;&#19977;&#20010;&#26381;&#21153;&#22120;&#20013;&#30340;&#20219;&#20309;&#19968;&#20010;&#21457;&#29983;&#20102;&#25925;&#38556;&#65292;&#20320;&#23601;&#24471;&#20851;&#38381;&#25972;&#20010;&#31449;&#28857;&#12290; &#22240;&#27492;&#22312;&#24341;&#20837;&#20887;&#20313;&#22791;&#20221;&#30340;&#26102;&#20505;&#65292;&#20320;&#24182;&#19981;&#21482;&#26159;&#22686;&#21152;&#20102;&#23481;&#37327;&#65292;&#21516;&#26102;&#20063;&#22686;&#21152;&#20102;&#21487;&#38752;&#24615;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn227&quot;&gt;&#25105;&#20204;&#39318;&#20808;&#26469;&#32771;&#34385;Web&#26381;&#21153;&#22120;&#30340;&#28857;&#20987;&#37327;&#12290;
&#25226;&#21516;&#19968;&#20010;Django&#30340;&#31449;&#28857;&#22797;&#21046;&#22810;&#20221;&#65292;&#22312;&#22810;&#21488;&#26426;&#22120;&#19978;&#21516;&#26102;&#36816;&#34892;&#24456;&#23481;&#26131;&#65292;&#25105;&#20204;&#20063;&#21482;&#38656;&#35201;&#21516;&#26102;&#36816;&#34892;&#22810;&#21488;&#26426;&#22120;&#19978;&#30340;Apache&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn228&quot;&gt;&#20320;&#36824;&#38656;&#35201;&#21478;&#19968;&#20010;&#36719;&#20214;&#26469;&#24110;&#21161;&#20320;&#22312;&#22810;&#21488;&#26381;&#21153;&#22120;&#20043;&#38388;&#22343;&#34913;&#32593;&#32476;&#27969;&#37327;&#65306; &lt;em&gt;&#27969;&#37327;&#22343;&#34913;&#22120;&#65288;load balancer&#65289;&lt;/em&gt; &#12290;&#20320;&#21487;&#20197;&#36141;&#20080;&#26114;&#36149;&#30340;&#19987;&#26377;&#30340;&#30828;&#20214;&#22343;&#34913;&#22120;&#65292;&#24403;&#28982;&#20063;&#26377;&#19968;&#20123;&#39640;&#36136;&#37327;&#30340;&#24320;&#28304;&#30340;&#36719;&#20214;&#22343;&#34913;&#22120;&#21487;&#20379;&#36873;&#25321;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn229&quot;&gt;Apaches &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mod_proxy&lt;/span&gt;&lt;/tt&gt; &#26159;&#19968;&#20010;&#21487;&#20197;&#32771;&#34385;&#30340;&#36873;&#25321;&#65292;&#20294;&#21478;&#19968;&#20010;&#37197;&#32622;&#26356;&#26834;&#30340;&#36873;&#25321;&#26159;&#65306; memcached&#26159;&#21516;&#19968;&#20010;&#22242;&#38431;&#30340;&#20154;&#20889;&#30340;&#19968;&#20010;&#36127;&#36733;&#22343;&#34913;&#21644;&#21453;&#21521;&#20195;&#29702;&#30340;&#31243;&#24207;.(&#35265;&#31532;15&#31456;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn230&quot;&gt;&#35760;&#24405;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn231&quot;&gt;&#22914;&#26524;&#20320;&#20351;&#29992;FastCGI&#65292;&#20320;&#21516;&#26679;&#21487;&#20197;&#20998;&#31163;&#21069;&#21488;&#30340;web&#26381;&#21153;&#22120;&#65292;&#24182;&#22312;&#22810;&#21488;&#20854;&#20182;&#26426;&#22120;&#19978;&#36816;&#34892;FastCGI&#26381;&#21153;&#22120;&#26469;&#23454;&#29616;&#30456;&#21516;&#30340;&#36127;&#36733;&#22343;&#34913;&#30340;&#21151;&#33021;&#12290; &#21069;&#21488;&#30340;&#26381;&#21153;&#22120;&#23601;&#30456;&#24403;&#20110;&#26159;&#19968;&#20010;&#22343;&#34913;&#22120;&#65292;&#32780;&#21518;&#21488;&#30340;FastCGI&#26381;&#21153;&#36827;&#31243;&#20195;&#26367;&#20102;Apache/mod_python/Django&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn232&quot;&gt;&#29616;&#22312;&#25105;&#20204;&#25317;&#26377;&#20102;&#26381;&#21153;&#22120;&#38598;&#32676;&#65292;&#25105;&#20204;&#30340;&#26500;&#26550;&#24930;&#24930;&#28436;&#21270;&#65292;&#36234;&#26469;&#36234;&#22797;&#26434;&#65292;&#22914;&#22270;20-4&#12290;&lt;/p&gt;
&lt;img alt=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-4.png&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-4.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn231&quot;&gt;&#22270; 20-4&#65306; &#36127;&#36733;&#22343;&#34913;&#30340;&#26381;&#21153;&#22120;&#35774;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn235&quot;&gt;&#20540;&#24471;&#19968;&#25552;&#30340;&#26159;&#65292;&#22312;&#22270;&#20013;&#65292;Web&#26381;&#21153;&#22120;&#25351;&#30340;&#26159;&#19968;&#20010;&#38598;&#32676;&#65292;&#26469;&#34920;&#31034;&#35768;&#22810;&#25968;&#37327;&#30340;&#26381;&#21153;&#22120;&#12290; &#19968;&#26086;&#20320;&#25317;&#26377;&#20102;&#19968;&#20010;&#21069;&#21488;&#30340;&#22343;&#34913;&#22120;&#65292;&#20320;&#23601;&#21487;&#20197;&#24456;&#26041;&#20415;&#22320;&#22686;&#21152;&#21644;&#21024;&#38500;&#21518;&#21488;&#30340;Web&#26381;&#21153;&#22120;&#65292;&#32780;&#19988;&#19981;&#20250;&#36896;&#25104;&#20219;&#20309;&#32593;&#31449;&#19981;&#21487;&#29992;&#30340;&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id32&quot;&gt;
&lt;span id=&quot;cn236&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn236&quot;&gt;&#24930;&#24930;&#21464;&#22823;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn237&quot;&gt;&#19979;&#38754;&#30340;&#36825;&#20123;&#27493;&#39588;&#37117;&#26159;&#19978;&#38754;&#26368;&#21518;&#19968;&#20010;&#30340;&#21464;&#20307;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn238&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn238&quot;&gt;&#24403;&#20320;&#38656;&#35201;&#26356;&#22909;&#30340;&#25968;&#25454;&#24211;&#24615;&#33021;&#65292;&#20320;&#21487;&#33021;&#38656;&#35201;&#22686;&#21152;&#25968;&#25454;&#24211;&#30340;&#20887;&#20313;&#26381;&#21153;&#22120;&#12290; MySQL&#20869;&#32622;&#20102;&#22791;&#20221;&#21151;&#33021;&#65307;PostgreSQL&#24212;&#35813;&#30475;&#19968;&#19979;Slony (&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/slony/&quot;&gt;http://www.djangoproject.com/r/slony/&lt;/a&gt;) &#21644; pgpool (&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/r/pgpool/&quot;&gt;http://www.djangoproject.com/r/pgpool/&lt;/a&gt;) &#65292;&#36825;&#20004;&#20010;&#20998;&#21035;&#26159;&#25968;&#25454;&#24211;&#22791;&#20221;&#21644;&#36830;&#25509;&#27744;&#30340;&#24037;&#20855;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn239&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn239&quot;&gt;&#22914;&#26524;&#21333;&#20010;&#22343;&#34913;&#22120;&#19981;&#33021;&#36798;&#21040;&#35201;&#27714;&#65292;&#20320;&#21487;&#20197;&#22686;&#21152;&#26356;&#22810;&#30340;&#22343;&#34913;&#22120;&#65292;&#24182;&#19988;&#20351;&#29992;&#36718;&#35757;&#65288;round-robin&#65289;DNS&#26469;&#23454;&#29616;&#20998;&#24067;&#35775;&#38382;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn240&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn240&quot;&gt;&#22914;&#26524;&#21333;&#21488;&#23186;&#20307;&#26381;&#21153;&#22120;&#19981;&#22815;&#29992;&#65292;&#20320;&#21487;&#20197;&#22686;&#21152;&#26356;&#22810;&#30340;&#23186;&#20307;&#26381;&#21153;&#22120;&#65292;&#24182;&#36890;&#36807;&#38598;&#32676;&#26469;&#20998;&#24067;&#27969;&#37327;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn241&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn241&quot;&gt;&#22914;&#26524;&#20320;&#38656;&#35201;&#26356;&#22810;&#30340;&#39640;&#36895;&#32531;&#23384;&#65288;cache&#65289;&#65292;&#20320;&#21487;&#20197;&#22686;&#21152;cache&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn242&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn242&quot;&gt;&#22312;&#20219;&#20309;&#24773;&#20917;&#19979;&#65292;&#21482;&#35201;&#38598;&#32676;&#24037;&#20316;&#24615;&#33021;&#19981;&#22909;&#65292;&#20320;&#37117;&#21487;&#20197;&#24448;&#19978;&#22686;&#21152;&#26381;&#21153;&#22120;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn243&quot;&gt;&#37325;&#22797;&#20102;&#20960;&#27425;&#20197;&#21518;&#65292;&#19968;&#20010;&#22823;&#35268;&#27169;&#30340;&#26500;&#26550;&#20250;&#20687;&#22270;20-5&#12290;&lt;/p&gt;
&lt;img alt=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-5.png&quot; src=&quot;http://new-media.djangobook.com/content/en/1.0/chapter20/scaling-5.png&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn243&quot;&gt;&#22270; 20-5&#12290; &#22823;&#35268;&#27169;&#30340;Django&#23433;&#35013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn246&quot;&gt;&#23613;&#31649;&#25105;&#20204;&#21482;&#26159;&#22312;&#27599;&#19968;&#23618;&#19978;&#23637;&#31034;&#20102;&#20004;&#21040;&#19977;&#21488;&#26381;&#21153;&#22120;&#65292;&#20320;&#21487;&#20197;&#22312;&#19978;&#38754;&#38543;&#24847;&#22320;&#22686;&#21152;&#26356;&#22810;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id33&quot;&gt;
&lt;span id=&quot;cn247&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn247&quot;&gt;&#24615;&#33021;&#20248;&#21270;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn248&quot;&gt;&#22914;&#26524;&#20320;&#26377;&#22823;&#31508;&#22823;&#31508;&#30340;&#38065;&#65292;&#36935;&#21040;&#25193;&#23637;&#24615;&#38382;&#39064;&#26102;&#65292;&#20320;&#21487;&#20197;&#31616;&#21333;&#22320;&#25237;&#36164;&#30828;&#20214;&#12290; &#23545;&#20110;&#21097;&#19979;&#30340;&#20154;&#26469;&#35828;&#65292;&#24615;&#33021;&#20248;&#21270;&#23601;&#26159;&#24517;&#39035;&#35201;&#20570;&#30340;&#19968;&#20214;&#20107;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn249&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn250&quot;&gt;&#39034;&#20415;&#25552;&#19968;&#21477;&#65292;&#35841;&#35201;&#26159;&#26377;&#22823;&#31508;&#22823;&#31508;&#30340;&#38046;&#31080;&#65292;&#35831;&#25424;&#21161;&#19968;&#28857;Django&#39033;&#30446;&#12290; &#25105;&#20204;&#20063;&#25509;&#21463;&#26410;&#20999;&#21106;&#30340;&#38075;&#30707;&#21644;&#37329;&#24065;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn251&quot;&gt;&#19981;&#24184;&#30340;&#26159;&#65292;&#24615;&#33021;&#20248;&#21270;&#27604;&#36215;&#31185;&#23398;&#26469;&#35828;&#26356;&#20687;&#26159;&#19968;&#31181;&#33402;&#26415;&#65292;&#24182;&#19988;&#36825;&#27604;&#25193;&#23637;&#24615;&#26356;&#38590;&#25551;&#36848;&#12290; &#22914;&#26524;&#20320;&#30495;&#24819;&#35201;&#26500;&#24314;&#19968;&#20010;&#22823;&#35268;&#27169;&#30340;Django&#24212;&#29992;&#65292;&#20320;&#38656;&#35201;&#33457;&#22823;&#37327;&#30340;&#26102;&#38388;&#21644;&#31934;&#21147;&#23398;&#20064;&#22914;&#20309;&#20248;&#21270;&#26500;&#26550;&#20013;&#30340;&#27599;&#19968;&#37096;&#20998;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn252&quot;&gt;&#20197;&#19979;&#37096;&#20998;&#24635;&#32467;&#20102;&#22810;&#24180;&#20197;&#26469;&#30340;&#32463;&#39564;&#65292;&#26159;&#19968;&#20123;&#19987;&#23646;&#20110;Django&#30340;&#20248;&#21270;&#25216;&#24039;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;ram&quot;&gt;
&lt;span id=&quot;cn253&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn253&quot;&gt;RAM&#24590;&#20040;&#20063;&#19981;&#23244;&#22810;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn254&quot;&gt;&#26368;&#36817;&#21363;&#20351;&#37027;&#20123;&#26114;&#36149;&#30340;RAM&#20063;&#30456;&#23545;&#26469;&#35828;&#21487;&#20197;&#36127;&#25285;&#30340;&#36215;&#20102;&#12290; &#36141;&#20080;&#23613;&#21487;&#33021;&#22810;&#30340;RAM&#65292;&#20877;&#22312;&#21035;&#30340;&#19978;&#38754;&#25237;&#36164;&#19968;&#28857;&#28857;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn255&quot;&gt;&#39640;&#36895;&#30340;&#22788;&#29702;&#22120;&#24182;&#19981;&#20250;&#22823;&#24133;&#24230;&#22320;&#25552;&#39640;&#24615;&#33021;&#65307;&#22823;&#22810;&#25968;&#30340;Web&#26381;&#21153;&#22120;90%&#30340;&#26102;&#38388;&#37117;&#28010;&#36153;&#22312;&#20102;&#30828;&#30424;IO&#19978;&#12290; &#24403;&#30828;&#30424;&#19978;&#30340;&#25968;&#25454;&#24320;&#22987;&#20132;&#25442;&#65292;&#24615;&#33021;&#23601;&#24613;&#21095;&#19979;&#38477;&#12290; &#26356;&#24555;&#36895;&#30340;&#30828;&#30424;&#21487;&#20197;&#25913;&#21892;&#36825;&#20010;&#38382;&#39064;&#65292;&#20294;&#26159;&#27604;&#36215;RAM&#26469;&#35828;&#65292;&#37027;&#22826;&#36149;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn256&quot;&gt;&#22914;&#26524;&#20320;&#25317;&#26377;&#22810;&#21488;&#26381;&#21153;&#22120;&#65292;&#39318;&#35201;&#30340;&#26159;&#35201;&#22312;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#19978;&#22686;&#21152;&#20869;&#23384;&#12290; &#22914;&#26524;&#20320;&#33021;&#36127;&#25285;&#24471;&#36215;&#65292;&#25226;&#20320;&#25972;&#20010;&#25968;&#25454;&#24211;&#37117;&#25918;&#20837;&#21040;&#20869;&#23384;&#20013;&#12290; &#36825;&#24212;&#35813;&#19981;&#26159;&#24456;&#22256;&#38590;&#65292;&#25105;&#20204;&#24050;&#32463;&#24320;&#21457;&#36807;&#19968;&#20010;&#31449;&#28857;&#19978;&#38754;&#26377;&#22810;&#20110;&#19968;&#30334;&#19975;&#26465;&#25253;&#21002;&#25991;&#31456;&#65292;&#36825;&#20010;&#31449;&#28857;&#20351;&#29992;&#20102;&#19981;&#21040;2GB&#30340;&#31354;&#38388;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn257&quot;&gt;&#19979;&#19968;&#27493;&#65292;&#26368;&#22823;&#21270;Web&#26381;&#21153;&#22120;&#19978;&#30340;&#20869;&#23384;&#12290; &#26368;&#29702;&#24819;&#30340;&#24773;&#20917;&#26159;&#65292;&#27809;&#26377;&#19968;&#21488;&#26381;&#21153;&#22120;&#36827;&#34892;&#30913;&#30424;&#20132;&#25442;&#12290; &#22914;&#26524;&#20320;&#36798;&#21040;&#20102;&#36825;&#20010;&#27700;&#24179;&#65292;&#20320;&#23601;&#33021;&#24212;&#20184;&#22823;&#22810;&#25968;&#27491;&#24120;&#30340;&#27969;&#37327;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;keep-alive&quot;&gt;
&lt;span id=&quot;cn258&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn258&quot;&gt;&#31105;&#29992; Keep-Alive&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn259&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Keep-Alive&lt;/span&gt;&lt;/tt&gt; &#26159;HTTP&#25552;&#20379;&#30340;&#21151;&#33021;&#20043;&#19968;&#65292;&#23427;&#30340;&#30446;&#30340;&#26159;&#20801;&#35768;&#22810;&#20010;HTTP&#35831;&#27714;&#22797;&#29992;&#19968;&#20010;TCP&#36830;&#25509;&#65292;&#20063;&#23601;&#26159;&#20801;&#35768;&#22312;&#21516;&#19968;&#20010;TCP&#36830;&#25509;&#19978;&#21457;&#36215;&#22810;&#20010;HTTP&#35831;&#27714;&#65292;&#36825;&#26679;&#26377;&#25928;&#30340;&#36991;&#20813;&#20102;&#27599;&#20010;HTTP&#35831;&#27714;&#37117;&#37325;&#26032;&#24314;&#31435;&#33258;&#24049;&#30340;TCP&#36830;&#25509;&#30340;&#24320;&#38144;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn260&quot;&gt;&#36825;&#19968;&#30524;&#30475;&#19978;&#21435;&#26159;&#22909;&#20107;&#65292;&#20294;&#23427;&#36275;&#20197;&#26432;&#27515;Django&#31449;&#28857;&#30340;&#24615;&#33021;&#12290; &#22914;&#26524;&#20320;&#20174;&#21333;&#29420;&#30340;&#23186;&#20307;&#26381;&#21153;&#22120;&#19978;&#21521;&#29992;&#25143;&#25552;&#20379;&#26381;&#21153;&#65292;&#27599;&#20010;&#20809;&#39038;&#20320;&#31449;&#28857;&#30340;&#29992;&#25143;&#37117;&#22823;&#32422;10&#31186;&#38047;&#24038;&#21491;&#21457;&#20986;&#19968;&#27425;&#35831;&#27714;&#12290; &#36825;&#23601;&#20351;&#24471;HTTP&#26381;&#21153;&#22120;&#19968;&#30452;&#22312;&#31561;&#24453;&#19979;&#19968;&#27425;keep-alive &#30340;&#35831;&#27714;&#65292;&#31354;&#38386;&#30340;HTTP&#26381;&#21153;&#22120;&#21644;&#24037;&#20316;&#26102;&#28040;&#32791;&#19968;&#26679;&#22810;&#30340;&#20869;&#23384;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;memcached&quot;&gt;
&lt;span id=&quot;cn261&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn261&quot;&gt;&#20351;&#29992; memcached&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn262&quot;&gt;&#23613;&#31649;Django&#25903;&#25345;&#22810;&#31181;&#19981;&#21516;&#30340;cache&#21518;&#21488;&#26426;&#21046;&#65292;&#27809;&#26377;&#19968;&#31181;&#30340;&#24615;&#33021;&#21487;&#20197; &lt;em&gt;&#25509;&#36817;&lt;/em&gt; memcached&#12290; &#22914;&#26524;&#20320;&#26377;&#19968;&#20010;&#39640;&#27969;&#37327;&#30340;&#31449;&#28857;&#65292;&#19981;&#35201;&#29369;&#35947;&#65292;&#30452;&#25509;&#36873;&#25321;memcached&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id34&quot;&gt;
&lt;span id=&quot;cn263&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn263&quot;&gt;&#32463;&#24120;&#20351;&#29992;memcached&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn264&quot;&gt;&#24403;&#28982;&#65292;&#36873;&#25321;&#20102;memcached&#32780;&#19981;&#21435;&#20351;&#29992;&#23427;&#65292;&#20320;&#19981;&#20250;&#20174;&#20013;&#33719;&#24471;&#20219;&#20309;&#24615;&#33021;&#19978;&#30340;&#25552;&#21319;&#12290; &lt;a class=&quot;reference external&quot; href=&quot;../chapter15/&quot;&gt;Chapter
15&lt;/a&gt; is your best friend here: &#23398;&#20064;&#22914;&#20309;&#20351;&#29992;Django&#30340;cache&#26694;&#26550;&#65292;&#24182;&#19988;&#23613;&#21487;&#33021;&#22320;&#20351;&#29992;&#23427;&#12290; &#22823;&#37327;&#30340;&#21487;&#25250;&#21344;&#24335;&#30340;&#39640;&#36895;&#32531;&#23384;&#36890;&#24120;&#26159;&#19968;&#20010;&#31449;&#28857;&#22312;&#22823;&#27969;&#37327;&#19979;&#27491;&#24120;&#24037;&#20316;&#30340;&#21807;&#19968;&#29942;&#39048;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id35&quot;&gt;
&lt;span id=&quot;cn265&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn265&quot;&gt;&#21442;&#21152;&#35752;&#35770;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn266&quot;&gt;Django&#30456;&#20851;&#30340;&#27599;&#19968;&#20010;&#37096;&#20998;&#65292;&#20174;Linux&#21040;Apache&#21040;PostgreSQL&#25110;&#32773;MySQL&#32972;&#21518;&#65292;&#37117;&#26377;&#19968;&#20010;&#38750;&#24120;&#26834;&#30340;&#31038;&#21306;&#25903;&#25345;&#12290; &#22914;&#26524;&#20320;&#30495;&#24819;&#20174;&#20320;&#30340;&#26381;&#21153;&#22120;&#19978;&#27048;&#24178;&#26368;&#21518;1%&#30340;&#24615;&#33021;&#65292;&#21152;&#20837;&#24320;&#28304;&#31038;&#21306;&#23547;&#27714;&#24110;&#21161;&#12290; &#22810;&#25968;&#30340;&#33258;&#30001;&#36719;&#20214;&#31038;&#21306;&#25104;&#21592;&#37117;&#20250;&#24456;&#20048;&#24847;&#22320;&#25552;&#20379;&#24110;&#21161;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn267&quot;&gt;&#21035;&#24536;&#20102;Django&#31038;&#21306;&#12290; &#36825;&#26412;&#20070;&#35878;&#36874;&#30340;&#20316;&#32773;&#21482;&#26159;Django&#24320;&#21457;&#22242;&#38431;&#20013;&#30340;&#20004;&#20301;&#25104;&#21592;&#12290; &#25105;&#20204;&#30340;&#31038;&#21306;&#26377;&#22823;&#37327;&#30340;&#32463;&#39564;&#21487;&#20197;&#25552;&#20379;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id36&quot;&gt;
&lt;span id=&quot;cn268&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn268&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn269&quot;&gt;&#19979;&#38754;&#30340;&#31456;&#33410;&#38598;&#20013;&#22312;&#20854;&#20182;&#30340;&#19968;&#20123;Django&#29305;&#24615;&#19978;&#65292;&#20320;&#26159;&#21542;&#38656;&#35201;&#23427;&#20204;&#21462;&#20915;&#20110;&#20320;&#30340;&#24212;&#29992;&#39033;&#30446;&#12290; &#21487;&#20197;&#33258;&#30001;&#36873;&#25321;&#38405;&#35835;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter13</id>
        <title type="html">chapter13</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter13"/>
        <published>2015-02-26T23:19:33+08:00</published>
        <updated>2015-02-26T23:19:33+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;html&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#21313;&#19977;&#31456;&#65306; &#36755;&#20986;&#38750;HTML&#20869;&#23481;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#36890;&#24120;&#24403;&#25105;&#20204;&#35848;&#21040;&#24320;&#21457;&#32593;&#31449;&#26102;&#65292;&#20027;&#35201;&#35848;&#35770;&#30340;&#26159;HTML&#12290;
&#24403;&#28982;&#65292;Web&#36828;&#19981;&#21482;&#26377;HTML&#65292;&#25105;&#20204;&#22312;Web&#19978;&#29992;&#22810;&#31181;&#26684;&#24335;&#26469;&#21457;&#24067;&#25968;&#25454;&#65306; RSS&#12289;PDF&#12289;&#22270;&#29255;&#31561;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#21040;&#30446;&#21069;&#20026;&#27490;&#65292;&#25105;&#20204;&#30340;&#27880;&#24847;&#21147;&#37117;&#26159;&#25918;&#22312;&#24120;&#35265; HTML &#20195;&#30721;&#29983;&#25104;&#19978;&#65292;&#20294;&#26159;&#22312;&#36825;&#19968;&#31456;&#20013;&#65292;&#25105;&#20204;&#23558;&#20250;&#23545;&#20351;&#29992; Django &#29983;&#25104;&#20854;&#23427;&#26684;&#24335;&#30340;&#20869;&#23481;&#36827;&#34892;&#31616;&#35201;&#20171;&#32461;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;Django&#25317;&#26377;&#19968;&#20123;&#20415;&#21033;&#30340;&#20869;&#24314;&#24037;&#20855;&#24110;&#21161;&#20320;&#29983;&#25104;&#24120;&#35265;&#30340;&#38750;HTML&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn4&quot;&gt;RSS/Atom &#32858;&#21512;&#25991;&#20214;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn5&quot;&gt;&#31449;&#28857;&#22320;&#22270; &#65288;&#19968;&#20010;XML&#26684;&#24335;&#25991;&#20214;&#65292;&#26368;&#21021;&#30001;Google&#24320;&#21457;&#65292;&#29992;&#20110;&#32473;&#25628;&#32034;&#24341;&#25806;&#25552;&#31034;&#32447;&#32034;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&#25105;&#20204;&#31245;&#21518;&#20250;&#36880;&#19968;&#30740;&#31350;&#36825;&#20123;&#24037;&#20855;&#65292;&#19981;&#36807;&#39318;&#20808;&#35753;&#25105;&#20204;&#26469;&#20102;&#35299;&#20123;&#22522;&#30784;&#21407;&#29702;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;mime&quot;&gt;
&lt;span id=&quot;cn7&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#22522;&#30784;&#65306; &#35270;&#22270;&#21644;MIME&#31867;&#22411;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#22238;&#39038;&#19968;&#19979;&#31532;&#19977;&#31456;&#65292;&#35270;&#22270;&#20989;&#25968;&#21482;&#26159;&#19968;&#20010;&#20197;Web&#35831;&#27714;&#20026;&#21442;&#25968;&#24182;&#36820;&#22238;Web&#21709;&#24212;&#30340;Python&#20989;&#25968;&#12290; &#36825;&#20010;&#21709;&#24212;&#21487;&#20197;&#26159;&#19968;&#20010;Web&#39029;&#38754;&#30340;HTML&#20869;&#23481;&#65292;&#25110;&#32773;&#19968;&#20010;&#36339;&#36716;&#65292;&#25110;&#32773;&#19968;&#20010;404 &#38169;&#35823;&#65292;&#25110;&#32773;&#19968;&#20010;XML&#25991;&#26723;&#65292;&#25110;&#32773;&#19968;&#24133;&#22270;&#29255;&#65292;&#25110;&#32773;&#26144;&#23556;&#21040;&#20219;&#20309;&#19996;&#35199;&#19978;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#26356;&#27491;&#24335;&#30340;&#35828;&#65292;&#19968;&#20010;Django&#35270;&#22270;&#20989;&#25968; &lt;em&gt;&#24517;&#39035;&lt;/em&gt;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn10&quot;&gt;&#25509;&#21463;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&#20316;&#20026;&#23427;&#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn11&quot;&gt;&#36820;&#22238;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&#20174;&#19968;&#20010;&#35270;&#22270;&#36820;&#22238;&#19968;&#20010;&#38750; HTML &#20869;&#23481;&#30340;&#20851;&#38190;&#26159;&#22312;&#26500;&#36896;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#31867;&#26102;&#65292;&#38656;&#35201;&#25351;&#23450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mimetype&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#12290; &#36890;&#36807;&#25913;&#21464; MIME &#31867;&#22411;&#65292;&#25105;&#20204;&#21487;&#20197;&#36890;&#30693;&#27983;&#35272;&#22120;&#23558;&#35201;&#36820;&#22238;&#30340;&#25968;&#25454;&#26159;&#21478;&#19968;&#31181;&#31867;&#22411;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&#19979;&#38754;&#25105;&#20204;&#20197;&#36820;&#22238;&#19968;&#24352;PNG&#22270;&#29255;&#30340;&#35270;&#22270;&#20026;&#20363;&#12290; &#20026;&#20102;&#20351;&#20107;&#24773;&#33021;&#23613;&#21487;&#33021;&#30340;&#31616;&#21333;&#65292;&#25105;&#20204;&#21482;&#26159;&#35835;&#20837;&#19968;&#24352;&#23384;&#20648;&#22312;&#30913;&#30424;&#19978;&#30340;&#22270;&#29255;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn15&quot;&gt;from django.http import HttpResponse

def my_image(request):
    image_data = open(&quot;/path/to/my/image.png&quot;, &quot;rb&quot;).read()
    return HttpResponse(image_data, mimetype=&quot;image/png&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#23601;&#26159;&#36825;&#20040;&#31616;&#21333;&#12290; &#22914;&#26524;&#25913;&#21464; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;open()&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#22270;&#29255;&#36335;&#24452;&#20026;&#19968;&#24352;&#30495;&#23454;&#22270;&#29255;&#30340;&#36335;&#24452;&#65292;&#37027;&#20040;&#23601;&#21487;&#20197;&#20351;&#29992;&#36825;&#20010;&#21313;&#20998;&#31616;&#21333;&#30340;&#35270;&#22270;&#26469;&#25552;&#20379;&#19968;&#24352;&#22270;&#29255;&#65292;&#24182;&#19988;&#27983;&#35272;&#22120;&#21487;&#20197;&#27491;&#30830;&#26174;&#31034;&#23427;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#21478;&#22806;&#25105;&#20204;&#24517;&#39035;&#20102;&#35299;&#30340;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#23454;&#29616;&#20102;Python&#26631;&#20934;&#30340;&#25991;&#20214;&#24212;&#29992;&#31243;&#24207;&#25509;&#21475;(API)&#12290; &#36825;&#23601;&#26159;&#35828;&#20320;&#21487;&#20197;&#22312;Python&#65288;&#25110;&#31532;&#19977;&#26041;&#24211;&#65289;&#20219;&#20309;&#29992;&#21040;&#25991;&#20214;&#30340;&#22320;&#26041;&#20351;&#29992;&#8221;HttpResponse&#8221;&#23454;&#20363;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#19979;&#38754;&#23558;&#29992; Django &#29983;&#25104; CSV &#25991;&#20214;&#20026;&#20363;&#65292;&#35828;&#26126;&#23427;&#30340;&#24037;&#20316;&#21407;&#29702;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;csv&quot;&gt;
&lt;span id=&quot;cn19&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#29983;&#25104; CSV &#25991;&#20214;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;CSV &#26159;&#19968;&#31181;&#31616;&#21333;&#30340;&#25968;&#25454;&#26684;&#24335;&#65292;&#36890;&#24120;&#20026;&#30005;&#23376;&#34920;&#26684;&#36719;&#20214;&#25152;&#20351;&#29992;&#12290; &#23427;&#20027;&#35201;&#26159;&#30001;&#19968;&#31995;&#21015;&#30340;&#34920;&#26684;&#34892;&#32452;&#25104;&#65292;&#27599;&#34892;&#20013;&#21333;&#20803;&#26684;&#20043;&#38388;&#20351;&#29992;&#36887;&#21495;(CSV &#26159; &lt;em&gt;&#36887;&#21495;&#20998;&#38548;&#25968;&#20540;(comma-separated values)&lt;/em&gt; &#30340;&#32553;&#20889;)&#38548;&#24320;&#12290;&#20363;&#22914;&#65292;&#19979;&#38754;&#26159;CSV&#26684;&#24335;&#30340;&#8220;&#19981;&#23432;&#35268;&#30697;&#8221;&#30340;&#39134;&#26426;&#20056;&#23458;&#34920;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn22&quot;&gt;Year,Unruly Airline Passengers
1995,146
1996,184
1997,235
1998,200
1999,226
2000,251
2001,299
2002,273
2003,281
2004,304
2005,203
2006,134
2007,147
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#22791;&#27880;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#21069;&#38754;&#30340;&#21015;&#34920;&#21253;&#21547;&#30495;&#23454;&#25968;&#25454;&#12290; &#36825;&#20123;&#25968;&#25454;&#26469;&#33258;&#32654;&#22269; &#32852;&#37030;&#33322;&#31354;&#31649;&#29702;&#23616;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;CSV&#26684;&#24335;&#23613;&#31649;&#30475;&#36215;&#26469;&#31616;&#21333;&#65292;&#21364;&#26159;&#20840;&#29699;&#36890;&#29992;&#30340;&#12290; &#20294;&#26159;&#19981;&#21516;&#30340;&#36719;&#20214;&#20250;&#29983;&#25104;&#21644;&#20351;&#29992;&#19981;&#21516;&#30340; CSV &#30340;&#21464;&#31181;&#65292;&#22312;&#20351;&#29992;&#19978;&#20250;&#26377;&#19968;&#20123;&#19981;&#20415;&#12290; &#24184;&#36816;&#30340;&#26159;&#65292; Python &#20351;&#29992;&#30340;&#26159;&#26631;&#20934; CSV &#24211;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csv&lt;/span&gt;&lt;/tt&gt; &#65292;&#25152;&#20197;&#23427;&#26356;&#36890;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&#22240;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csv&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#25805;&#20316;&#30340;&#26159;&#31867;&#20284;&#25991;&#20214;&#30340;&#23545;&#35937;&#65292;&#25152;&#20197;&#21487;&#20197;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#26367;&#25442;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn28&quot;&gt;import csv
from django.http import HttpResponse

# Number of unruly passengers each year 1995 - 2005. In a real application
# this would likely come from a database or some other back-end data store.
UNRULY_PASSENGERS = [146,184,235,200,226,251,299,273,281,304,203]

def unruly_passengers_csv(request):
    # Create the HttpResponse object with the appropriate CSV header.
    response = HttpResponse(mimetype=&apos;text/csv&apos;)
    response[&apos;Content-Disposition&apos;] = &apos;attachment; filename=unruly.csv&apos;

    # Create the CSV writer using the HttpResponse as the &quot;file.&quot;
    writer = csv.writer(response)
    writer.writerow([&apos;Year&apos;, &apos;Unruly Airline Passengers&apos;])
    for (year, num) in zip(range(1995, 2006), UNRULY_PASSENGERS):
        writer.writerow([year, num])

    return response
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#20195;&#30721;&#21644;&#27880;&#37322;&#21487;&#20197;&#35828;&#26159;&#24456;&#28165;&#26970;&#65292;&#20294;&#36824;&#26377;&#19968;&#20123;&#20107;&#24773;&#38656;&#35201;&#29305;&#21035;&#27880;&#24847;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#21709;&#24212;&#36820;&#22238;&#30340;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;text/csv&lt;/span&gt;&lt;/tt&gt; MIME&#31867;&#22411;&#65288;&#32780;&#38750;&#40664;&#35748;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;text/html&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290;&#36825;&#20250;&#21578;&#35785;&#27983;&#35272;&#22120;&#65292;&#36820;&#22238;&#30340;&#25991;&#26723;&#26159;CSV&#25991;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#21709;&#24212;&#20250;&#26377;&#19968;&#20010;&#38468;&#21152;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Content-Disposition&lt;/span&gt;&lt;/tt&gt; &#22836;&#37096;&#65292;&#23427;&#21253;&#21547;&#26377;CSV&#25991;&#20214;&#30340;&#25991;&#20214;&#21517;&#12290; &#36825;&#20010;&#22836;&#37096;&#65288;&#25110;&#32773;&#35828;&#65292;&#38468;&#21152;&#37096;&#20998;&#65289;&#20250;&#25351;&#31034;&#27983;&#35272;&#22120;&#24377;&#20986;&#23545;&#35805;&#26694;&#35810;&#38382;&#25991;&#20214;&#23384;&#25918;&#30340;&#20301;&#32622;&#65288;&#32780;&#19981;&#20165;&#20165;&#26159;&#26174;&#31034;&#65289;&#12290; &#36825;&#20010;&#25991;&#20214;&#21517;&#26159;&#20219;&#24847;&#30340;&#12290; &#23427;&#20250;&#26174;&#31034;&#22312;&#27983;&#35272;&#22120;&#30340;&#21478;&#23384;&#20026;&#23545;&#35805;&#26694;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#35201;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt;&#25351;&#23450;&#22836;&#37096;&#20449;&#24687;&#65292;&#21482;&#38656;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt;&#24403;&#20570;&#23383;&#20856;&#20351;&#29992;&#23601;&#21487;&#20197;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#19982;&#21019;&#24314;CSV&#30340;&#24212;&#29992;&#31243;&#24207;&#30028;&#38754;&#65288;API&#65289;&#25346;&#25509;&#26159;&#24456;&#23481;&#26131;&#30340;&#65306; &#21482;&#38656;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;response&lt;/span&gt;&lt;/tt&gt; &#20316;&#20026;&#31532;&#19968;&#20010;&#21464;&#37327;&#20256;&#36882;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csv.writer&lt;/span&gt;&lt;/tt&gt; &#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csv.writer&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#38656;&#35201;&#19968;&#20010;&#25991;&#20214;&#31867;&#30340;&#23545;&#35937;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#27491;&#22909;&#33021;&#36798;&#25104;&#36825;&#20010;&#30446;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;writer.writerow&lt;/span&gt;&lt;/tt&gt; &#65292;&#24182;&#19988;&#20256;&#36882;&#32473;&#23427;&#19968;&#20010;&#31867;&#20284; list &#25110;&#32773; tuple &#30340;&#21487;&#36845;&#20195;&#23545;&#35937;&#65292;&#23601;&#21487;&#20197;&#22312; CSV &#25991;&#20214;&#20013;&#20889;&#20837;&#19968;&#34892;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;CSV &#27169;&#22359;&#32771;&#34385;&#21040;&#20102;&#24341;&#29992;&#30340;&#38382;&#39064;&#65292;&#25152;&#20197;&#24744;&#19981;&#29992;&#25285;&#24515;&#36920;&#20986;&#23383;&#31526;&#20018;&#20013;&#24341;&#21495;&#21644;&#36887;&#21495;&#12290; &#21482;&#35201;&#25226;&#20449;&#24687;&#20256;&#36882;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;writerow()&lt;/span&gt;&lt;/tt&gt; &#65292;&#23427;&#20250;&#22788;&#29702;&#22909;&#25152;&#26377;&#30340;&#20107;&#24773;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&#22312;&#20219;&#20309;&#38656;&#35201;&#36820;&#22238;&#38750; HTML &#20869;&#23481;&#30340;&#26102;&#20505;&#65292;&#37117;&#38656;&#35201;&#32463;&#36807;&#20197;&#19979;&#20960;&#27493;&#65306;
&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#21709;&#24212;&#23545;&#35937;&#65288;&#38656;&#35201;&#25351;&#23450;&#29305;&#27530;&#30340; MIME &#31867;&#22411;&#65289;&#65292;&#23427;&#23427;&#20256;&#32473;&#38656;&#35201;&#22788;&#29702;&#25991;&#20214;&#30340;&#20989;&#25968;&#65292;&#28982;&#21518;&#36820;&#22238;&#36825;&#20010;&#21709;&#24212;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20123;&#20854;&#23427;&#30340;&#20363;&#23376;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;pdf&quot;&gt;
&lt;span id=&quot;cn38&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#29983;&#25104; PDF &#25991;&#20214;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&#20415;&#25658;&#25991;&#26723;&#26684;&#24335; (PDF) &#26159;&#30001; Adobe &#24320;&#21457;&#30340;&#26684;&#24335;&#65292;&#20027;&#35201;&#29992;&#20110;&#21576;&#29616;&#21487;&#25171;&#21360;&#30340;&#25991;&#26723;&#65292;&#20854;&#20013;&#21253;&#21547;&#26377; pixel-perfect &#26684;&#24335;&#65292;&#23884;&#20837;&#23383;&#20307;&#20197;&#21450;2D&#30690;&#37327;&#22270;&#20687;&#12290; You can think of a PDF document as the digital
equivalent of a printed document; indeed, PDFs are often used in distributing
documents for the purpose of printing them.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn40&quot;&gt;&#21487;&#20197;&#26041;&#20415;&#30340;&#20351;&#29992; Python &#21644; Django &#29983;&#25104; PDF &#25991;&#26723;&#38656;&#35201;&#24402;&#21151;&#20110;&#19968;&#20010;&#20986;&#33394;&#30340;&#24320;&#28304;&#24211;&#65292; ReportLab (&lt;a class=&quot;reference external&quot; href=&quot;http://www.reportlab.org/rl_toolkit.html&quot;&gt;http://www.reportlab.org/rl_toolkit.html&lt;/a&gt;) &#12290;&#21160;&#24577;&#29983;&#25104; PDF &#25991;&#20214;&#30340;&#22909;&#22788;&#26159;&#22312;&#19981;&#21516;&#30340;&#24773;&#20917;&#19979;&#65292;&#22914;&#19981;&#21516;&#30340;&#29992;&#25143;&#25110;&#32773;&#19981;&#21516;&#30340;&#20869;&#23481;&#65292;&#21487;&#20197;&#25353;&#38656;&#29983;&#25104;&#19981;&#21516;&#30340; PDF &#25991;&#20214;&#12290; The
advantage of generating PDF files dynamically is that you can create customized PDFs
for different purposes say, for different users or different pieces of content.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#19979;&#38754;&#30340;&#20363;&#23376;&#26159;&#20351;&#29992; Django &#21644; ReportLab &#22312; KUSports.com &#19978;&#29983;&#25104;&#20010;&#24615;&#21270;&#30340;&#21487;&#25171;&#21360;&#30340; NCAA &#36187;&#31243;&#34920; (tournament brackets) &#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;reportlab&quot;&gt;
&lt;span id=&quot;cn42&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#23433;&#35013; ReportLab&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&#22312;&#29983;&#25104; PDF &#25991;&#20214;&#20043;&#21069;&#65292;&#38656;&#35201;&#23433;&#35013; ReportLab &#24211;&#12290;&#36825;&#36890;&#24120;&#26159;&#20010;&#24456;&#31616;&#21333;&#30340;&#36807;&#31243;&#65306; Its
usually simple: just download and install the library from
&lt;a class=&quot;reference external&quot; href=&quot;http://www.reportlab.org/downloads.html&quot;&gt;http://www.reportlab.org/downloads.html&lt;/a&gt;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;Note&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#22914;&#26524;&#20351;&#29992;&#30340;&#26159;&#19968;&#20123;&#26032;&#30340; Linux &#21457;&#34892;&#29256;&#65292;&#21017;&#22312;&#23433;&#35013;&#21069;&#21487;&#20197;&#20808;&#26816;&#26597;&#21253;&#31649;&#29702;&#36719;&#20214;&#12290; &#22810;&#25968;&#36719;&#20214;&#21253;&#20179;&#24211;&#20013;&#37117;&#21152;&#20837;&#20102; ReportLab &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#27604;&#22914;&#65292;&#22914;&#26524;&#20351;&#29992;&#65288;&#26480;&#20986;&#30340;&#65289; Ubuntu &#21457;&#34892;&#29256;&#65292;&#21482;&#38656;&#35201;&#31616;&#21333;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;python-reportlab&lt;/span&gt;&lt;/tt&gt; &#19968;&#34892;&#21629;&#20196;&#21363;&#21487;&#23436;&#25104;&#23433;&#35013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#20351;&#29992;&#25163;&#20876;&#65288;&#21407;&#22987;&#30340;&#21482;&#26377; PDF &#26684;&#24335;&#65289;&#21487;&#20197;&#20174; &lt;a class=&quot;reference external&quot; href=&quot;http://www.reportlab.org/rsrc/userguide.pdf&quot;&gt;http://www.reportlab.org/rsrc/userguide.pdf&lt;/a&gt; &#19979;&#36733;&#65292;&#20854;&#20013;&#21253;&#21547;&#26377;&#19968;&#20123;&#20854;&#23427;&#30340;&#23433;&#35013;&#25351;&#21335;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#22312; Python &#20132;&#20114;&#29615;&#22659;&#20013;&#23548;&#20837;&#36825;&#20010;&#36719;&#20214;&#21253;&#20197;&#26816;&#26597;&#23433;&#35013;&#26159;&#21542;&#25104;&#21151;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn50&quot;&gt;&amp;gt;&amp;gt;&amp;gt; import reportlab
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&#22914;&#26524;&#21018;&#25165;&#37027;&#26465;&#21629;&#20196;&#27809;&#26377;&#20986;&#29616;&#20219;&#20309;&#38169;&#35823;&#65292;&#21017;&#34920;&#26126;&#23433;&#35013;&#25104;&#21151;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id1&quot;&gt;
&lt;span id=&quot;cn52&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#32534;&#20889;&#35270;&#22270;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#21644; CSV &#31867;&#20284;&#65292;&#30001; Django &#21160;&#24577;&#29983;&#25104; PDF &#25991;&#20214;&#24456;&#31616;&#21333;&#65292;&#22240;&#20026; ReportLab API &#21516;&#26679;&#21487;&#20197;&#20351;&#29992;&#31867;&#20284;&#25991;&#20214;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20010; Hello World &#30340;&#31034;&#20363;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn56&quot;&gt;from reportlab.pdfgen import canvas
from django.http import HttpResponse

def hello_pdf(request):
    # Create the HttpResponse object with the appropriate PDF headers.
    response = HttpResponse(mimetype=&apos;application/pdf&apos;)
    response[&apos;Content-Disposition&apos;] = &apos;attachment; filename=hello.pdf&apos;

    # Create the PDF object, using the response object as its &quot;file.&quot;
    p = canvas.Canvas(response)

    # Draw things on the PDF. Here&apos;s where the PDF generation happens.
    # See the ReportLab documentation for the full list of functionality.
    p.drawString(100, 100, &quot;Hello world.&quot;)

    # Close the PDF object cleanly, and we&apos;re done.
    p.showPage()
    p.save()
    return response
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#38656;&#35201;&#27880;&#24847;&#20197;&#19979;&#20960;&#28857;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn58&quot;&gt;&#36825;&#37324;&#25105;&#20204;&#20351;&#29992;&#30340; MIME &#31867;&#22411;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;application/pdf&lt;/span&gt;&lt;/tt&gt; &#12290;&#36825;&#20250;&#21578;&#35785;&#27983;&#35272;&#22120;&#36825;&#20010;&#25991;&#26723;&#26159;&#19968;&#20010; PDF &#25991;&#26723;&#65292;&#32780;&#19981;&#26159; HTML &#25991;&#26723;&#12290; &#22914;&#26524;&#24573;&#30053;&#20102;&#36825;&#20010;&#21442;&#25968;&#65292;&#27983;&#35272;&#22120;&#21487;&#33021;&#20250;&#25226;&#36825;&#20010;&#25991;&#20214;&#30475;&#25104; HTML &#25991;&#26723;&#65292;&#36825;&#20250;&#20351;&#27983;&#35272;&#22120;&#30340;&#31383;&#21475;&#20013;&#20986;&#29616;&#24456;&#22855;&#24618;&#30340;&#25991;&#23383;&#12290; If you leave off this
information, browsers will probably interpret the response as HTML, which will
result in scary gobbledygook in the browser window.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn59&quot;&gt;&#20351;&#29992; ReportLab &#30340; API &#24456;&#31616;&#21333;&#65306; &#21482;&#38656;&#35201;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;response&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#20316;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;canvas.Canvas&lt;/span&gt;&lt;/tt&gt; &#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#20256;&#20837;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn60&quot;&gt;&#25152;&#26377;&#21518;&#32493;&#30340; PDF &#29983;&#25104;&#26041;&#27861;&#38656;&#35201;&#30001; PDF &#23545;&#35937;&#35843;&#29992;&#65288;&#22312;&#26412;&#20363;&#20013;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;p&lt;/span&gt;&lt;/tt&gt; &#65289;&#65292;&#32780;&#19981;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;response&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn61&quot;&gt;&#26368;&#21518;&#38656;&#35201;&#23545; PDF &#25991;&#20214;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;showPage()&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;save()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#65288;&#21542;&#21017;&#20320;&#20250;&#24471;&#21040;&#19968;&#20010;&#25439;&#22351;&#30340; PDF &#25991;&#20214;&#65289;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn62&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#22797;&#26434;&#30340; PDF &#25991;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#22914;&#26524;&#24744;&#22312;&#21019;&#24314;&#19968;&#20010;&#22797;&#26434;&#30340; PDF &#25991;&#26723;&#65288;&#25110;&#32773;&#20219;&#20309;&#36739;&#22823;&#30340;&#25968;&#25454;&#22359;&#65289;&#65292;&#35831;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cStringIO&lt;/span&gt;&lt;/tt&gt; &#24211;&#23384;&#25918;&#20020;&#26102;&#29983;&#25104;&#30340; PDF &#25991;&#20214;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cStringIO&lt;/span&gt;&lt;/tt&gt; &#25552;&#20379;&#20102;&#19968;&#20010;&#29992; C &#32534;&#20889;&#30340;&#31867;&#20284;&#25991;&#20214;&#23545;&#35937;&#30340;&#25509;&#21475;&#65292;&#20174;&#32780;&#21487;&#20197;&#20351;&#31995;&#32479;&#30340;&#25928;&#29575;&#26368;&#39640;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#19979;&#38754;&#26159;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cStringIO&lt;/span&gt;&lt;/tt&gt; &#37325;&#20889;&#30340; Hello World &#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn66&quot;&gt;from cStringIO import StringIO
from reportlab.pdfgen import canvas
from django.http import HttpResponse

def hello_pdf(request):
    # Create the HttpResponse object with the appropriate PDF headers.
    response = HttpResponse(mimetype=&apos;application/pdf&apos;)
    response[&apos;Content-Disposition&apos;] = &apos;attachment; filename=hello.pdf&apos;

    temp = StringIO()

    # Create the PDF object, using the StringIO object as its &quot;file.&quot;
    p = canvas.Canvas(temp)

    # Draw things on the PDF. Here&apos;s where the PDF generation happens.
    # See the ReportLab documentation for the full list of functionality.
    p.drawString(100, 100, &quot;Hello world.&quot;)

    # Close the PDF object cleanly.
    p.showPage()
    p.save()

    # Get the value of the StringIO buffer and write it to the response.
    response.write(temp.getvalue())
    return response
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn67&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&#20854;&#23427;&#30340;&#21487;&#33021;&#24615;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#20351;&#29992; Python &#21487;&#20197;&#29983;&#25104;&#35768;&#22810;&#20854;&#23427;&#31867;&#22411;&#30340;&#20869;&#23481;&#65292;&#19979;&#38754;&#20171;&#32461;&#30340;&#26159;&#19968;&#20123;&#20854;&#23427;&#30340;&#24819;&#27861;&#21644;&#19968;&#20123;&#21487;&#20197;&#29992;&#20197;&#23454;&#29616;&#23427;&#20204;&#30340;&#24211;&#12290; Here are
a few more ideas and some pointers to libraries you could use to implement them:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&lt;em&gt;ZIP &#25991;&#20214;&lt;/em&gt; &#65306;Python &#26631;&#20934;&#24211;&#20013;&#21253;&#21547;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;zipfile&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#65292;&#23427;&#21487;&#20197;&#35835;&#21644;&#20889;&#21387;&#32553;&#30340; ZIP &#25991;&#20214;&#12290; &#23427;&#21487;&#20197;&#29992;&#20110;&#25353;&#38656;&#29983;&#25104;&#19968;&#20123;&#25991;&#20214;&#30340;&#21387;&#32553;&#21253;&#65292;&#25110;&#32773;&#22312;&#38656;&#35201;&#26102;&#21387;&#32553;&#22823;&#30340;&#25991;&#26723;&#12290; &#22914;&#26524;&#26159; TAR &#25991;&#20214;&#21017;&#21487;&#20197;&#20351;&#29992;&#26631;&#20934;&#24211; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;tarfile&lt;/span&gt;&lt;/tt&gt; &#27169;&#22359;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&lt;em&gt;&#21160;&#24577;&#22270;&#29255;&lt;/em&gt; &#65306; Python &#22270;&#29255;&#22788;&#29702;&#24211; (PIL; &lt;a class=&quot;reference external&quot; href=&quot;http://www.pythonware.com/products/pil/&quot;&gt;http://www.pythonware.com/products/pil/&lt;/a&gt;) &#26159;&#26497;&#22909;&#30340;&#29983;&#25104;&#22270;&#29255;(PNG, JPEG, GIF &#20197;&#21450;&#20854;&#23427;&#35768;&#22810;&#26684;&#24335;)&#30340;&#24037;&#20855;&#12290; &#23427;&#21487;&#20197;&#29992;&#20110;&#33258;&#21160;&#20026;&#22270;&#29255;&#29983;&#25104;&#32553;&#30053;&#22270;&#65292;&#23558;&#22810;&#24352;&#22270;&#29255;&#21387;&#32553;&#21040;&#21333;&#29420;&#30340;&#26694;&#26550;&#20013;&#65292;&#25110;&#32773;&#26159;&#20570;&#22522;&#20110; Web &#30340;&#22270;&#29255;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&lt;em&gt;&#22270;&#34920;&lt;/em&gt; &#65306; Python &#26377;&#35768;&#22810;&#20986;&#33394;&#24182;&#19988;&#24378;&#22823;&#30340;&#22270;&#34920;&#24211;&#29992;&#20197;&#32472;&#21046;&#22270;&#34920;&#65292;&#25353;&#38656;&#22320;&#22270;&#65292;&#34920;&#26684;&#31561;&#12290; &#25105;&#20204;&#19981;&#21487;&#33021;&#23558;&#23427;&#20204;&#20840;&#37096;&#21015;&#20986;&#65292;&#25152;&#20197;&#19979;&#38754;&#21015;&#20986;&#30340;&#26159;&#20010;&#20013;&#30340;&#32728;&#26970;&#12290;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn72&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;matplotlib&lt;/span&gt;&lt;/tt&gt; (&lt;a class=&quot;reference external&quot; href=&quot;http://matplotlib.sourceforge.net/&quot;&gt;http://matplotlib.sourceforge.net/&lt;/a&gt;) &#21487;&#20197;&#29992;&#20110;&#29983;&#25104;&#36890;&#24120;&#26159;&#30001; matlab &#25110;&#32773; Mathematica &#29983;&#25104;&#30340;&#39640;&#36136;&#37327;&#22270;&#34920;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn73&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pygraphviz&lt;/span&gt;&lt;/tt&gt; (&lt;a class=&quot;reference external&quot; href=&quot;https://networkx.lanl.gov/wiki/pygraphviz&quot;&gt;https://networkx.lanl.gov/wiki/pygraphviz&lt;/a&gt;) &#26159;&#19968;&#20010; Graphviz &#22270;&#24418;&#24067;&#23616;&#30340;&#24037;&#20855; (&lt;a class=&quot;reference external&quot; href=&quot;http://graphviz.org/&quot;&gt;http://graphviz.org/&lt;/a&gt;) &#30340; Python &#25509;&#21475;&#65292;&#21487;&#20197;&#29992;&#20110;&#29983;&#25104;&#32467;&#26500;&#21270;&#30340;&#22270;&#34920;&#21644;&#32593;&#32476;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#24635;&#20043;&#65292;&#25152;&#26377;&#21487;&#20197;&#20889;&#25991;&#20214;&#30340;&#24211;&#37117;&#21487;&#20197;&#19982; Django &#21516;&#26102;&#20351;&#29992;&#12290; The possibilities are immense.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#25105;&#20204;&#24050;&#32463;&#20102;&#35299;&#20102;&#29983;&#25104;&#8220;&#38750;HTML&#8221;&#20869;&#23481;&#30340;&#22522;&#26412;&#30693;&#35782;&#65292;&#35753;&#25105;&#20204;&#36827;&#19968;&#27493;&#24635;&#32467;&#19968;&#19979;&#12290; Django&#25317;&#26377;&#24456;&#22810;&#29992;&#20197;&#29983;&#25104;&#21508;&#31867;&#8220;&#38750;HTML&#8221;&#20869;&#23481;&#30340;&#20869;&#32622;&#24037;&#20855;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn76&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#20869;&#23481;&#32858;&#21512;&#22120;&#24212;&#29992;&#26694;&#26550;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;Django&#24102;&#26469;&#20102;&#19968;&#20010;&#39640;&#32423;&#30340;&#32858;&#21512;&#29983;&#25104;&#26694;&#26550;&#65292;&#23427;&#20351;&#24471;&#21019;&#24314;RSS&#21644;Atom feeds&#21464;&#24471;&#38750;&#24120;&#23481;&#26131;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#20160;&#20040;&#26159;RSS&#65311; &#20160;&#20040;&#26159;Atom&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn79&quot;&gt;RSS&#21644;Atom&#37117;&#26159;&#22522;&#20110;XML&#30340;&#26684;&#24335;&#65292;&#20320;&#21487;&#20197;&#29992;&#23427;&#26469;&#25552;&#20379;&#26377;&#20851;&#20320;&#31449;&#28857;&#20869;&#23481;&#30340;&#33258;&#21160;&#26356;&#26032;&#30340;feed&#12290; &#20102;&#35299;&#26356;&#22810;&#20851;&#20110;RSS&#30340;&#21487;&#20197;&#35775;&#38382; &lt;a class=&quot;reference external&quot; href=&quot;http://www.whatisrss.com/&quot;&gt;http://www.whatisrss.com/&lt;/a&gt;, &#26356;&#22810;Atom&#30340;&#20449;&#24687;&#21487;&#20197;&#35775;&#38382; &lt;a class=&quot;reference external&quot; href=&quot;http://www.atomenabled.org/&quot;&gt;http://www.atomenabled.org/&lt;/a&gt;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#24819;&#21019;&#24314;&#19968;&#20010;&#32852;&#21512;&#20379;&#31295;&#30340;&#28304;(syndication feed)&#65292;&#25152;&#38656;&#35201;&#20570;&#30340;&#21482;&#26159;&#20889;&#19968;&#20010;&#31616;&#30701;&#30340;python&#31867;&#12290;
&#20320;&#21487;&#20197;&#21019;&#24314;&#20219;&#24847;&#22810;&#30340;&#28304;(feed)&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#39640;&#32423;feed&#29983;&#25104;&#26694;&#26550;&#26159;&#19968;&#20010;&#40664;&#35748;&#32465;&#23450;&#21040;/feeds/&#30340;&#35270;&#22270;&#65292;Django&#20351;&#29992;URL&#30340;&#20854;&#23427;&#37096;&#20998;(&#22312;/feeds/&#20043;&#21518;&#30340;&#20219;&#20309;&#19996;&#35199;)&#26469;&#20915;&#23450;&#36755;&#20986; &#21738;&#20010;feed Django uses the remainder of the URL (everything after &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/feeds/&lt;/span&gt;&lt;/tt&gt; ) to
determine which feed to return.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&#35201;&#21019;&#24314;&#19968;&#20010; sitemap&#65292;&#20320;&#21482;&#38656;&#35201;&#20889;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; &#31867;&#28982;&#21518;&#37197;&#32622;&#20320;&#30340;URLconf&#25351;&#21521;&#23427;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn83&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#21021;&#22987;&#21270;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#20026;&#20102;&#22312;&#24744;&#30340;Django&#31449;&#28857;&#20013;&#28608;&#27963;syndication feeds, &#28155;&#21152;&#22914;&#19979;&#30340; URLconf:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn86&quot;&gt;(r&apos;^feeds/(?P&amp;lt;url&amp;gt;.*)/$&apos;, &apos;django.contrib.syndication.views.feed&apos;,
    {&apos;feed_dict&apos;: feeds}
),
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#36825;&#19968;&#34892;&#21578;&#35785;Django&#20351;&#29992;RSS&#26694;&#26550;&#22788;&#29702;&#25152;&#26377;&#30340;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;feeds/&quot;&lt;/span&gt;&lt;/tt&gt; &#24320;&#22836;&#30340;URL. ( &#20320;&#21487;&#20197;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;feeds/&quot;&lt;/span&gt;&lt;/tt&gt; &#21069;&#32512;&#20197;&#28385;&#36275;&#24744;&#33258;&#24049;&#30340;&#35201;&#27714;. )&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;URLConf&#37324;&#26377;&#19968;&#34892;&#21442;&#25968;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{&apos;feed_dict&apos;:&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;feeds}&lt;/span&gt;&lt;/tt&gt;&#65292;&#36825;&#20010;&#21442;&#25968;&#21487;&#20197;&#25226;&#23545;&#24212;URL&#38656;&#35201;&#21457;&#24067;&#30340;feed&#20869;&#23481;&#20256;&#36882;&#32473; syndication framework&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#29305;&#21035;&#30340;&#65292;feed_dict&#24212;&#35813;&#26159;&#19968;&#20010;&#26144;&#23556;feed&#30340;slug(&#31616;&#30701;URL&#26631;&#31614;)&#21040;&#23427;&#30340;Feed&#31867;&#30340;&#23383;&#20856; &#20320;&#21487;&#20197;&#22312;URL&#37197;&#32622;&#26412;&#36523;&#37324;&#23450;&#20041;feed_dict&#65292;&#36825;&#37324;&#26159;&#19968;&#20010;&#23436;&#25972;&#30340;&#20363;&#23376; You can define the &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;feed_dict&lt;/span&gt;&lt;/tt&gt; in the URLconf
itself. Here&#8217;s a full example URLconf:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn91&quot;&gt;from django.conf.urls.defaults import *
from mysite.feeds import LatestEntries, LatestEntriesByCategory

feeds = {
    &apos;latest&apos;: LatestEntries,
    &apos;categories&apos;: LatestEntriesByCategory,
}

urlpatterns = patterns(&apos;&apos;,
    # ...
    (r&apos;^feeds/(?P&amp;lt;url&amp;gt;.*)/$&apos;, &apos;django.contrib.syndication.views.feed&apos;,
        {&apos;feed_dict&apos;: feeds}),
    # ...
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#21069;&#38754;&#30340;&#20363;&#23376;&#27880;&#20876;&#20102;&#20004;&#20010;feed:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn93&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LatestEntries``&#34920;&#31034;&#30340;&#20869;&#23481;&#23558;&#23545;&#24212;&#21040;``feeds/latest/&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn94&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LatestEntriesByCategory``&#30340;&#20869;&#23481;&#23558;&#23545;&#24212;&#21040;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;``feeds/categories/&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#20197;&#19978;&#30340;&#35774;&#23450;&#23436;&#25104;&#20043;&#21518;&#65292;&#25509;&#19979;&#26469;&#38656;&#35201;&#33258;&#24049;&#23450;&#20041; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#31867;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#31867;&#26159;&#19968;&#20010;&#31616;&#21333;&#30340;python&#31867;&#65292;&#29992;&#26469;&#34920;&#31034;&#19968;&#20010;syndication feed. &#19968;&#20010;feed&#21487;&#33021;&#26159;&#31616;&#21333;&#30340; (&#20363;&#22914;&#19968;&#20010;&#31449;&#28857;&#26032;&#38395;feed&#65292;&#25110;&#32773;&#26368;&#22522;&#26412;&#30340;&#65292;&#26174;&#31034;&#19968;&#20010;blog&#30340;&#26368;&#26032;&#26465;&#30446;)&#65292;&#20063;&#21487;&#33021;&#26356;&#21152;&#22797;&#26434;(&#20363;&#22914;&#19968;&#20010;&#26174;&#31034;blog&#26576;&#19968;&#31867;&#21035;&#19979;&#25152;&#26377;&#26465;&#30446;&#30340;feed&#12290; &#36825;&#37324;&#31867;&#21035; category &#26159;&#20010;&#21464;&#37327;).&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;Feed&#31867;&#24517;&#39035;&#32487;&#25215;django.contrib.syndication.feeds.Feed&#65292;&#23427;&#20204;&#21487;&#20197;&#22312;&#20320;&#30340;&#20195;&#30721;&#26641;&#30340;&#20219;&#20309;&#20301;&#32622;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;feed&quot;&gt;
&lt;span id=&quot;cn98&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#19968;&#20010;&#31616;&#21333;&#30340;Feed&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;This simple example describes a feed of the latest five blog entries for a given
blog:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn101&quot;&gt;from django.contrib.syndication.feeds import Feed
from mysite.blog.models import Entry

class LatestEntries(Feed):
    title = &quot;My Blog&quot;
    link = &quot;/archive/&quot;
    description = &quot;The latest news about stuff.&quot;

    def items(self):
        return Entry.objects.order_by(&apos;-pub_date&apos;)[:5]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn102&quot;&gt;&#35201;&#27880;&#24847;&#30340;&#37325;&#35201;&#30340;&#20107;&#24773;&#22914;&#19979;&#25152;&#31034;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn103&quot;&gt;&#23376;&#31867; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.syndication.feeds.Feed&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn104&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;title&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;link&lt;/span&gt;&lt;/tt&gt; , &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;description&lt;/span&gt;&lt;/tt&gt; &#23545;&#24212;&#19968;&#20010;&#26631;&#20934; RSS &#37324;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;link&amp;gt;&lt;/span&gt;&lt;/tt&gt; , &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;description&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn105&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items()&lt;/span&gt;&lt;/tt&gt; &#26159;&#19968;&#20010;&#26041;&#27861;&#65292;&#36820;&#22238;&#19968;&#20010;&#29992;&#20197;&#21253;&#21547;&#22312;&#21253;&#21547;&#22312;feed&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;item&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#20803;&#32032;&#37324;&#30340; list &#34429;&#28982;&#20363;&#23376;&#37324;&#29992;Djangos database API&#36820;&#22238;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NewsItem&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items()&lt;/span&gt;&lt;/tt&gt; &#19981;&#19968;&#23450;&#24517;&#39035;&#36820;&#22238; model&#30340;&#23454;&#20363; Although this example returns
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Entry&lt;/span&gt;&lt;/tt&gt; objects using Django&#8217;s database API, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items()&lt;/span&gt;&lt;/tt&gt; doesn&#8217;t have to
return model instances.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#36824;&#26377;&#19968;&#20010;&#27493;&#39588;&#65292;&#22312;&#19968;&#20010;RSS feed&#37324;&#65292;&#27599;&#20010;(item)&#26377;&#19968;&#20010;(title)&#65292;(link)&#21644;(description)&#65292;&#25105;&#20204;&#38656;&#35201;&#21578;&#35785;&#26694;&#26550; &#25226;&#25968;&#25454;&#25918;&#21040;&#36825;&#20123;&#20803;&#32032;&#20013; In an RSS feed, each &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;item&amp;gt;&lt;/span&gt;&lt;/tt&gt; has a &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/tt&gt; ,
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;link&amp;gt;&lt;/span&gt;&lt;/tt&gt; , and &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;description&amp;gt;&lt;/span&gt;&lt;/tt&gt; . We need to tell the framework what data to put
into those elements.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#22914;&#26524;&#35201;&#25351;&#23450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;description&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#65292;&#21487;&#20197;&#24314;&#31435;&#19968;&#20010;Django&#27169;&#26495;&#65288;&#35265;Chapter 4&#65289;&#21517;&#23383;&#21483; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;feeds/latest_title.html&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;feeds/latest_description.html&lt;/span&gt;&lt;/tt&gt; &#65292;&#21518;&#32773;&#26159;URLConf&#37324;&#20026;&#23545;&#24212;feed&#25351;&#23450;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;slug&lt;/span&gt;&lt;/tt&gt; &#12290;&#27880;&#24847; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.html&lt;/span&gt;&lt;/tt&gt; &#21518;&#32512;&#26159;&#24517;&#39035;&#30340;&#12290; Note that the &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.html&lt;/span&gt;&lt;/tt&gt; extension is
required.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;RSS&#31995;&#32479;&#27169;&#26495;&#28210;&#26579;&#27599;&#19968;&#20010;&#26465;&#30446;&#65292;&#38656;&#35201;&#32473;&#20256;&#36882;2&#20010;&#21442;&#25968;&#32473;&#27169;&#26495;&#19978;&#19979;&#25991;&#21464;&#37327;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn109&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;obj&lt;/span&gt;&lt;/tt&gt; : &#24403;&#21069;&#23545;&#35937; ( &#36820;&#22238;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items()&lt;/span&gt;&lt;/tt&gt; &#20219;&#24847;&#23545;&#35937;&#20043;&#19968; )&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn110&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;site&lt;/span&gt;&lt;/tt&gt; : &#19968;&#20010;&#34920;&#31034;&#24403;&#21069;&#31449;&#28857;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.models.core.sites.Site&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290; &#36825;&#23545;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;site.domain&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;site.name&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#24456;&#26377;&#29992;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&#22914;&#26524;&#20320;&#22312;&#21019;&#24314;&#27169;&#26495;&#30340;&#26102;&#20505;&#65292;&#27809;&#26377;&#25351;&#26126;&#26631;&#39064;&#25110;&#32773;&#25551;&#36848;&#20449;&#24687;&#65292;&#26694;&#26550;&#20250;&#40664;&#35748;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;obj&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&quot;&lt;/span&gt;&lt;/tt&gt; &#65292;&#23545;&#35937;&#30340;&#23383;&#31526;&#20018;&#34920;&#31034;&#12290; (For model objects, this will be the
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__unicode__()&lt;/span&gt;&lt;/tt&gt; method.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&#20320;&#20063;&#21487;&#20197;&#36890;&#36807;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#31867;&#20013;&#30340;&#20004;&#20010;&#23646;&#24615; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;title_template&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;description_template&lt;/span&gt;&lt;/tt&gt; &#26469;&#25913;&#21464;&#36825;&#20004;&#20010;&#27169;&#26495;&#30340;&#21517;&#23383;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#20320;&#26377;&#20004;&#31181;&#26041;&#27861;&#26469;&#25351;&#23450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;link&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#30340;&#20869;&#23481;&#12290; Django &#39318;&#20808;&#25191;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items()&lt;/span&gt;&lt;/tt&gt; &#20013;&#27599;&#19968;&#39033;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_absolute_url()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290; &#22914;&#26524;&#35813;&#26041;&#27861;&#19981;&#23384;&#22312;&#65292;&#23601;&#20250;&#23581;&#35797;&#25191;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#31867;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;item_link()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#65292;&#24182;&#23558;&#33258;&#36523;&#20316;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;item&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#20256;&#36882;&#36827;&#21435;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_absolute_url()&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;item_link()&lt;/span&gt;&lt;/tt&gt; &#37117;&#24212;&#35813;&#20197;Python&#23383;&#31526;&#20018;&#24418;&#24335;&#36820;&#22238;URL&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#23545;&#20110;&#21069;&#38754;&#25552;&#21040;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LatestEntries&lt;/span&gt;&lt;/tt&gt; &#20363;&#23376;&#65292;&#25105;&#20204;&#21487;&#20197;&#23454;&#29616;&#19968;&#20010;&#31616;&#21333;&#30340;feed&#27169;&#26495;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;latest_title.html&lt;/span&gt;&lt;/tt&gt; &#21253;&#25324;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn117&quot;&gt;{{ obj.title }}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&#24182;&#19988; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;latest_description.html&lt;/span&gt;&lt;/tt&gt; &#21253;&#21547;:&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn120&quot;&gt;{{ obj.description }}
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn121&quot;&gt;&#36825;&#30495;&#26159; &lt;em&gt;&#22826;&lt;/em&gt; &#31616;&#21333;&#20102;&#65281;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn122&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn122&quot;&gt;&#19968;&#20010;&#26356;&#22797;&#26434;&#30340;Feed&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&#26694;&#26550;&#36890;&#36807;&#21442;&#25968;&#25903;&#25345;&#26356;&#21152;&#22797;&#26434;&#30340;feeds&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;For example, say your blog offers an RSS feed for every distinct tag you&#8217;ve used to
categorize your entries. &#22914;&#26524;&#20026;&#27599;&#19968;&#20010;&#21333;&#29420;&#30340;&#21306;&#22495;&#24314;&#31435;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#31867;&#23601;&#26174;&#24471;&#24456;&#19981;&#26126;&#26234;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#21462;&#32780;&#20195;&#20043;&#30340;&#26041;&#27861;&#26159;&#65292;&#20351;&#29992;&#32858;&#21512;&#26694;&#26550;&#26469;&#20135;&#29983;&#19968;&#20010;&#36890;&#29992;&#30340;&#28304;&#65292;&#20351;&#20854;&#21487;&#20197;&#26681;&#25454;feeds URL&#36820;&#22238;&#30456;&#24212;&#30340;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn126&quot;&gt;Your tag-specific feeds could use URLs like this:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn127&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://example.com/feeds/tags/python/&lt;/span&gt;&lt;/tt&gt; : Returns recent entries tagged with
python&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn128&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://example.com/feeds/tags/cats/&lt;/span&gt;&lt;/tt&gt; : Returns recent entries tagged with
cats&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#22266;&#23450;&#30340;&#37027;&#19968;&#37096;&#20998;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;beats&quot;&lt;/span&gt;&lt;/tt&gt; &#65288;&#21306;&#22495;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#20030;&#20010;&#20363;&#23376;&#20250;&#28548;&#28165;&#19968;&#20999;&#12290; &#19979;&#38754;&#26159;&#27599;&#20010;&#22320;&#21306;&#29305;&#23450;&#30340;feeds&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn132&quot;&gt;from django.core.exceptions import ObjectDoesNotExist
from mysite.blog.models import Entry, Tag

class TagFeed(Feed):
    def get_object(self, bits):
        # In case of &quot;/feeds/tags/cats/dogs/mice/&quot;, or other such
        # clutter, check that bits has only one member.
        if len(bits) != 1:
            raise ObjectDoesNotExist
        return Tag.objects.get(tag=bits[0])

    def title(self, obj):
        return &quot;My Blog: Entries tagged with %s&quot; % obj.tag

    def link(self, obj):
        return obj.get_absolute_url()

    def description(self, obj):
        return &quot;Entries tagged with %s&quot; % obj.tag

    def items(self, obj):
        entries = Entry.objects.filter(tags__id__exact=obj.id)
        return entries.order_by(&apos;-pub_date&apos;)[:30]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#20197;&#19979;&#26159;RSS&#26694;&#26550;&#30340;&#22522;&#26412;&#31639;&#27861;&#65292;&#25105;&#20204;&#20551;&#35774;&#36890;&#36807;URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/rss/beats/0613/&lt;/span&gt;&lt;/tt&gt; &#26469;&#35775;&#38382;&#36825;&#20010;&#31867;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn134&quot;&gt;&#26694;&#26550;&#33719;&#24471;&#20102;URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/rss/beats/0613/&lt;/span&gt;&lt;/tt&gt; &#24182;&#19988;&#27880;&#24847;&#21040;URL&#20013;&#30340;slug&#37096;&#20998;&#21518;&#38754;&#21547;&#26377;&#26356;&#22810;&#30340;&#20449;&#24687;&#12290; &#23427;&#23558;&#26012;&#26464;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;/tt&gt; )&#20316;&#20026;&#20998;&#38548;&#31526;&#65292;&#25226;&#21097;&#20313;&#30340;&#23383;&#31526;&#20018;&#20998;&#21106;&#24320;&#20316;&#20026;&#21442;&#25968;&#65292;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#31867;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_object()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#28155;&#21152;&#30340;&#20449;&#24687;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;[&apos;0613&apos;]&lt;/span&gt;&lt;/tt&gt; &#12290;&#23545;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/rss/beats/0613/foo/bar/&lt;/span&gt;&lt;/tt&gt; &#30340;&#19968;&#20010;URL&#35831;&#27714;&#65292; &#36825;&#20123;&#20449;&#24687;&#23601;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;[&apos;0613&apos;,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&apos;foo&apos;,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&apos;bar&apos;]&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn136&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_object()&lt;/span&gt;&lt;/tt&gt; &#23601;&#26681;&#25454;&#32473;&#23450;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;bits&lt;/span&gt;&lt;/tt&gt; &#20540;&#26469;&#36820;&#22238;&#21306;&#22495;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn137&quot;&gt;In this case, it uses the Django database API to retrieve the &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Tag&lt;/span&gt;&lt;/tt&gt; . Note
that &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_object()&lt;/span&gt;&lt;/tt&gt; should raise &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.core.exceptions.ObjectDoesNotExist&lt;/span&gt;&lt;/tt&gt;
if given invalid parameters. &#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Beat.objects.get()&lt;/span&gt;&lt;/tt&gt; &#35843;&#29992;&#20013;&#20063;&#27809;&#26377;&#20986;&#29616; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;try&lt;/span&gt;&lt;/tt&gt; /&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;except&lt;/span&gt;&lt;/tt&gt; &#20195;&#30721;&#22359;&#12290; &#20989;&#25968;&#22312;&#20986;&#38169;&#26102;&#25243;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Beat.DoesNotExist&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#65292;&#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Beat.DoesNotExist&lt;/span&gt;&lt;/tt&gt; &#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ObjectDoesNotExist&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#30340;&#19968;&#20010;&#23376;&#31867;&#22411;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#20026;&#20135;&#29983; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;link&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#65292; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;description&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#30340;feeds&#65292; Django&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;title()&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;link()&lt;/span&gt;&lt;/tt&gt; , &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;description()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290; &#22312;&#19978;&#38754;&#30340;&#20363;&#23376;&#20013;&#65292;&#23427;&#20204;&#37117;&#26159;&#31616;&#21333;&#30340;&#23383;&#31526;&#20018;&#31867;&#22411;&#30340;&#31867;&#23646;&#24615;&#65292;&#32780;&#36825;&#20010;&#20363;&#23376;&#34920;&#26126;&#65292;&#23427;&#20204;&#26082;&#21487;&#20197;&#26159;&#23383;&#31526;&#20018;&#65292; &lt;em&gt;&#20063;&#21487;&#20197;&#26159;&lt;/em&gt; &#26041;&#27861;&#12290; &#23545;&#20110;&#27599;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;title&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;link&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;description&lt;/span&gt;&lt;/tt&gt; &#30340;&#32452;&#21512;&#65292;Django&#20351;&#29992;&#20197;&#19979;&#30340;&#31639;&#27861;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn139&quot;&gt;&#35797;&#22270;&#35843;&#29992;&#19968;&#20010;&#20989;&#25968;&#65292;&#24182;&#19988;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_object()&lt;/span&gt;&lt;/tt&gt; &#36820;&#22238;&#30340;&#23545;&#35937;&#20316;&#20026;&#21442;&#25968;&#20256;&#36882;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;obj&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn140&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn140&quot;&gt;&#22914;&#26524;&#27809;&#26377;&#25104;&#21151;&#65292;&#21017;&#19981;&#24102;&#21442;&#25968;&#35843;&#29992;&#19968;&#20010;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn141&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn141&quot;&gt;&#36824;&#19981;&#25104;&#21151;&#65292;&#21017;&#20351;&#29992;&#31867;&#23646;&#24615;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#26368;&#21518;&#65292;&#20540;&#24471;&#27880;&#24847;&#30340;&#26159;&#65292;&#36825;&#20010;&#20363;&#23376;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items()&lt;/span&gt;&lt;/tt&gt; &#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;obj&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#12290;
&#23545;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items&lt;/span&gt;&lt;/tt&gt; &#30340;&#31639;&#27861;&#23601;&#22914;&#21516;&#19978;&#38754;&#31532;&#19968;&#27493;&#25152;&#25551;&#36848;&#30340;&#37027;&#26679;&#65292;&#39318;&#20808;&#23581;&#35797; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items(obj)&lt;/span&gt;&lt;/tt&gt; &#65292; &#28982;&#21518;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items()&lt;/span&gt;&lt;/tt&gt; &#65292;&#26368;&#21518;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items&lt;/span&gt;&lt;/tt&gt; &#31867;&#23646;&#24615;&#65288;&#24517;&#39035;&#26159;&#19968;&#20010;&#21015;&#34920;&#65289;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn143&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#31867;&#25152;&#26377;&#26041;&#27861;&#21644;&#23646;&#24615;&#30340;&#23436;&#25972;&#25991;&#26723;&#65292;&#35831;&#21442;&#32771;&#23448;&#26041;&#30340;Django&#25991;&#26723; (&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/documentation/0.96/syndication_feeds/&quot;&gt;http://www.djangoproject.com/documentation/0.96/syndication_feeds/&lt;/a&gt;) &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn144&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn144&quot;&gt;&#25351;&#23450;Feed&#30340;&#31867;&#22411;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn145&quot;&gt;&#40664;&#35748;&#24773;&#20917;&#19979;, &#32858;&#21512;&#26694;&#26550;&#29983;&#25104;RSS 2.0. &#35201;&#25913;&#21464;&#36825;&#26679;&#30340;&#24773;&#20917;, &#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#31867;&#20013;&#28155;&#21152;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;feed_type&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;. To change that, add a
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;feed_type&lt;/span&gt;&lt;/tt&gt; attribute to your &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; class:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn147&quot;&gt;from django.utils.feedgenerator import Atom1Feed

class MyFeed(Feed):
    feed_type = Atom1Feed
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn148&quot;&gt;&#27880;&#24847;&#20320;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;feed_type&lt;/span&gt;&lt;/tt&gt; &#36171;&#20540;&#25104;&#19968;&#20010;&#31867;&#23545;&#35937;&#65292;&#32780;&#19981;&#26159;&#31867;&#23454;&#20363;&#12290; &#30446;&#21069;&#21512;&#27861;&#30340;Feed&#31867;&#22411;&#22914;&#34920;11-1&#25152;&#31034;&#12290;&lt;/p&gt;
&lt;table class=&quot;cn docutils&quot; id=&quot;cn149&quot;&gt;
&lt;caption&gt;&#34920; 11-1.  Feed &#31867;&#22411;&lt;/caption&gt;
&lt;colgroup&gt;
&lt;col width=&quot;73%&quot;&gt;
&lt;col width=&quot;27%&quot;&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;Feed &#31867;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#31867;&#22411;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.feedgenerator.Rss201rev2Feed&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;RSS 2.01 (default)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.feedgenerator.RssUserland091Feed&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;RSS 0.91&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.feedgenerator.Atom1Feed&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Atom 1.0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn150&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn150&quot;&gt;&#38381;&#21253;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn151&quot;&gt;&#20026;&#20102;&#25351;&#23450;&#38381;&#21253;&#65288;&#20363;&#22914;&#65292;&#19982;feed&#39033;&#27604;&#26041;&#35828;MP3 feeds&#30456;&#20851;&#32852;&#30340;&#23186;&#20307;&#36164;&#28304;&#20449;&#24687;&#65289;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;item_enclosure_url&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;item_enclosure_length&lt;/span&gt;&lt;/tt&gt; &#65292; &#20197;&#21450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;item_enclosure_mime_type&lt;/span&gt;&lt;/tt&gt; &#65292;&#27604;&#22914;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn153&quot;&gt;from myproject.models import Song

class MyFeedWithEnclosures(Feed):
    title = &quot;Example feed with enclosures&quot;
    link = &quot;/feeds/example-with-enclosures/&quot;

    def items(self):
        return Song.objects.all()[:30]

    def item_enclosure_url(self, item):
        return item.song_url

    def item_enclosure_length(self, item):
        return item.song_length

    item_enclosure_mime_type = &quot;audio/mpeg&quot;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&#24403;&#28982;&#65292;&#20320;&#39318;&#20808;&#35201;&#21019;&#24314;&#19968;&#20010;&#21253;&#21547;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;song_url&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;song_length&lt;/span&gt;&lt;/tt&gt; &#65288;&#27604;&#22914;&#25353;&#29031;&#23383;&#33410;&#35745;&#31639;&#30340;&#38271;&#24230;&#65289;&#22495;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Song&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn155&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&#35821;&#35328;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn156&quot;&gt;&#32858;&#21512;&#26694;&#26550;&#33258;&#21160;&#21019;&#24314;&#30340;Feed&#21253;&#21547;&#36866;&#24403;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;language&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;(RSS 2.0) &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;xml:lang&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;(Atom). &#20182;&#30452;&#25509;&#26469;&#33258;&#20110;&#24744;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;. This comes directly
from your &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt; setting.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;urls&quot;&gt;
&lt;span id=&quot;cn157&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn157&quot;&gt;URLs&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn158&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;link&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;/&#23646;&#24615;&#21487;&#20197;&#20197;&#32477;&#23545;URL&#30340;&#24418;&#24335;&#65288;&#20363;&#22914;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;/blog/&quot;&lt;/span&gt;&lt;/tt&gt; &#65289;&#25110;&#32773;&#25351;&#23450;&#21327;&#35758;&#21644;&#22495;&#21517;&#30340;URL&#30340;&#24418;&#24335;&#36820;&#22238;&#65288;&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;http://www.example.com/blog/&quot;&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;link&lt;/span&gt;&lt;/tt&gt; &#27809;&#26377;&#36820;&#22238;&#22495;&#21517;&#65292;&#32858;&#21512;&#26694;&#26550;&#20250;&#26681;&#25454; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#65292;&#33258;&#21160;&#30340;&#25554;&#20837;&#24403;&#21069;&#31449;&#28857;&#30340;&#22495;&#20449;&#24687;&#12290; (See Chapter 16 for more on &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; and the sites
framework.)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn159&quot;&gt;Atom feeds&#38656;&#35201; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;rel=&quot;self&quot;&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#25351;&#26126;feeds&#29616;&#22312;&#30340;&#20301;&#32622;&#12290;
The syndication framework populates this automatically.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;atom-and-rss&quot;&gt;
&lt;span id=&quot;cn160&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn160&quot;&gt;&#21516;&#26102;&#21457;&#24067;Atom and RSS&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn161&quot;&gt;&#19968;&#20123;&#24320;&#21457;&#20154;&#21592;&#24819; &lt;em&gt;&#21516;&#26102;&lt;/em&gt; &#25903;&#25345;Atom&#21644;RSS&#12290;
&#36825;&#22312;Django&#20013;&#24456;&#23481;&#26131;&#23454;&#29616;&#65306; &#21482;&#38656;&#21019;&#24314;&#19968;&#20010;&#20320;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;feed&lt;/span&gt;&lt;/tt&gt; &#31867;&#30340;&#23376;&#31867;&#65292;&#28982;&#21518;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;feed_type&lt;/span&gt;&lt;/tt&gt; &#65292;&#24182;&#19988;&#26356;&#26032;URLconf&#20869;&#23481;&#12290; &#19979;&#38754;&#26159;&#19968;&#20010;&#23436;&#25972;&#30340;&#20363;&#23376;&#65306; Here&#8217;s a full example:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn163&quot;&gt;from django.contrib.syndication.feeds import Feed
from django.utils.feedgenerator import Atom1Feed
from mysite.blog.models import Entry

class RssLatestEntries(Feed):
    title = &quot;My Blog&quot;
    link = &quot;/archive/&quot;
    description = &quot;The latest news about stuff.&quot;

    def items(self):
        return Entry.objects.order_by(&apos;-pub_date&apos;)[:5]

class AtomLatestEntries(RssLatestEntries):
    feed_type = Atom1Feed
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn164&quot;&gt;&#36825;&#26159;&#19982;&#20043;&#30456;&#23545;&#24212;&#37027;&#20010;&#30340;URLconf&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn166&quot;&gt;from django.conf.urls.defaults import *
from myproject.feeds import RssLatestEntries, AtomLatestEntries

feeds = {
    &apos;rss&apos;: RssLatestEntries,
    &apos;atom&apos;: AtomLatestEntries,
}

urlpatterns = patterns(&apos;&apos;,
    # ...
    (r&apos;^feeds/(?P&amp;lt;url&amp;gt;.*)/$&apos;, &apos;django.contrib.syndication.views.feed&apos;,
        {&apos;feed_dict&apos;: feeds}),
    # ...
)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;sitemap&quot;&gt;
&lt;span id=&quot;cn167&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn167&quot;&gt;Sitemap &#26694;&#26550;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&lt;em&gt;sitemap&lt;/em&gt; &#26159;&#20320;&#26381;&#21153;&#22120;&#19978;&#30340;&#19968;&#20010;XML&#25991;&#20214;&#65292;&#23427;&#21578;&#35785;&#25628;&#32034;&#24341;&#25806;&#20320;&#30340;&#39029;&#38754;&#30340;&#26356;&#26032;&#39057;&#29575;&#21644;&#26576;&#20123;&#39029;&#38754;&#30456;&#23545;&#20110;&#20854;&#23427;&#39029;&#38754;&#30340;&#37325;&#35201;&#24615;&#12290; &#36825;&#20010;&#20449;&#24687;&#20250;&#24110;&#21161;&#25628;&#32034;&#24341;&#25806;&#32034;&#24341;&#20320;&#30340;&#32593;&#31449;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn169&quot;&gt;&#20363;&#22914;&#65292;&#36825;&#26159; Django &#32593;&#31449;(&lt;a class=&quot;reference external&quot; href=&quot;http://www.djangoproject.com/sitemap.xml&quot;&gt;http://www.djangoproject.com/sitemap.xml&lt;/a&gt;)sitemap&#30340;&#19968;&#37096;&#20998;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn171&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;urlset xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;&amp;gt;
  &amp;lt;url&amp;gt;
    &amp;lt;loc&amp;gt;http://www.djangoproject.com/documentation/&amp;lt;/loc&amp;gt;
    &amp;lt;changefreq&amp;gt;weekly&amp;lt;/changefreq&amp;gt;
    &amp;lt;priority&amp;gt;0.5&amp;lt;/priority&amp;gt;
  &amp;lt;/url&amp;gt;
  &amp;lt;url&amp;gt;
    &amp;lt;loc&amp;gt;http://www.djangoproject.com/documentation/0_90/&amp;lt;/loc&amp;gt;
    &amp;lt;changefreq&amp;gt;never&amp;lt;/changefreq&amp;gt;
    &amp;lt;priority&amp;gt;0.1&amp;lt;/priority&amp;gt;
  &amp;lt;/url&amp;gt;
  ...
&amp;lt;/urlset&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn172&quot;&gt;&#38656;&#35201;&#20102;&#35299;&#26356;&#22810;&#26377;&#20851; sitemaps &#30340;&#20449;&#24687;, &#35831;&#21442;&#35265; &lt;a class=&quot;reference external&quot; href=&quot;http://www.sitemaps.org/&quot;&gt;http://www.sitemaps.org/&lt;/a&gt;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn173&quot;&gt;Django sitemap &#26694;&#26550;&#20801;&#35768;&#20320;&#29992; Python &#20195;&#30721;&#26469;&#34920;&#36848;&#36825;&#20123;&#20449;&#24687;&#65292;&#20174;&#32780;&#33258;&#21160;&#21019;&#24314;&#36825;&#20010;XML&#25991;&#20214;&#12290; &#35201;&#21019;&#24314;&#19968;&#20010;&#31449;&#28857;&#22320;&#22270;&#65292;&#20320;&#21482;&#38656;&#35201;&#20889;&#19968;&#20010;`` Sitemap`` &#31867;&#65292;&#24182;&#19988;&#22312;URLconf&#20013;&#25351;&#21521;&#23427;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn174&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#23433;&#35013;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn175&quot;&gt;&#35201;&#23433;&#35013; sitemap &#24212;&#29992;&#31243;&#24207;, &#25353;&#19979;&#38754;&#30340;&#27493;&#39588;&#36827;&#34892;:&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn176&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn176&quot;&gt;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.sitemaps&apos;&lt;/span&gt;&lt;/tt&gt; &#28155;&#21152;&#21040;&#24744;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn177&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn177&quot;&gt;&#30830;&#20445; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.template.loaders.app_directories.load_template_source&apos;&lt;/span&gt;&lt;/tt&gt; &#22312;&#24744;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_LOADERS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#12290; &#40664;&#35748;&#24773;&#20917;&#19979;&#23427;&#22312;&#37027;&#37324;, &#25152;&#20197;, &#22914;&#26524;&#20320;&#24050;&#32463;&#25913;&#21464;&#20102;&#37027;&#20010;&#35774;&#32622;&#30340;&#35805;, &#21482;&#38656;&#35201;&#25913;&#22238;&#26469;&#21363;&#21487;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn178&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn178&quot;&gt;&#30830;&#23450;&#24744;&#24050;&#32463;&#23433;&#35013;&#20102; sites &#26694;&#26550; (&#21442;&#35265;&#31532;14&#31456;).&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn179&quot;&gt;Note&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;sitemap &#24212;&#29992;&#31243;&#24207;&#27809;&#26377;&#23433;&#35013;&#20219;&#20309;&#25968;&#25454;&#24211;&#34920;. &#23427;&#38656;&#35201;&#21152;&#20837;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#21807;&#19968;&#21407;&#22240;&#26159;: &#36825;&#26679; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;load_template_source&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#21152;&#36733;&#22120;&#21487;&#20197;&#25214;&#21040;&#40664;&#35748;&#30340;&#27169;&#26495;. The only reason it
needs to go into &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; is so the &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;load_template_source&lt;/span&gt;&lt;/tt&gt; template
loader can find the default templates.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;initialization&quot;&gt;
&lt;span id=&quot;cn181&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn181&quot;&gt;Initialization&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn182&quot;&gt;&#35201;&#22312;&#24744;&#30340;Django&#31449;&#28857;&#20013;&#28608;&#27963;sitemap&#29983;&#25104;, &#35831;&#22312;&#24744;&#30340; URLconf &#20013;&#28155;&#21152;&#36825;&#19968;&#34892;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn184&quot;&gt;(r&apos;^sitemap\.xml$&apos;, &apos;django.contrib.sitemaps.views.sitemap&apos;, {&apos;sitemaps&apos;: sitemaps})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn185&quot;&gt;This line tells Django to build a sitemap when a client accesses &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/sitemap.xml&lt;/span&gt;&lt;/tt&gt; .
Note that the dot character in &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemap.xml&lt;/span&gt;&lt;/tt&gt; is escaped with a backslash, because
dots have a special meaning in regular expressions.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;sitemap&#25991;&#20214;&#30340;&#21517;&#23383;&#26080;&#20851;&#32039;&#35201;&#65292;&#20294;&#26159;&#23427;&#22312;&#26381;&#21153;&#22120;&#19978;&#30340;&#20301;&#32622;&#21364;&#24456;&#37325;&#35201;&#12290; &#25628;&#32034;&#24341;&#25806;&#21482;&#32034;&#24341;&#20320;&#30340;sitemap&#20013;&#24403;&#21069;URL&#32423;&#21035;&#21450;&#20854;&#20197;&#19979;&#32423;&#21035;&#30340;&#38142;&#25509;&#12290; &#29992;&#19968;&#20010;&#23454;&#20363;&#26469;&#35828;&#65292;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemap.xml&lt;/span&gt;&lt;/tt&gt; &#20301;&#20110;&#20320;&#30340;&#26681;&#30446;&#24405;&#65292;&#37027;&#20040;&#23427;&#23558;&#24341;&#29992;&#20219;&#20309;&#30340;URL&#12290; &#28982;&#32780;&#65292;&#22914;&#26524;&#20320;&#30340;sitemap&#20301;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/content/sitemap.xml&lt;/span&gt;&lt;/tt&gt; &#65292;&#37027;&#20040;&#23427;&#21482;&#24341;&#29992;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/content/&lt;/span&gt;&lt;/tt&gt; &#25171;&#22836;&#30340;URL&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn187&quot;&gt;sitemap&#35270;&#22270;&#38656;&#35201;&#19968;&#20010;&#39069;&#22806;&#30340;&#24517;&#39035;&#30340;&#21442;&#25968;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{&apos;sitemaps&apos;:&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;sitemaps}&lt;/span&gt;&lt;/tt&gt; .
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemaps&lt;/span&gt;&lt;/tt&gt; should be a dictionary that maps a short section label (e.g., &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blog&lt;/span&gt;&lt;/tt&gt;
or &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;news&lt;/span&gt;&lt;/tt&gt; ) to its &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; class (e.g., &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BlogSitemap&lt;/span&gt;&lt;/tt&gt; or &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;NewsSitemap&lt;/span&gt;&lt;/tt&gt; ).
It may also map to an &lt;em&gt;instance&lt;/em&gt; of a &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; class (e.g.,
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BlogSitemap(some_var)&lt;/span&gt;&lt;/tt&gt; ).&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn188&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn188&quot;&gt;Sitemap &#31867;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn189&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; &#31867;&#23637;&#31034;&#20102;&#19968;&#20010;&#36827;&#20837;&#22320;&#22270;&#31449;&#28857;&#31616;&#21333;&#30340;Python&#31867;&#29255;&#26029;.&#20363;&#22914;,&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; &#31867;&#33021;&#23637;&#29616;&#25152;&#26377;&#26085;&#24535;&#20837;&#21475;&#65292;&#32780;&#21478;&#22806;&#19968;&#20010;&#33021;&#22815;&#35843;&#24230;&#25152;&#26377;&#30340;&#26085;&#21382;&#20107;&#20214;&#12290; For example, one &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; class could represent all the entries of
your weblog, while another could represent all of the events in your events
calendar.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&#22312;&#26368;&#31616;&#21333;&#30340;&#20363;&#23376;&#20013;&#65292;&#25152;&#26377;&#37096;&#20998;&#21487;&#20197;&#20840;&#37096;&#21253;&#21547;&#22312;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemap.xml&lt;/span&gt;&lt;/tt&gt; &#20013;&#65292;&#20063;&#21487;&#20197;&#20351;&#29992;&#26694;&#26550;&#26469;&#20135;&#29983;&#19968;&#20010;&#31449;&#28857;&#22320;&#22270;&#65292;&#20026;&#27599;&#19968;&#20010;&#29420;&#31435;&#30340;&#37096;&#20998;&#20135;&#29983;&#19968;&#20010;&#21333;&#29420;&#30340;&#31449;&#28857;&#25991;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn191&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; &#31867;&#24517;&#39035;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sitemaps.Sitemap&lt;/span&gt;&lt;/tt&gt; &#30340;&#23376;&#31867;. &#20182;&#20204;&#21487;&#20197;&#23384;&#22312;&#20110;&#24744;&#30340;&#20195;&#30721;&#26641;&#30340;&#20219;&#20309;&#22320;&#26041;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn192&quot;&gt;&#20363;&#22914;&#20551;&#35774;&#20320;&#26377;&#19968;&#20010;blog&#31995;&#32479;&#65292;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Entry&lt;/span&gt;&lt;/tt&gt; &#30340;model&#65292;&#24182;&#19988;&#20320;&#24076;&#26395;&#20320;&#30340;&#31449;&#28857;&#22320;&#22270;&#21253;&#21547;&#25152;&#26377;&#36830;&#21040;&#20320;&#30340;blog&#20837;&#21475;&#30340;&#36229;&#38142;&#25509;&#12290; &#20320;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; &#31867;&#24456;&#21487;&#33021;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn194&quot;&gt;from django.contrib.sitemaps import Sitemap
from mysite.blog.models import Entry

class BlogSitemap(Sitemap):
    changefreq = &quot;never&quot;
    priority = 0.5

    def items(self):
        return Entry.objects.filter(is_draft=False)

    def lastmod(self, obj):
        return obj.pub_date
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn195&quot;&gt;&#22768;&#26126;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; &#21644;&#22768;&#26126;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#30475;&#36215;&#26469;&#24456;&#31867;&#20284;&#65307;&#36825;&#37117;&#26159;&#39044;&#20808;&#35774;&#35745;&#22909;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn196&quot;&gt;&#22914;&#21516; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Feed&lt;/span&gt;&lt;/tt&gt; &#31867;&#19968;&#26679;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; &#25104;&#21592;&#20063;&#26082;&#21487;&#20197;&#26159;&#26041;&#27861;&#65292;&#20063;&#21487;&#20197;&#26159;&#23646;&#24615;&#12290; &#24819;&#35201;&#30693;&#36947;&#26356;&#35814;&#32454;&#30340;&#20869;&#23481;&#65292;&#35831;&#21442;&#35265;&#19978;&#25991; &#12298;&#19968;&#20010;&#22797;&#26434;&#30340;&#20363;&#23376;&#12299;&#31456;&#33410;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; &#31867;&#21487;&#20197;&#23450;&#20041;&#22914;&#19979; &#26041;&#27861;/&#23646;&#24615;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items&lt;/span&gt;&lt;/tt&gt; (&lt;strong&gt;&#24517;&#38656;&lt;/strong&gt; )&#65306;&#25552;&#20379;&#23545;&#35937;&#21015;&#34920;&#12290; &#26694;&#26550;&#24182;&#19981;&#20851;&#24515;&#23545;&#35937;&#30340; &lt;em&gt;&#31867;&#22411;&lt;/em&gt; &#65307;&#21807;&#19968;&#20851;&#24515;&#30340;&#26159;&#36825;&#20123;&#23545;&#35937;&#20250;&#20256;&#36882;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;location()&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;lastmod()&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;changefreq()&lt;/span&gt;&lt;/tt&gt; &#65292;&#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;priority()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;location&lt;/span&gt;&lt;/tt&gt; &#65288;&#21487;&#36873;&#65289;&#65306; &#32473;&#23450;&#23545;&#35937;&#30340;&#32477;&#23545;URL&#12290; &#32477;&#23545;URL&#19981;&#21253;&#21547;&#21327;&#35758;&#21517;&#31216;&#21644;&#22495;&#21517;&#12290; &#19979;&#38754;&#26159;&#19968;&#20123;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn200&quot;&gt;&#22909;&#30340;: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;/foo/bar/&apos;&lt;/span&gt;&lt;/tt&gt; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;/foo/bar/&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn201&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn201&quot;&gt;&#24046;&#30340;: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;example.com/foo/bar/&apos;&lt;/span&gt;&lt;/tt&gt; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;example.com/foo/bar/&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn202&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn202&quot;&gt;Bad: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;http://example.com/foo/bar/&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn203&quot;&gt;&#22914;&#26524;&#27809;&#26377;&#25552;&#20379; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;location&lt;/span&gt;&lt;/tt&gt; , &#26694;&#26550;&#23558;&#20250;&#22312;&#27599;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items()&lt;/span&gt;&lt;/tt&gt; &#36820;&#22238;&#30340;&#23545;&#35937;&#19978;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_absolute_url()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn204&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;lastmod&lt;/span&gt;&lt;/tt&gt; (&#21487;&#36873;): &#23545;&#35937;&#30340;&#26368;&#21518;&#20462;&#25913;&#26085;&#26399;, &#20316;&#20026;&#19968;&#20010;Python &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;. The object&#8217;s last modification date, as a Python
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;datetime&lt;/span&gt;&lt;/tt&gt; object.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn205&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;changefreq&lt;/span&gt;&lt;/tt&gt; &#65288;&#21487;&#36873;&#65289;&#65306; &#23545;&#35937;&#21464;&#26356;&#30340;&#39057;&#29575;&#12290; &#21487;&#36873;&#30340;&#20540;&#22914;&#19979;&#65288;&#35814;&#35265;Sitemaps&#25991;&#26723;&#65289;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn206&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn206&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;always&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn207&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn207&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;hourly&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn208&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn208&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;daily&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn209&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;weekly&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn210&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;monthly&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn211&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn211&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;yearly&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn212&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn212&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;never&apos;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn213&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;priority&lt;/span&gt;&lt;/tt&gt; &#65288;&#21487;&#36873;&#65289;&#65306; &#21462;&#20540;&#33539;&#22260;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;0.0&lt;/span&gt;&lt;/tt&gt; and &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;1.0&lt;/span&gt;&lt;/tt&gt; &#20043;&#38388;&#65292;&#29992;&#26469;&#34920;&#26126;&#20248;&#20808;&#32423;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn214&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn214&quot;&gt;&#24555;&#25463;&#26041;&#24335;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn215&quot;&gt;sitemap&#26694;&#26550;&#25552;&#20379;&#20102;&#19968;&#20123;&#24120;&#29992;&#30340;&#31867;&#12290; &#22312;&#19979;&#19968;&#37096;&#20998;&#20013;&#20250;&#30475;&#21040;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;flatpagesitemap&quot;&gt;
&lt;span id=&quot;cn216&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn216&quot;&gt;FlatPageSitemap&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sitemaps.FlatPageSitemap&lt;/span&gt;&lt;/tt&gt; &#31867;&#28041;&#21450;&#21040;&#31449;&#28857;&#20013;&#25152;&#26377;&#30340;flat page&#65292;&#24182;&#22312;sitemap&#20013;&#24314;&#31435;&#19968;&#20010;&#20837;&#21475;&#12290; &#20294;&#20165;&#20165;&#21482;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;location&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;&#65292;&#19981;&#25903;&#25345; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;lastmod&lt;/span&gt;&lt;/tt&gt; &#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;changefreq&lt;/span&gt;&lt;/tt&gt; &#65292;&#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;priority&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn218&quot;&gt;&#21442;&#35265;&#31532;16&#31456;&#33719;&#21462;&#26377;&#20851;flat page&#30340;&#26356;&#22810;&#30340;&#20869;&#23481;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;genericsitemap&quot;&gt;
&lt;span id=&quot;cn219&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn219&quot;&gt;GenericSitemap&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn220&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GenericSitemap&lt;/span&gt;&lt;/tt&gt; &#19982;&#25152;&#26377;&#30340;&#36890;&#29992;&#35270;&#22270;&#19968;&#21516;&#24037;&#20316;&#65288;&#35814;&#35265;&#31532;9&#31456;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn221&quot;&gt;&#20320;&#21487;&#20197;&#22914;&#19979;&#20351;&#29992;&#23427;&#65292;&#21019;&#24314;&#19968;&#20010;&#23454;&#20363;&#65292;&#24182;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;info_dict&lt;/span&gt;&lt;/tt&gt; &#20256;&#36882;&#32473;&#36890;&#29992;&#35270;&#22270;&#12290; &#21807;&#19968;&#30340;&#35201;&#27714;&#26159;&#23383;&#20856;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;queryset&lt;/span&gt;&lt;/tt&gt; &#36825;&#19968;&#39033;&#12290; &#20063;&#21487;&#20197;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;date_field&lt;/span&gt;&lt;/tt&gt; &#26469;&#25351;&#26126;&#20174; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;queryset&lt;/span&gt;&lt;/tt&gt; &#20013;&#21462;&#22238;&#30340;&#23545;&#35937;&#30340;&#26085;&#26399;&#22495;&#12290; &#36825;&#20250;&#34987;&#29992;&#20316;&#31449;&#28857;&#22320;&#22270;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;lastmod&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn222&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20010;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FlatPageSitemap&lt;/span&gt;&lt;/tt&gt; and &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GenericSiteMap&lt;/span&gt;&lt;/tt&gt; &#65288;&#21253;&#25324;&#21069;&#38754;&#25152;&#20551;&#23450;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Entry&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65289;&#30340;URLconf&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn224&quot;&gt;from django.conf.urls.defaults import *
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
from mysite.blog.models import Entry

info_dict = {
    &apos;queryset&apos;: Entry.objects.all(),
    &apos;date_field&apos;: &apos;pub_date&apos;,
}

sitemaps = {
    &apos;flatpages&apos;: FlatPageSitemap,
    &apos;blog&apos;: GenericSitemap(info_dict, priority=0.6),
}

urlpatterns = patterns(&apos;&apos;,
    # some generic view using info_dict
    # ...

    # the sitemap
    (r&apos;^sitemap\.xml$&apos;,
     &apos;django.contrib.sitemaps.views.sitemap&apos;,
     {&apos;sitemaps&apos;: sitemaps})
)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn225&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn225&quot;&gt;&#21019;&#24314;&#19968;&#20010;Sitemap&#32034;&#24341;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn226&quot;&gt;sitemap&#26694;&#26550;&#21516;&#26679;&#21487;&#20197;&#26681;&#25454; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemaps&lt;/span&gt;&lt;/tt&gt; &#23383;&#20856;&#20013;&#23450;&#20041;&#30340;&#21333;&#29420;&#30340;sitemap&#25991;&#20214;&#26469;&#24314;&#31435;&#32034;&#24341;&#12290; &#29992;&#27861;&#21306;&#21035;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn227&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn227&quot;&gt;&#24744;&#22312;&#24744;&#30340;URLconf &#20013;&#20351;&#29992;&#20102;&#20004;&#20010;&#35270;&#22270;: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sitemaps.views.index&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sitemaps.views.sitemap&lt;/span&gt;&lt;/tt&gt; . `` django.contrib.sitemaps.views.index`` &#21644;`` django.contrib.sitemaps.views.sitemap``&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn228&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn228&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sitemaps.views.sitemap&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#38656;&#35201;&#24102;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;section&lt;/span&gt;&lt;/tt&gt; &#20851;&#38190;&#23383;&#21442;&#25968;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn229&quot;&gt;&#36825;&#37324;&#26159;&#21069;&#38754;&#30340;&#20363;&#23376;&#30340;&#30456;&#20851;&#30340; URLconf &#34892;&#30475;&#36215;&#26469;&#30340;&#26679;&#23376;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn231&quot;&gt;(r&apos;^sitemap.xml$&apos;,
 &apos;django.contrib.sitemaps.views.index&apos;,
 {&apos;sitemaps&apos;: sitemaps}),

(r&apos;^sitemap-(?P&amp;lt;section&amp;gt;.+).xml$&apos;,
 &apos;django.contrib.sitemaps.views.sitemap&apos;,
 {&apos;sitemaps&apos;: sitemaps})
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn232&quot;&gt;&#36825;&#23558;&#33258;&#21160;&#29983;&#25104;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemap.xml&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;, &#23427;&#21516;&#26102;&#24341;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemap-flatpages.xml&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemap-blog.xml&lt;/span&gt;&lt;/tt&gt; . &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sitemap&lt;/span&gt;&lt;/tt&gt; &#31867;&#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemaps&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#26681;&#26412;&#27809;&#26377;&#26356;&#25913;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;google&quot;&gt;
&lt;span id=&quot;cn233&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn233&quot;&gt;&#36890;&#30693;Google&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn234&quot;&gt;&#24403;&#20320;&#30340;sitemap&#21464;&#21270;&#30340;&#26102;&#20505;&#65292;&#20320;&#20250;&#24819;&#36890;&#30693;Google&#65292;&#20197;&#20415;&#35753;&#23427;&#30693;&#36947;&#23545;&#20320;&#30340;&#31449;&#28857;&#36827;&#34892;&#37325;&#26032;&#32034;&#24341;&#12290; &#26694;&#26550;&#23601;&#25552;&#20379;&#20102;&#36825;&#26679;&#30340;&#19968;&#20010;&#20989;&#25968;&#65306;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sitemaps.ping_google()&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn235&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ping_google()&lt;/span&gt;&lt;/tt&gt; &#26377;&#19968;&#20010;&#21487;&#36873;&#30340;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemap_url&lt;/span&gt;&lt;/tt&gt; &#65292;&#23427;&#24212;&#35813;&#26159;&#20320;&#30340;&#31449;&#28857;&#22320;&#22270;&#30340;URL&#32477;&#23545;&#22320;&#22336;&#65288;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn236&quot;&gt;&#22914;&#26524;&#19981;&#33021;&#22815;&#30830;&#23450;&#20320;&#30340;sitemap URL, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ping_google()&lt;/span&gt;&lt;/tt&gt; &#20250;&#24341;&#21457; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sitemaps.SitemapNotFound&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn237&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#36890;&#36807;&#27169;&#22411;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;save()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#26469;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ping_google()&lt;/span&gt;&lt;/tt&gt; &#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn239&quot;&gt;from django.contrib.sitemaps import ping_google

class Entry(models.Model):
    # ...
    def save(self, *args, **kwargs):
        super(Entry, self).save(*args, **kwargs)
        try:
            ping_google()
        except Exception:
            # Bare &apos;except&apos; because we could get a variety
            # of HTTP-related exceptions.
            pass
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn240&quot;&gt;&#19968;&#20010;&#26356;&#26377;&#25928;&#30340;&#35299;&#20915;&#26041;&#26696;&#26159;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cron&lt;/span&gt;&lt;/tt&gt; &#33050;&#26412;&#25110;&#20219;&#21153;&#35843;&#24230;&#34920;&#26469;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ping_google()&lt;/span&gt;&lt;/tt&gt; &#65292;&#35813;&#26041;&#27861;&#20351;&#29992;Http&#30452;&#25509;&#35831;&#27714;Google&#26381;&#21153;&#22120;&#65292;&#20174;&#32780;&#20943;&#23569;&#27599;&#27425;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;save()&lt;/span&gt;&lt;/tt&gt; &#26102;&#21344;&#29992;&#30340;&#32593;&#32476;&#24102;&#23485;&#12290; The function makes an HTTP request to
Google&#8217;s servers, so you may not want to introduce that network overhead each time
you call &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;save()&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn241&quot;&gt;Finally, if &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.sitemaps&apos;&lt;/span&gt;&lt;/tt&gt; is in your &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; , then your
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt;&lt;/tt&gt; will include a new command, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ping_google&lt;/span&gt;&lt;/tt&gt; . This is useful for
command-line access to pinging. For example:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn243&quot;&gt;python manage.py ping_google /sitemap.xml
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn244&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn244&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn245&quot;&gt;&#19979;&#38754;, &#25105;&#20204;&#35201;&#32487;&#32493;&#28145;&#20837;&#25366;&#25496;&#25152;&#26377;&#30340;Django&#32473;&#20320;&#30340;&#24456;&#22909;&#30340;&#20869;&#32622;&#24037;&#20855;&#12290;
` &#31532;&#21313;&#22235;&#31456; &amp;lt;../chapter14/&amp;gt;`__ &#26597;&#30475;&#21019;&#24314;&#29992;&#25143;&#33258;&#23450;&#20041;&#31449;&#28857;&#38656;&#35201;&#30340;&#24037;&#20855;
sessions, users &#21644;authentication.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter14</id>
        <title type="html">chapter14</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter14"/>
        <published>2015-02-26T23:13:02+08:00</published>
        <updated>2015-02-26T23:17:43+08:00</updated> 
        <category term="/General" label="General" />
        <summary type="html">
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |&#26041;&#27861;                                                                                         |&#25551;&#36848;                                                                                                                                                  |
   +=============================================================================================+======================================================================================================================================================+
   |``is_authenticated()``                                                                       |&#23545;&#20110;&#30495;&#23454;&#30340;User&#23545;&#35937;&#65292;&#24635;&#26159;&#36820;&#22238;\ `` True`` &#12290;                                                                                                            |
   |                                                                                             |&#36825;&#26159;&#19968;&#20010;&#20998;&#36776;&#29992;&#25143;&#26159;&#21542;&#24050;&#34987;&#37492;&#35777;&#30340;&#26041;&#27861;&#12290; &#23427;&#24182;&#19981;&#24847;&#21619;&#30528;&#20219;&#20309;&#26435;&#38480;&#65292;&#20063;&#19981;&#26816;&#26597;&#29992;&#25143;&#26159;&#21542;&#20173;&#26159;&#27963;&#21160;&#30340;&#12290; &#23427;&#20165;&#35828;&#26126;&#27492;&#29992;&#25143;&#24050;&#34987;&#25104;&#21151;&#37492;&#35777;&#12290;                                  |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``is_anonymous()``                                                                           |&#23545;&#20110;\ `` AnonymousUser`` &#23545;&#35937;&#36820;&#22238;\ `` True`` &#65288;&#23545;&#20110;&#30495;&#23454;&#30340;\ `` User`` &#23545;&#35937;&#36820;&#22238;\ `` False`` &#65289;&#12290;                                                        |
   |                                                                                             |&#24635;&#30340;&#26469;&#35828;&#65292;&#27604;&#36215;&#36825;&#20010;&#26041;&#27861;&#65292;&#20320;&#24212;&#35813;&#20542;&#21521;&#20110;&#20351;&#29992;\ `` is_authenticated()`` &#26041;&#27861;&#12290;                                                                              |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``get_full_name()``                                                                          |&#36820;&#22238;\ `` first_name`` &#21152;&#19978;\ `` last_name`` &#65292;&#20013;&#38388;&#25554;&#20837;&#19968;&#20010;&#31354;&#26684;&#12290;                                                                                       |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``set_password(passwd)``                                                                     |&#35774;&#23450;&#29992;&#25143;&#23494;&#30721;&#20026;&#25351;&#23450;&#23383;&#31526;&#20018;&#65288;&#33258;&#21160;&#22788;&#29702;&#25104;&#21704;&#24076;&#20018;&#65289;&#12290; &#23454;&#38469;&#19978;&#27809;&#26377;&#20445;&#23384;\ ``User``\&#23545;&#35937;&#12290;                                                                        |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |check_password(passwd)                                                                       |&#22914;&#26524;&#25351;&#23450;&#30340;&#23383;&#31526;&#20018;&#19982;&#29992;&#25143;&#23494;&#30721;&#21305;&#37197;&#21017;&#36820;&#22238;\ ``True``\&#12290; &#27604;&#36739;&#26102;&#20250;&#20351;&#29992;&#23494;&#30721;&#21704;&#24076;&#34920;&#12290;                                                                            |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``get_group_permissions()``                                                                  |&#36820;&#22238;&#19968;&#20010;&#29992;&#25143;&#36890;&#36807;&#20854;&#25152;&#23646;&#32452;&#33719;&#24471;&#30340;&#26435;&#38480;&#23383;&#31526;&#20018;&#21015;&#34920;&#12290;                                                                                                        |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``get_all_permissions()``                                                                    |&#36820;&#22238;&#19968;&#20010;&#29992;&#25143;&#36890;&#36807;&#20854;&#25152;&#23646;&#32452;&#20197;&#21450;&#33258;&#36523;&#26435;&#38480;&#25152;&#33719;&#24471;&#30340;&#26435;&#38480;&#23383;&#31526;&#20018;&#21015;&#34920;&#12290;                                                                                          |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``has_perm(perm)``                                                                           |&#22914;&#26524;&#29992;&#25143;&#26377;&#25351;&#23450;&#30340;&#26435;&#38480;&#65292;&#21017;&#36820;&#22238;\ `` True`` &#65292;&#27492;&#26102;\ `` perm`` &#30340;&#26684;&#24335;&#26159;\ `` &quot;package.codename&quot;`` &#12290;&#22914;&#26524;&#29992;&#25143;&#24050;&#19981;&#27963;&#21160;&#65292;&#27492;&#26041;&#27861;&#24635;&#26159;&#36820;&#22238;\ `` False`` &#12290;         |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |has_perms(perm_list)                                                                         |&#22914;&#26524;&#29992;&#25143;&#25317;&#26377;\ * &#20840;&#37096;* &#30340;&#25351;&#23450;&#26435;&#38480;&#65292;&#21017;&#36820;&#22238;\ `` True`` &#12290; &#22914;&#26524;&#29992;&#25143;&#26159;&#19981;&#27963;&#21160;&#30340;&#65292;&#36825;&#20010;&#26041;&#27861;&#24635;&#26159;&#36820;&#22238;\ `` False`` &#12290;                                            |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``has_module_perms(app_label)``                                                              |&#22914;&#26524;&#29992;&#25143;&#25317;&#26377;&#32473;&#23450;&#30340;\ `` app_label`` &#20013;&#30340;&#20219;&#20309;&#26435;&#38480;&#65292;&#21017;&#36820;&#22238;\ `` True`` &#12290;&#22914;&#26524;&#29992;&#25143;&#24050;&#19981;&#27963;&#21160;&#65292;&#36825;&#20010;&#26041;&#27861;&#24635;&#26159;&#36820;&#22238;\ `` False`` &#12290;                                |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |get_and_delete_messages()                                                                    |&#36820;&#22238;&#19968;&#20010;&#29992;&#25143;&#38431;&#21015;&#20013;&#30340;\ `` Message`` &#23545;&#35937;&#21015;&#34920;&#65292;&#24182;&#20174;&#38431;&#21015;&#20013;&#23558;&#36825;&#20123;&#28040;&#24687;&#21024;&#38500;&#12290;                                                                               |
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``email_user(subj, msg)``                                                                    |&#21521;&#29992;&#25143;&#21457;&#36865;&#19968;&#23553;&#30005;&#23376;&#37038;&#20214;&#12290; &#36825;&#23553;&#30005;&#23376;&#37038;&#20214;&#26159;&#20174;\ `` DEFAULT_FROM_EMAIL`` &#35774;&#32622;&#30340;&#22320;&#22336;&#21457;&#36865;&#30340;&#12290; &#20320;&#36824;&#21487;&#20197;&#20256;&#36865;&#19968;&#20010;&#31532;&#19977;&#21442;&#25968;&#65306;\ `` from_email`` &#65292;&#20197;&#35206;&#30422;&#30005;&#37038;&#20013;&#30340;&#21457;&#36865;&#22320;&#22336;&#12290;|
   +---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+

&lt;/pre&gt;
&lt;/div&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&#26368;&#21518;&#65292;`` User`` &#23545;&#35937;&#26377;&#20004;&#20010;many-to-many&#23646;&#24615;&#12290; `` groups`` &#21644;`` permissions`` &#12290;&#27491;&#22914;&#20854;&#20182;&#30340;many-to-many&#23646;&#24615;&#20351;&#29992;&#30340;&#26041;&#27861;&#19968;&#26679;&#65292;`` User`` &#23545;&#35937;&#21487;&#20197;&#33719;&#24471;&#23427;&#20204;&#30456;&#20851;&#30340;&#23545;&#35937;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn134&quot;&gt;# Set a user&apos;s groups:
myuser.groups = group_list

# Add a user to some groups:
myuser.groups.add(group1, group2,...)

# Remove a user from some groups:
myuser.groups.remove(group1, group2,...)

# Remove a user from all groups:
myuser.groups.clear()

# Permissions work the same way
myuser.permissions = permission_list
myuser.permissions.add(permission1, permission2, ...)
myuser.permissions.remove(permission1, permission2, ...)
myuser.permissions.clear()
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn135&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#30331;&#24405;&#21644;&#36864;&#20986;&lt;/h3&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;Django &#25552;&#20379;&#20869;&#32622;&#30340;&#35270;&#22270;(view)&#20989;&#25968;&#29992;&#20110;&#22788;&#29702;&#30331;&#24405;&#21644;&#36864;&#20986; (&#20197;&#21450;&#20854;&#20182;&#22855;&#25216;&#28139;&#24039;)&#65292;&#20294;&#22312;&#24320;&#22987;&#21069;&#65292;&#25105;&#20204;&#26469;&#30475;&#30475;&#22914;&#20309;&#25163;&#24037;&#30331;&#24405;&#21644;&#36864;&#20986;&#12290; Django&#25552;&#20379;&#20004;&#20010;&#20989;&#25968;&#26469;&#25191;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.auth&lt;/span&gt;&lt;/tt&gt;\&#20013;&#30340;&#21160;&#20316; &lt;span class=&quot;classifier-delimiter&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;classifier&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authenticate()&lt;/span&gt;&lt;/tt&gt;&lt;/span&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p class=&quot;first last cn&quot; id=&quot;cn136&quot;&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login()&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn137&quot;&gt;&#35748;&#35777;&#32473;&#20986;&#30340;&#29992;&#25143;&#21517;&#21644;&#23494;&#30721;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authenticate()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#12290;&#23427;&#25509;&#21463;&#20004;&#20010;&#21442;&#25968;&#65292;&#29992;&#25143;&#21517; username &#21644; &#23494;&#30721; password &#65292;&#24182;&#22312;&#23494;&#30721;&#23545;&#32473;&#20986;&#30340;&#29992;&#25143;&#21517;&#21512;&#27861;&#30340;&#24773;&#20917;&#19979;&#36820;&#22238;&#19968;&#20010; User &#23545;&#35937;&#12290; &#22914;&#26524;&#23494;&#30721;&#19981;&#21512;&#27861;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authenticate()&lt;/span&gt;&lt;/tt&gt;&#36820;&#22238;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn139&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.contrib import auth
&amp;gt;&amp;gt;&amp;gt; user = auth.authenticate(username=&apos;john&apos;, password=&apos;secret&apos;)
&amp;gt;&amp;gt;&amp;gt; if user is not None:
...     print &quot;Correct!&quot;
... else:
...     print &quot;Invalid password.&quot;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn140&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authenticate()&lt;/span&gt;&lt;/tt&gt; &#21482;&#26159;&#39564;&#35777;&#19968;&#20010;&#29992;&#25143;&#30340;&#35777;&#20070;&#32780;&#24050;&#12290; &#32780;&#35201;&#30331;&#24405;&#19968;&#20010;&#29992;&#25143;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login()&lt;/span&gt;&lt;/tt&gt; &#12290;&#35813;&#20989;&#25968;&#25509;&#21463;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#21644;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#20316;&#20026;&#21442;&#25968;&#24182;&#20351;&#29992;Django&#30340;&#20250;&#35805;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;session&lt;/span&gt;&lt;/tt&gt; &#65289;&#26694;&#26550;&#25226;&#29992;&#25143;&#30340;ID&#20445;&#23384;&#22312;&#35813;&#20250;&#35805;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn141&quot;&gt;&#19979;&#38754;&#30340;&#20363;&#23376;&#28436;&#31034;&#20102;&#22914;&#20309;&#22312;&#19968;&#20010;&#35270;&#22270;&#20013;&#21516;&#26102;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authenticate()&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn143&quot;&gt;from django.contrib import auth

def login_view(request):
    username = request.POST.get(&apos;username&apos;, &apos;&apos;)
    password = request.POST.get(&apos;password&apos;, &apos;&apos;)
    user = auth.authenticate(username=username, password=password)
    if user is not None and user.is_active:
        # Correct password, and the user is marked &quot;active&quot;
        auth.login(request, user)
        # Redirect to a success page.
        return HttpResponseRedirect(&quot;/account/loggedin/&quot;)
    else:
        # Show an error page
        return HttpResponseRedirect(&quot;/account/invalid/&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn144&quot;&gt;&#27880;&#38144;&#19968;&#20010;&#29992;&#25143;&#65292;&#22312;&#20320;&#30340;&#35270;&#22270;&#20013;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.auth.logout()&lt;/span&gt;&lt;/tt&gt; &#12290; &#23427;&#25509;&#21463;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#24182;&#19988;&#27809;&#26377;&#36820;&#22238;&#20540;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn146&quot;&gt;from django.contrib import auth

def logout_view(request):
    auth.logout(request)
    # Redirect to a success page.
    return HttpResponseRedirect(&quot;/account/loggedout/&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn147&quot;&gt;&#27880;&#24847;&#65292;&#21363;&#20351;&#29992;&#25143;&#27809;&#26377;&#30331;&#24405;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;logout()&lt;/span&gt;&lt;/tt&gt; &#20063;&#19981;&#20250;&#25243;&#20986;&#20219;&#20309;&#24322;&#24120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn148&quot;&gt;&#22312;&#23454;&#38469;&#20013;&#65292;&#20320;&#19968;&#33324;&#19981;&#38656;&#35201;&#33258;&#24049;&#20889;&#30331;&#24405;/&#30331;&#20986;&#30340;&#20989;&#25968;&#65307;&#35748;&#35777;&#31995;&#32479;&#25552;&#20379;&#20102;&#19968;&#31995;&#20363;&#35270;&#22270;&#29992;&#26469;&#22788;&#29702;&#30331;&#24405;&#21644;&#30331;&#20986;&#12290; &#20351;&#29992;&#35748;&#35777;&#35270;&#22270;&#30340;&#31532;&#19968;&#27493;&#26159;&#25226;&#23427;&#20204;&#20889;&#22312;&#20320;&#30340;URLconf&#20013;&#12290; &#20320;&#38656;&#35201;&#36825;&#26679;&#20889;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn150&quot;&gt;from django.contrib.auth.views import login, logout

urlpatterns = patterns(&apos;&apos;,
    # existing patterns here...
    (r&apos;^accounts/login/$&apos;,  login),
    (r&apos;^accounts/logout/$&apos;, logout),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn151&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/accounts/login/&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/accounts/logout/&lt;/span&gt;&lt;/tt&gt; &#26159;Django&#25552;&#20379;&#30340;&#35270;&#22270;&#30340;&#40664;&#35748;URL&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn152&quot;&gt;&#32570;&#30465;&#24773;&#20917;&#19979;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#28210;&#26579; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;registragiton/login.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;(&#21487;&#20197;&#36890;&#36807;&#35270;&#22270;&#30340;&#39069;&#22806;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_name&lt;/span&gt;&lt;/tt&gt; &#20462;&#25913;&#36825;&#20010;&#27169;&#26495;&#21517;&#31216;)&#12290; &#36825;&#20010;&#34920;&#21333;&#24517;&#39035;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;username&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;password&lt;/span&gt;&lt;/tt&gt; &#22495;&#12290;&#22914;&#19979;&#31034;&#20363;&#65306; &#19968;&#20010;&#31616;&#21333;&#30340; template &#30475;&#36215;&#26469;&#26159;&#36825;&#26679;&#30340;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn154&quot;&gt;{% extends &quot;base.html&quot; %}

{% block content %}

  {% if form.errors %}
    &amp;lt;p class=&quot;error&quot;&amp;gt;Sorry, that&apos;s not a valid username or password&amp;lt;/p&amp;gt;
  {% endif %}

  &amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;
    &amp;lt;label for=&quot;username&quot;&amp;gt;User name:&amp;lt;/label&amp;gt;
    &amp;lt;input type=&quot;text&quot; name=&quot;username&quot; value=&quot;&quot; id=&quot;username&quot;&amp;gt;
    &amp;lt;label for=&quot;password&quot;&amp;gt;Password:&amp;lt;/label&amp;gt;
    &amp;lt;input type=&quot;password&quot; name=&quot;password&quot; value=&quot;&quot; id=&quot;password&quot;&amp;gt;

    &amp;lt;input type=&quot;submit&quot; value=&quot;login&quot; /&amp;gt;
    &amp;lt;input type=&quot;hidden&quot; name=&quot;next&quot; value=&quot;{{ next|escape }}&quot; /&amp;gt;
  &amp;lt;/form&amp;gt;

{% endblock %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&#22914;&#26524;&#29992;&#25143;&#30331;&#24405;&#25104;&#21151;&#65292;&#32570;&#30465;&#20250;&#37325;&#23450;&#21521;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/accounts/profile&lt;/span&gt;&lt;/tt&gt; &#12290; &#20320;&#21487;&#20197;&#25552;&#20379;&#19968;&#20010;&#20445;&#23384;&#30331;&#24405;&#21518;&#37325;&#23450;&#21521;URL&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;next&lt;/span&gt;&lt;/tt&gt;&#38544;&#34255;&#22495;&#26469;&#37325;&#36733;&#23427;&#30340;&#34892;&#20026;&#12290; &#20063;&#21487;&#20197;&#25226;&#20540;&#20197;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt;&#21442;&#25968;&#30340;&#24418;&#24335;&#21457;&#36865;&#32473;&#35270;&#22270;&#20989;&#25968;&#65292;&#23427;&#20250;&#20197;&#21464;&#37327;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;next&lt;/span&gt;&lt;/tt&gt;&#30340;&#24418;&#24335;&#20445;&#23384;&#22312;&#19978;&#19979;&#25991;&#20013;&#65292;&#36825;&#26679;&#20320;&#23601;&#21487;&#20197;&#25226;&#23427;&#29992;&#22312;&#38544;&#34255;&#22495;&#19978;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn156&quot;&gt;logout&#35270;&#22270;&#26377;&#19968;&#20123;&#19981;&#21516;&#12290; &#40664;&#35748;&#24773;&#20917;&#19979;&#23427;&#28210;&#26579; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;registration/logged_out.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#65288;&#36825;&#20010;&#35270;&#22270;&#19968;&#33324;&#21253;&#21547;&#20320;&#24050;&#32463;&#25104;&#21151;&#36864;&#20986;&#30340;&#20449;&#24687;&#65289;&#12290; &#35270;&#22270;&#20013;&#36824;&#21487;&#20197;&#21253;&#21547;&#19968;&#20010;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;next_page&lt;/span&gt;&lt;/tt&gt; &#29992;&#20110;&#36864;&#20986;&#21518;&#37325;&#23450;&#21521;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn157&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn157&quot;&gt;&#38480;&#21046;&#24050;&#30331;&#24405;&#29992;&#25143;&#30340;&#35775;&#38382;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn158&quot;&gt;&#26377;&#24456;&#22810;&#21407;&#22240;&#38656;&#35201;&#25511;&#21046;&#29992;&#25143;&#35775;&#38382;&#31449;&#28857;&#30340;&#26576;&#37096;&#20998;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&#19968;&#20010;&#31616;&#21333;&#21407;&#22987;&#30340;&#38480;&#21046;&#26041;&#27861;&#26159;&#26816;&#26597; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.user.is_authenticated()&lt;/span&gt;&lt;/tt&gt; ,&#28982;&#21518;&#37325;&#23450;&#21521;&#21040;&#30331;&#38470;&#39029;&#38754;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn161&quot;&gt;from django.http import HttpResponseRedirect

def my_view(request):
    if not request.user.is_authenticated():
        return HttpResponseRedirect(&apos;/accounts/login/?next=%s&apos; % request.path)
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#25110;&#32773;&#26174;&#31034;&#19968;&#20010;&#20986;&#38169;&#20449;&#24687;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn164&quot;&gt;def my_view(request):
    if not request.user.is_authenticated():
        return render_to_response(&apos;myapp/login_error.html&apos;)
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&#20316;&#20026;&#19968;&#20010;&#24555;&#25463;&#26041;&#24335;, &#20320;&#21487;&#20197;&#20351;&#29992;&#20415;&#25463;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login_required&lt;/span&gt;&lt;/tt&gt; &#20462;&#39280;&#31526;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn167&quot;&gt;from django.contrib.auth.decorators import login_required

@login_required
def my_view(request):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login_required&lt;/span&gt;&lt;/tt&gt; &#20570;&#19979;&#38754;&#30340;&#20107;&#24773;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn169&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn169&quot;&gt;&#22914;&#26524;&#29992;&#25143;&#27809;&#26377;&#30331;&#24405;, &#37325;&#23450;&#21521;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/accounts/login/&lt;/span&gt;&lt;/tt&gt; , &#25226;&#24403;&#21069;&#32477;&#23545;URL&#20316;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;next&lt;/span&gt;&lt;/tt&gt; &#22312;&#26597;&#35810;&#23383;&#31526;&#20018;&#20013;&#20256;&#36882;&#36807;&#21435;, &#20363;&#22914;&#65306;
/accounts/login/?next=/polls/3/ &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn170&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn170&quot;&gt;&#22914;&#26524;&#29992;&#25143;&#24050;&#32463;&#30331;&#24405;, &#27491;&#24120;&#22320;&#25191;&#34892;&#35270;&#22270;&#20989;&#25968;&#12290; &#35270;&#22270;&#20195;&#30721;&#23601;&#21487;&#20197;&#20551;&#23450;&#29992;&#25143;&#24050;&#32463;&#30331;&#24405;&#20102;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn171&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn171&quot;&gt;&#23545;&#36890;&#36807;&#27979;&#35797;&#30340;&#29992;&#25143;&#38480;&#21046;&#35775;&#38382;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn172&quot;&gt;&#38480;&#21046;&#35775;&#38382;&#21487;&#20197;&#22522;&#20110;&#26576;&#31181;&#26435;&#38480;&#65292;&#26576;&#20123;&#26816;&#26597;&#25110;&#32773;&#20026;login&#35270;&#22270;&#25552;&#20379;&#19981;&#21516;&#30340;&#20301;&#32622;&#65292;&#36825;&#20123;&#23454;&#29616;&#26041;&#24335;&#22823;&#33268;&#30456;&#21516;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn173&quot;&gt;&#19968;&#33324;&#30340;&#26041;&#27861;&#26159;&#30452;&#25509;&#22312;&#35270;&#22270;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.user&lt;/span&gt;&lt;/tt&gt; &#19978;&#36816;&#34892;&#26816;&#26597;&#12290; &#20363;&#22914;&#65292;&#19979;&#38754;&#35270;&#22270;&#30830;&#35748;&#29992;&#25143;&#30331;&#24405;&#24182;&#26159;&#21542;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;polls.can_vote&lt;/span&gt;&lt;/tt&gt;&#26435;&#38480;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn175&quot;&gt;def vote(request):
    if request.user.is_authenticated() and request.user.has_perm(&apos;polls.can_vote&apos;)):
        # vote here
    else:
        return HttpResponse(&quot;You can&apos;t vote in this poll.&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn176&quot;&gt;&#24182;&#19988;Django&#26377;&#19968;&#20010;&#31216;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user_passes_test&lt;/span&gt;&lt;/tt&gt; &#30340;&#31616;&#27905;&#26041;&#24335;&#12290;&#23427;&#25509;&#21463;&#21442;&#25968;&#28982;&#21518;&#20026;&#20320;&#25351;&#23450;&#30340;&#24773;&#20917;&#29983;&#25104;&#35013;&#39280;&#22120;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn178&quot;&gt;def user_can_vote(user):
    return user.is_authenticated() and user.has_perm(&quot;polls.can_vote&quot;)

@user_passes_test(user_can_vote, login_url=&quot;/login/&quot;)
def vote(request):
    # Code here can assume a logged-in user with the correct permission.
    ...
&lt;/pre&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user_passes_test&lt;/span&gt;&lt;/tt&gt; &#20351;&#29992;&#19968;&#20010;&#24517;&#38656;&#30340;&#21442;&#25968;&#65306; &#19968;&#20010;&#21487;&#35843;&#29992;&#30340;&#26041;&#27861;&#65292;&#24403;&#23384;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#24182;&#24403;&#27492;&#29992;&#25143;&#20801;&#35768;&#26597;&#30475;&#35813;&#39029;&#38754;&#26102;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#12290; &#27880;&#24847; user_passes_test &#19981;&#20250;&#33258;&#21160;&#26816;&#26597; User&lt;/dt&gt;
&lt;dd&gt;&lt;p class=&quot;first last cn&quot; id=&quot;cn179&quot;&gt;&#26159;&#21542;&#35748;&#35777;&#65292;&#20320;&#24212;&#35813;&#33258;&#24049;&#20570;&#36825;&#20214;&#20107;&#12290;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;&#20363;&#23376;&#20013;&#25105;&#20204;&#20063;&#23637;&#31034;&#20102;&#31532;&#20108;&#20010;&#21487;&#36873;&#30340;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login_url&lt;/span&gt;&lt;/tt&gt; &#65292;&#23427;&#35753;&#20320;&#25351;&#23450;&#20320;&#30340;&#30331;&#24405;&#39029;&#38754;&#30340;URL&#65288;&#40664;&#35748;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/accounts/login/&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290; &#22914;&#26524;&#29992;&#25143;&#27809;&#26377;&#36890;&#36807;&#27979;&#35797;&#65292;&#37027;&#20040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user_passes_test&lt;/span&gt;&lt;/tt&gt;&#23558;&#25226;&#29992;&#25143;&#37325;&#23450;&#21521;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login_url&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn181&quot;&gt;&#26082;&#28982;&#26816;&#26597;&#29992;&#25143;&#26159;&#21542;&#26377;&#19968;&#20010;&#29305;&#27530;&#26435;&#38480;&#26159;&#30456;&#23545;&#24120;&#35265;&#30340;&#20219;&#21153;&#65292;Django&#20026;&#36825;&#31181;&#24773;&#24418;&#25552;&#20379;&#20102;&#19968;&#20010;&#25463;&#24452;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;permission_required()&lt;/span&gt;&lt;/tt&gt; &#35013;&#39280;&#22120;&#12290; &#20351;&#29992;&#36825;&#20010;&#35013;&#39280;&#22120;&#65292;&#21069;&#38754;&#30340;&#20363;&#23376;&#21487;&#20197;&#25913;&#20889;&#20026;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn183&quot;&gt;from django.contrib.auth.decorators import permission_required

@permission_required(&apos;polls.can_vote&apos;, login_url=&quot;/login/&quot;)
def vote(request):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn184&quot;&gt;&#27880;&#24847;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;permission_required()&lt;/span&gt;&lt;/tt&gt; &#20063;&#26377;&#19968;&#20010;&#21487;&#36873;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login_url&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;, &#36825;&#20010;&#21442;&#25968;&#40664;&#35748;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;/accounts/login/&apos;&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#38480;&#21046;&#36890;&#29992;&#35270;&#22270;&#30340;&#35775;&#38382;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#22312;Django&#29992;&#25143;&#37038;&#20214;&#21015;&#34920;&#20013;&#38382;&#21040;&#26368;&#22810;&#30340;&#38382;&#39064;&#26159;&#20851;&#20110;&#23545;&#36890;&#29992;&#35270;&#22270;&#30340;&#38480;&#21046;&#24615;&#35775;&#38382;&#12290; &#20026;&#23454;&#29616;&#36825;&#20010;&#21151;&#33021;&#65292;&#20320;&#38656;&#35201;&#33258;&#24049;&#21253;&#35013;&#35270;&#22270;&#65292;&#24182;&#19988;&#22312;URLconf&#20013;&#65292;&#23558;&#20320;&#33258;&#24049;&#30340;&#29256;&#26412;&#26367;&#25442;&#36890;&#29992;&#35270;&#22270;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn188&quot;&gt;from django.contrib.auth.decorators import login_required
from django.views.generic.date_based import object_detail

@login_required
def limited_object_detail(*args, **kwargs):
    return object_detail(*args, **kwargs)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn189&quot;&gt;&#24403;&#28982;, &#20320;&#21487;&#20197;&#29992;&#20219;&#20309;&#20854;&#20182;&#38480;&#23450;&#20462;&#39280;&#31526;&#26469;&#26367;&#25442; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;login_required&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;users-permissions-groups&quot;&gt;
&lt;span id=&quot;cn190&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&#31649;&#29702; Users, Permissions &#21644; Groups&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn191&quot;&gt;&#31649;&#29702;&#35748;&#35777;&#31995;&#32479;&#26368;&#31616;&#21333;&#30340;&#26041;&#27861;&#26159;&#36890;&#36807;&#31649;&#29702;&#30028;&#38754;&#12290;
&#31532;&#20845;&#31456;&#35752;&#35770;&#20102;&#24590;&#26679;&#20351;&#29992;Django&#30340;&#31649;&#29702;&#30028;&#38754;&#26469;&#32534;&#36753;&#29992;&#25143;&#21644;&#25511;&#21046;&#20182;&#20204;&#30340;&#26435;&#38480;&#21644;&#21487;&#35775;&#38382;&#24615;&#65292;&#24182;&#19988;&#22823;&#22810;&#25968;&#26102;&#38388;&#20320;&#20351;&#29992;&#36825;&#20010;&#30028;&#38754;&#23601;&#21487;&#20197;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn192&quot;&gt;&#28982;&#32780;&#65292;&#24403;&#20320;&#38656;&#35201;&#32477;&#23545;&#30340;&#25511;&#21046;&#26435;&#30340;&#26102;&#20505;&#65292;&#26377;&#19968;&#20123;&#20302;&#23618; API &#38656;&#35201;&#28145;&#20837;&#19987;&#30740;&#65292;&#25105;&#20204;&#23558;&#22312;&#19979;&#38754;&#30340;&#31456;&#33410;&#20013;&#35752;&#35770;&#23427;&#20204;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn193&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&#21019;&#24314;&#29992;&#25143;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn194&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;create_user&lt;/span&gt;&lt;/tt&gt; &#36741;&#21161;&#20989;&#25968;&#21019;&#24314;&#29992;&#25143;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn196&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.contrib.auth.models import User
&amp;gt;&amp;gt;&amp;gt; user = User.objects.create_user(username=&apos;john&apos;,
...                                 email=&apos;jlennon@beatles.com&apos;,
...                                 password=&apos;glass onion&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&#22312;&#36825;&#37324;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user&lt;/span&gt;&lt;/tt&gt; &#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#31867;&#30340;&#19968;&#20010;&#23454;&#20363;&#65292;&#20934;&#22791;&#29992;&#20110;&#21521;&#25968;&#25454;&#24211;&#20013;&#23384;&#20648;&#25968;&#25454;&#12290;&#65288;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;create_user()&lt;/span&gt;&lt;/tt&gt;&#23454;&#38469;&#19978;&#27809;&#26377;&#35843;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;save()&lt;/span&gt;&lt;/tt&gt;&#65289;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;create_user()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#24182;&#27809;&#26377;&#22312;&#25968;&#25454;&#24211;&#20013;&#21019;&#24314;&#35760;&#24405;&#65292;&#22312;&#20445;&#23384;&#25968;&#25454;&#20043;&#21069;&#65292;&#20320;&#20173;&#28982;&#21487;&#20197;&#32487;&#32493;&#20462;&#25913;&#23427;&#30340;&#23646;&#24615;&#20540;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn199&quot;&gt;&amp;gt;&amp;gt;&amp;gt; user.is_staff = True
&amp;gt;&amp;gt;&amp;gt; user.save()
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn200&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&#20462;&#25913;&#23494;&#30721;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn201&quot;&gt;&#20320;&#21487;&#20197;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;set_password()&lt;/span&gt;&lt;/tt&gt; &#26469;&#20462;&#25913;&#23494;&#30721;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn203&quot;&gt;&amp;gt;&amp;gt;&amp;gt; user = User.objects.get(username=&apos;john&apos;)
&amp;gt;&amp;gt;&amp;gt; user.set_password(&apos;goo goo goo joob&apos;)
&amp;gt;&amp;gt;&amp;gt; user.save()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn204&quot;&gt;&#38500;&#38750;&#20320;&#28165;&#26970;&#30340;&#30693;&#36947;&#33258;&#24049;&#22312;&#20570;&#20160;&#20040;&#65292;&#21542;&#21017;&#19981;&#35201;&#30452;&#25509;&#20462;&#25913; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;password&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;&#12290; &#20854;&#20013;&#20445;&#23384;&#30340;&#26159;&#23494;&#30721;&#30340; &lt;em&gt;&#21152;&#20837;salt&#30340;hash&#20540;&lt;/em&gt; &#65292;&#25152;&#20197;&#19981;&#33021;&#30452;&#25509;&#32534;&#36753;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn205&quot;&gt;&#19968;&#33324;&#26469;&#35828;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;password&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;&#26159;&#19968;&#20010;&#23383;&#31526;&#20018;&#65292;&#26684;&#24335;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn207&quot;&gt;hashtype$salt$hash
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn208&quot;&gt;&#36825;&#26159;&#21704;&#24076;&#31867;&#22411;&#65292;salt&#21644;&#21704;&#24076;&#26412;&#36523;&#65292;&#29992;&#32654;&#20803;&#31526;&#21495;&#65288;$&#65289;&#20998;&#38548;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;hashtype&lt;/span&gt;&lt;/tt&gt; &#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sha1&lt;/span&gt;&lt;/tt&gt; &#65288;&#40664;&#35748;&#65289;&#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;md5&lt;/span&gt;&lt;/tt&gt; &#65292;&#23427;&#26159;&#29992;&#26469;&#22788;&#29702;&#21333;&#21521;&#23494;&#30721;&#21704;&#24076;&#30340;&#31639;&#27861;&#12290; Salt&#26159;&#19968;&#20010;&#29992;&#26469;&#21152;&#23494;&#21407;&#22987;&#23494;&#30721;&#20197;&#21019;&#24314;&#21704;&#24076;&#30340;&#38543;&#26426;&#23383;&#31526;&#20018;&#65292;&#20363;&#22914;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn211&quot;&gt;sha1$a1976$a36cc8cbf81742a8fb52e221aaeab48ed7f58ab4
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn212&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User.set_password()&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User.check_password()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#22312;&#21518;&#21488;&#22788;&#29702;&#21644;&#26816;&#26597;&#36825;&#20123;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn213&quot;&gt;salt&#21270;&#24471;&#21704;&#24076;&#20540;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn214&quot;&gt;&#19968;&#27425; &lt;em&gt;&#21704;&#24076;&lt;/em&gt; &#26159;&#19968;&#27425;&#21333;&#21521;&#30340;&#21152;&#23494;&#36807;&#31243;&#65292;&#20320;&#33021;&#23481;&#26131;&#22320;&#35745;&#31639;&#20986;&#19968;&#20010;&#32473;&#23450;&#20540;&#30340;&#21704;&#24076;&#30721;&#65292;&#20294;&#26159;&#20960;&#20046;&#19981;&#21487;&#33021;&#20174;&#19968;&#20010;&#21704;&#24076;&#30721;&#35299;&#20986;&#23427;&#30340;&#21407;&#20540;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn215&quot;&gt;&#22914;&#26524;&#25105;&#20204;&#20197;&#26222;&#36890;&#25991;&#26412;&#23384;&#20648;&#23494;&#30721;,&#20219;&#20309;&#33021;&#36827;&#20837;&#25968;&#25454;&#24211;&#30340;&#20154;&#37117;&#33021;&#36731;&#26131;&#30340;&#33719;&#21462;&#27599;&#20010;&#20154;&#30340;&#23494;&#30721;&#12290; &#20351;&#29992;&#21704;&#24076;&#26041;&#24335;&#26469;&#23384;&#20648;&#23494;&#30721;&#30456;&#24212;&#30340;&#20943;&#23569;&#20102;&#25968;&#25454;&#24211;&#27844;&#38706;&#23494;&#30721;&#30340;&#21487;&#33021;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn216&quot;&gt;&#28982;&#32780;&#65292;&#25915;&#20987;&#32773;&#20173;&#28982;&#21487;&#20197;&#20351;&#29992; &lt;em&gt;&#26292;&#21147;&#30772;&#35299;&lt;/em&gt; &#20351;&#29992;&#19978;&#30334;&#19975;&#20010;&#23494;&#30721;&#19982;&#23384;&#20648;&#30340;&#20540;&#23545;&#27604;&#26469;&#33719;&#21462;&#25968;&#25454;&#24211;&#23494;&#30721;&#12290; &#36825;&#38656;&#35201;&#33457;&#19968;&#20123;&#26102;&#38388;&#65292;&#20294;&#26159;&#26234;&#33021;&#30005;&#33041;&#24778;&#20154;&#30340;&#36895;&#24230;&#36229;&#20986;&#20102;&#20320;&#30340;&#24819;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&#26356;&#31967;&#31957;&#30340;&#26159;&#25105;&#20204;&#21487;&#20197;&#20844;&#24320;&#22320;&#24471;&#21040; &lt;em&gt;rainbow tables&lt;/em&gt; &#65288;&#19968;&#31181;&#26292;&#21147;&#23494;&#30721;&#30772;&#35299;&#34920;&#65289;&#25110;&#39044;&#22791;&#26377;&#19978;&#30334;&#19975;&#21704;&#24076;&#23494;&#30721;&#20540;&#30340;&#25968;&#25454;&#24211;&#12290; &#20351;&#29992;rainbow tables&#21487;&#20197;&#22312;&#20960;&#31186;&#20043;&#20869;&#23601;&#33021;&#25630;&#23450;&#26368;&#22797;&#26434;&#30340;&#19968;&#20010;&#23494;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn218&quot;&gt;&#22312;&#23384;&#20648;&#30340;hash&#20540;&#30340;&#22522;&#30784;&#19978;&#65292;&#21152;&#20837; &lt;em&gt;salt&lt;/em&gt; &#20540;&#65288;&#19968;&#20010;&#38543;&#26426;&#20540;&#65289;&#65292;&#22686;&#21152;&#20102;&#23494;&#30721;&#30340;&#24378;&#24230;&#65292;&#20351;&#24471;&#30772;&#35299;&#26356;&#21152;&#22256;&#38590;&#12290; &#22240;&#20026;&#27599;&#20010;&#23494;&#30721;&#30340;salt&#20540;&#37117;&#19981;&#30456;&#21516;&#65292;&#36825;&#20063;&#38480;&#21046;&#20102;rainbow table&#30340;&#20351;&#29992;&#65292;&#20351;&#24471;&#25915;&#20987;&#32773;&#21482;&#33021;&#20351;&#29992;&#26368;&#21407;&#22987;&#30340;&#26292;&#21147;&#30772;&#35299;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn219&quot;&gt;&#21152;&#20837;salt&#20540;&#24471;hash&#24182;&#19981;&#26159;&#32477;&#23545;&#23433;&#20840;&#30340;&#23384;&#20648;&#23494;&#30721;&#30340;&#26041;&#27861;&#65292;&#28982;&#32780;&#21364;&#26159;&#23433;&#20840;&#21644;&#26041;&#20415;&#20043;&#38388;&#24456;&#22909;&#30340;&#25240;&#34935;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn220&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn220&quot;&gt;&#22788;&#29702;&#27880;&#20876;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn221&quot;&gt;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992;&#36825;&#20123;&#24213;&#23618;&#24037;&#20855;&#26469;&#21019;&#24314;&#20801;&#35768;&#29992;&#25143;&#27880;&#20876;&#30340;&#35270;&#22270;&#12290; &#26368;&#36817;&#27599;&#20010;&#24320;&#21457;&#20154;&#21592;&#37117;&#24076;&#26395;&#23454;&#29616;&#21508;&#33258;&#19981;&#21516;&#30340;&#27880;&#20876;&#26041;&#27861;&#65292;&#25152;&#20197;Django&#25226;&#20889;&#27880;&#20876;&#35270;&#22270;&#30340;&#24037;&#20316;&#30041;&#32473;&#20102;&#20320;&#12290; &#24184;&#36816;&#30340;&#26159;&#65292;&#36825;&#24456;&#23481;&#26131;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn222&quot;&gt;&#20316;&#20026;&#36825;&#20010;&#20107;&#24773;&#30340;&#26368;&#31616;&#21270;&#22788;&#29702;, &#25105;&#20204;&#21487;&#20197;&#25552;&#20379;&#19968;&#20010;&#23567;&#35270;&#22270;, &#25552;&#31034;&#19968;&#20123;&#24517;&#39035;&#30340;&#29992;&#25143;&#20449;&#24687;&#24182;&#21019;&#24314;&#36825;&#20123;&#29992;&#25143;&#12290; Django&#20026;&#27492;&#25552;&#20379;&#20102;&#21487;&#29992;&#30340;&#20869;&#32622;&#34920;&#21333;, &#19979;&#38754;&#36825;&#20010;&#20363;&#23376;&#23601;&#20351;&#29992;&#20102;&#36825;&#20010;&#34920;&#21333;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn224&quot;&gt;from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response

def register(request):
    if request.method == &apos;POST&apos;:
        form = UserCreationForm(request.POST)
        if form.is_valid():
            new_user = form.save()
            return HttpResponseRedirect(&quot;/books/&quot;)
    else:
        form = UserCreationForm()
    return render_to_response(&quot;registration/register.html&quot;, {
        &apos;form&apos;: form,
    })
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn225&quot;&gt;&#36825;&#20010;&#34920;&#21333;&#38656;&#35201;&#19968;&#20010;&#21483; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;registration/register.html&lt;/span&gt;&lt;/tt&gt; &#30340;&#27169;&#26495;&#12290;&#36825;&#20010;&#27169;&#26495;&#21487;&#33021;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn227&quot;&gt;{% extends &quot;base.html&quot; %}

{% block title %}Create an account{% endblock %}

{% block content %}
  &amp;lt;h1&amp;gt;Create an account&amp;lt;/h1&amp;gt;

  &amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;
      {{ form.as_p }}
      &amp;lt;input type=&quot;submit&quot; value=&quot;Create the account&quot;&amp;gt;
  &amp;lt;/form&amp;gt;
{% endblock %}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn228&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn228&quot;&gt;&#22312;&#27169;&#26495;&#20013;&#20351;&#29992;&#35748;&#35777;&#25968;&#25454;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn229&quot;&gt;&#24403;&#21069;&#30331;&#20837;&#30340;&#29992;&#25143;&#20197;&#21450;&#20182;&#65288;&#22905;&#65289;&#30340;&#26435;&#38480;&#21487;&#20197;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#22312;&#27169;&#26495;&#30340;context&#20013;&#20351;&#29992;&#65288;&#35814;&#35265;&#31532;9&#31456;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn230&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn231&quot;&gt;&#20174;&#25216;&#26415;&#19978;&#26469;&#35828;&#65292;&#21482;&#26377;&#24403;&#20320;&#20351;&#29992;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt;&#36825;&#20123;&#21464;&#37327;&#25165;&#21487;&#29992;&#12290; &lt;em&gt;&#24182;&#19988;&lt;/em&gt;TEMPLATE_CONTEXT_PROCESSORS &#35774;&#32622;&#21253;&#21547;&#20102; &#8220;django.core.context_processors.auth&#8221; &#65288;&#40664;&#35748;&#24773;&#20917;&#23601;&#26159;&#22914;&#27492;&#65289;&#26102;&#65292;&#36825;&#20123;&#21464;&#37327;&#25165;&#33021;&#22312;&#27169;&#26495;context&#20013;&#20351;&#29992;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_CONTEXT_PROCESSORS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#21253;&#21547;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;django.core.context_processors.auth&quot;&lt;/span&gt;&lt;/tt&gt; &#65288;&#40664;&#35748;&#24773;&#20917;&#23601;&#26159;&#22914;&#27492;&#65289;&#26102;&#65292;&#36825;&#20123;&#21464;&#37327;&#25165;&#33021;&#22312;&#27169;&#26495;context&#20013;&#20351;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn232&quot;&gt;&#24403;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#26102;, &#24403;&#21069;&#29992;&#25143; (&#26159;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&#25110;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;AnonymousUser&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;) &#23384;&#20648;&#22312;&#27169;&#26495;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#20013;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn234&quot;&gt;{% if user.is_authenticated %}
  &amp;lt;p&amp;gt;Welcome, {{ user.username }}. Thanks for logging in.&amp;lt;/p&amp;gt;
{% else %}
  &amp;lt;p&amp;gt;Welcome, new user. Please log in.&amp;lt;/p&amp;gt;
{% endif %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn235&quot;&gt;&#36825;&#20123;&#29992;&#25143;&#30340;&#26435;&#38480;&#20449;&#24687;&#23384;&#20648;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;perms&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#21464;&#37327;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn236&quot;&gt;&#20320;&#26377;&#20004;&#31181;&#26041;&#24335;&#26469;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;perms&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290; &#20320;&#21487;&#20197;&#20351;&#29992;&#31867;&#20284;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;perms.polls&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#30340;&#24418;&#24335;&#26469;&#26816;&#26597;&#65292;&#23545;&#20110;&#26576;&#20010;&#29305;&#23450;&#30340;&#24212;&#29992;&#65292;&#19968;&#20010;&#29992;&#25143;&#26159;&#21542;&#20855;&#26377; &lt;em&gt;&#20219;&#24847;&lt;/em&gt; &#26435;&#38480;&#65307;&#20320;&#20063;&#21487;&#20197;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;perms.polls.can_vote&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#36825;&#26679;&#30340;&#24418;&#24335;&#65292;&#26469;&#26816;&#26597;&#19968;&#20010;&#29992;&#25143;&#26159;&#21542;&#25317;&#26377;&#29305;&#23450;&#30340;&#26435;&#38480;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn237&quot;&gt;&#36825;&#26679;&#20320;&#23601;&#21487;&#20197;&#22312;&#27169;&#26495;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#35821;&#21477;&#20013;&#26816;&#26597;&#26435;&#38480;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn239&quot;&gt;{% if perms.polls %}
  &amp;lt;p&amp;gt;You have permission to do something in the polls app.&amp;lt;/p&amp;gt;
  {% if perms.polls.can_vote %}
    &amp;lt;p&amp;gt;You can vote!&amp;lt;/p&amp;gt;
  {% endif %}
{% else %}
  &amp;lt;p&amp;gt;You don&apos;t have permission to do anything in the polls app.&amp;lt;/p&amp;gt;
{% endif %}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id15&quot;&gt;
&lt;span id=&quot;cn240&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn240&quot;&gt;&#26435;&#38480;&#12289;&#32452;&#21644;&#28040;&#24687;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn241&quot;&gt;&#22312;&#35748;&#35777;&#26694;&#26550;&#20013;&#36824;&#26377;&#20854;&#20182;&#30340;&#19968;&#20123;&#21151;&#33021;&#12290; &#25105;&#20204;&#20250;&#22312;&#25509;&#19979;&#26469;&#30340;&#20960;&#20010;&#37096;&#20998;&#20013;&#36827;&#19968;&#27493;&#22320;&#20102;&#35299;&#23427;&#20204;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id16&quot;&gt;
&lt;span id=&quot;cn242&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn242&quot;&gt;&#26435;&#38480;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn243&quot;&gt;&#26435;&#38480;&#21487;&#20197;&#24456;&#26041;&#20415;&#22320;&#26631;&#35782;&#29992;&#25143;&#21644;&#29992;&#25143;&#32452;&#21487;&#20197;&#25191;&#34892;&#30340;&#25805;&#20316;&#12290; &#23427;&#20204;&#34987;Django&#30340;admin&#31649;&#29702;&#31449;&#28857;&#25152;&#20351;&#29992;&#65292;&#20320;&#20063;&#21487;&#20197;&#22312;&#20320;&#33258;&#24049;&#30340;&#20195;&#30721;&#20013;&#20351;&#29992;&#23427;&#20204;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn244&quot;&gt;Django&#30340;admin&#31449;&#28857;&#22914;&#19979;&#20351;&#29992;&#26435;&#38480;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn245&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn245&quot;&gt;&#21482;&#26377;&#35774;&#32622;&#20102; &lt;em&gt;add&lt;/em&gt; &#26435;&#38480;&#30340;&#29992;&#25143;&#25165;&#33021;&#20351;&#29992;&#28155;&#21152;&#34920;&#21333;&#65292;&#28155;&#21152;&#23545;&#35937;&#30340;&#35270;&#22270;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn246&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn246&quot;&gt;&#21482;&#26377;&#35774;&#32622;&#20102; &lt;em&gt;change&lt;/em&gt; &#26435;&#38480;&#30340;&#29992;&#25143;&#25165;&#33021;&#20351;&#29992;&#21464;&#26356;&#21015;&#34920;&#65292;&#21464;&#26356;&#34920;&#26684;&#65292;&#21464;&#26356;&#23545;&#35937;&#30340;&#35270;&#22270;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn247&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn247&quot;&gt;&#21482;&#26377;&#35774;&#32622;&#20102; &lt;em&gt;delete&lt;/em&gt; &#26435;&#38480;&#30340;&#29992;&#25143;&#25165;&#33021;&#21024;&#38500;&#19968;&#20010;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn248&quot;&gt;&#26435;&#38480;&#26159;&#26681;&#25454;&#27599;&#19968;&#20010;&#31867;&#22411;&#30340;&#23545;&#35937;&#32780;&#35774;&#32622;&#30340;&#65292;&#24182;&#19981;&#20855;&#20307;&#21040;&#23545;&#35937;&#30340;&#29305;&#23450;&#23454;&#20363;&#12290;
&#20363;&#22914;&#65292;&#25105;&#20204;&#21487;&#20197;&#20801;&#35768;Mary&#25913;&#21464;&#26032;&#25925;&#20107;&#65292;&#20294;&#26159;&#30446;&#21069;&#36824;&#19981;&#20801;&#35768;&#35774;&#32622;Mary&#21482;&#33021;&#25913;&#21464;&#33258;&#24049;&#21019;&#24314;&#30340;&#26032;&#25925;&#20107;&#65292;&#25110;&#32773;&#26681;&#25454;&#32473;&#23450;&#30340;&#29366;&#24577;&#65292;&#20986;&#29256;&#26085;&#26399;&#25110;&#32773;ID&#21495;&#26469;&#36873;&#25321;&#26435;&#38480;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn249&quot;&gt;&#20250;&#33258;&#21160;&#20026;&#27599;&#19968;&#20010;Django&#27169;&#22411;&#21019;&#24314;&#19977;&#20010;&#22522;&#26412;&#26435;&#38480;&#65306;&#22686;&#21152;&#12289;&#25913;&#21464;&#21644;&#21024;&#38500;&#12290; &#24403;&#20320;&#36816;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt;&#21629;&#20196;&#26102;&#65292;&#36825;&#20123;&#26435;&#38480;&#34987;&#28155;&#21152;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;auth_permission&lt;/span&gt;&lt;/tt&gt;&#25968;&#25454;&#24211;&#34920;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn250&quot;&gt;&#26435;&#38480;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;&amp;lt;app&amp;gt;.&amp;lt;action&amp;gt;_&amp;lt;object_name&amp;gt;&quot;&lt;/span&gt;&lt;/tt&gt; &#30340;&#24418;&#24335;&#20986;&#29616;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn251&quot;&gt;&#23601;&#36319;&#29992;&#25143;&#19968;&#26679;&#65292;&#26435;&#38480;&#20063;&#23601;&#26159;Django&#27169;&#22411;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.auth.models&lt;/span&gt;&lt;/tt&gt; &#12290;&#22240;&#27492;&#22914;&#26524;&#20320;&#24895;&#24847;&#65292;&#20320;&#20063;&#21487;&#20197;&#36890;&#36807;Django&#30340;&#25968;&#25454;&#24211;API&#30452;&#25509;&#25805;&#20316;&#26435;&#38480;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id17&quot;&gt;
&lt;span id=&quot;cn252&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn252&quot;&gt;&#32452;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn253&quot;&gt;&#32452;&#25552;&#20379;&#20102;&#19968;&#31181;&#36890;&#29992;&#30340;&#26041;&#24335;&#26469;&#35753;&#20320;&#25353;&#29031;&#19968;&#23450;&#30340;&#26435;&#38480;&#35268;&#21017;&#21644;&#20854;&#20182;&#26631;&#31614;&#23558;&#29992;&#25143;&#20998;&#31867;&#12290; &#19968;&#20010;&#29992;&#25143;&#21487;&#20197;&#38582;&#23646;&#20110;&#20219;&#20309;&#25968;&#37327;&#30340;&#32452;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn254&quot;&gt;&#22312;&#19968;&#20010;&#32452;&#20013;&#30340;&#29992;&#25143;&#33258;&#21160;&#33719;&#24471;&#20102;&#36171;&#20104;&#35813;&#32452;&#30340;&#26435;&#38480;&#12290; &#20363;&#22914;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;editors&lt;/span&gt;&lt;/tt&gt; &#32452;&#25317;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;can_edit_home_page&lt;/span&gt;&lt;/tt&gt; &#26435;&#38480;&#65292;&#20219;&#20309;&#22312;&#35813;&#32452;&#20013;&#30340;&#29992;&#25143;&#37117;&#25317;&#26377;&#36825;&#20010;&#26435;&#38480;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn255&quot;&gt;&#32452;&#20063;&#21487;&#20197;&#36890;&#36807;&#32473;&#23450;&#19968;&#20123;&#29992;&#25143;&#29305;&#27530;&#30340;&#26631;&#35760;&#65292;&#26469;&#25193;&#23637;&#21151;&#33021;&#12290; &#20363;&#22914;&#65292;&#20320;&#21019;&#24314;&#20102;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;Special&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;users&apos;&lt;/span&gt;&lt;/tt&gt; &#32452;&#65292;&#24182;&#19988;&#20801;&#35768;&#32452;&#20013;&#30340;&#29992;&#25143;&#35775;&#38382;&#31449;&#28857;&#30340;&#19968;&#20123;VIP&#37096;&#20998;&#65292;&#25110;&#32773;&#21457;&#36865;VIP&#30340;&#37038;&#20214;&#28040;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn256&quot;&gt;&#21644;&#29992;&#25143;&#31649;&#29702;&#19968;&#26679;&#65292;admin&#25509;&#21475;&#26159;&#31649;&#29702;&#32452;&#30340;&#26368;&#31616;&#21333;&#30340;&#26041;&#27861;&#12290;
&#28982;&#32780;&#65292;&#32452;&#20063;&#23601;&#26159;Django&#27169;&#22411; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.auth.models&lt;/span&gt;&lt;/tt&gt; &#65292;&#22240;&#27492;&#20320;&#21487;&#20197;&#20351;&#29992;Django&#30340;&#25968;&#25454;&#24211;API&#65292;&#22312;&#24213;&#23618;&#35775;&#38382;&#36825;&#20123;&#32452;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id18&quot;&gt;
&lt;span id=&quot;cn257&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn257&quot;&gt;&#28040;&#24687;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn258&quot;&gt;&#28040;&#24687;&#31995;&#32479;&#20250;&#20026;&#32473;&#23450;&#30340;&#29992;&#25143;&#25509;&#25910;&#28040;&#24687;&#12290; &#27599;&#20010;&#28040;&#24687;&#37117;&#21644;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#30456;&#20851;&#32852;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn259&quot;&gt;&#22312;&#27599;&#20010;&#25104;&#21151;&#30340;&#25805;&#20316;&#20197;&#21518;&#65292;Django&#30340;admin&#31649;&#29702;&#25509;&#21475;&#23601;&#20250;&#20351;&#29992;&#28040;&#24687;&#26426;&#21046;&#12290; &#20363;&#22914;&#65292;&#24403;&#20320;&#21019;&#24314;&#20102;&#19968;&#20010;&#23545;&#35937;&#65292;&#20320;&#20250;&#22312;admin&#39029;&#38754;&#30340;&#39030;&#19978;&#30475;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;The&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;was&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;created&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;successfully&lt;/span&gt;&lt;/tt&gt; &#30340;&#28040;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn260&quot;&gt;&#20320;&#20063;&#21487;&#20197;&#20351;&#29992;&#30456;&#21516;&#30340;API&#22312;&#20320;&#33258;&#24049;&#30340;&#24212;&#29992;&#20013;&#25490;&#38431;&#25509;&#25910;&#21644;&#26174;&#31034;&#28040;&#24687;&#12290; API&#38750;&#24120;&#22320;&#31616;&#21333;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn261&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn261&quot;&gt;&#35201;&#21019;&#24314;&#19968;&#26465;&#26032;&#30340;&#28040;&#24687;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user.message_set.create(message=&apos;message_text&apos;)&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn262&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn262&quot;&gt;&#35201;&#33719;&#24471;/&#21024;&#38500;&#28040;&#24687;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user.get_and_delete_messages()&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#20250;&#36820;&#22238;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Message&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#30340;&#21015;&#34920;&#65292;&#24182;&#19988;&#20174;&#38431;&#21015;&#20013;&#21024;&#38500;&#36820;&#22238;&#30340;&#39033;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn263&quot;&gt;&#22312;&#20363;&#23376;&#35270;&#22270;&#20013;&#65292;&#31995;&#32479;&#22312;&#21019;&#24314;&#20102;&#25773;&#25918;&#21333;&#65288;playlist&#65289;&#20197;&#21518;&#65292;&#20026;&#29992;&#25143;&#20445;&#23384;&#20102;&#19968;&#26465;&#28040;&#24687;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn265&quot;&gt;def create_playlist(request, songs):
    # Create the playlist with the given songs.
    # ...
    request.user.message_set.create(
        message=&quot;Your playlist was added successfully.&quot;
    )
    return render_to_response(&quot;playlists/create.html&quot;,
        context_instance=RequestContext(request))
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn266&quot;&gt;&#24403;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#65292;&#24403;&#21069;&#30331;&#24405;&#30340;&#29992;&#25143;&#20197;&#21450;&#20182;&#65288;&#22905;&#65289;&#30340;&#28040;&#24687;&#65292;&#23601;&#20250;&#20197;&#27169;&#26495;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;messages&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#20986;&#29616;&#22312;&#27169;&#26495;&#30340;context&#20013;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn268&quot;&gt;{% if messages %}
&amp;lt;ul&amp;gt;
    {% for message in messages %}
    &amp;lt;li&amp;gt;{{ message }}&amp;lt;/li&amp;gt;
    {% endfor %}
&amp;lt;/ul&amp;gt;
{% endif %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn269&quot;&gt;&#38656;&#35201;&#27880;&#24847;&#30340;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt; &#20250;&#22312;&#21518;&#21488;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_and_delete_messages&lt;/span&gt;&lt;/tt&gt; &#65292;&#22240;&#27492;&#21363;&#20351;&#20320;&#27809;&#26377;&#26174;&#31034;&#23427;&#20204;&#65292;&#23427;&#20204;&#20063;&#20250;&#34987;&#21024;&#38500;&#25481;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn270&quot;&gt;&#26368;&#21518;&#27880;&#24847;&#65292;&#36825;&#20010;&#28040;&#24687;&#26694;&#26550;&#21482;&#33021;&#26381;&#21153;&#20110;&#22312;&#29992;&#25143;&#25968;&#25454;&#24211;&#20013;&#23384;&#22312;&#30340;&#29992;&#25143;&#12290; &#22914;&#26524;&#35201;&#21521;&#21311;&#21517;&#29992;&#25143;&#21457;&#36865;&#28040;&#24687;&#65292;&#35831;&#30452;&#25509;&#20351;&#29992;&#20250;&#35805;&#26694;&#26550;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id19&quot;&gt;
&lt;span id=&quot;cn271&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn271&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn272&quot;&gt;&#26159;&#30340;&#65292;&#20250;&#35805;&#21644;&#35748;&#35777;&#31995;&#32479;&#26377;&#22826;&#22810;&#30340;&#19996;&#35199;&#35201;&#23398;&#12290; &#22823;&#22810;&#25968;&#24773;&#20917;&#19979;&#65292;&#20320;&#24182;&#19981;&#38656;&#35201;&#26412;&#31456;&#25152;&#25552;&#21040;&#30340;&#25152;&#26377;&#21151;&#33021;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn273&quot;&gt;&#22312;` &#19979;&#19968;&#31456; &amp;lt;../chapter15/&amp;gt;`__ &#65292;&#25105;&#20204;&#20250;&#30475;&#19968;&#19979;Django&#30340;&#32531;&#23384;&#26426;&#21046;&#65292;&#36825;&#26159;&#19968;&#20010;&#25552;&#39640;&#20320;&#30340;&#32593;&#39029;&#24212;&#29992;&#24615;&#33021;&#30340;&#20415;&#21033;&#30340;&#21150;&#27861;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    </summary>
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#21313;&#22235;&#31456;&#65306; &#20250;&#35805;&#12289;&#29992;&#25143;&#21644;&#27880;&#20876;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#26159;&#26102;&#20505;&#25215;&#35748;&#20102;&#65306; &#25105;&#20204;&#26377;&#24847;&#30340;&#36991;&#24320;&#20102;Web&#24320;&#21457;&#20013;&#26497;&#20854;&#37325;&#35201;&#30340;&#26041;&#38754;&#12290; &#21040;&#30446;&#21069;&#20026;&#27490;&#65292;&#25105;&#20204;&#37117;&#22312;&#20551;&#23450;&#65292;&#32593;&#31449;&#27969;&#37327;&#26159;&#22823;&#37327;&#30340;&#21311;&#21517;&#29992;&#25143;&#24102;&#26469;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#36825;&#24403;&#28982;&#19981;&#23545;&#12290; &#27983;&#35272;&#22120;&#30340;&#32972;&#21518;&#37117;&#26159;&#27963;&#29983;&#29983;&#30340;&#20154;(&#33267;&#23569;&#26576;&#20123;&#26102;&#20505;&#26159;)&#12290; &#36825;&#24573;&#30053;&#20102;&#37325;&#35201;&#30340;&#19968;&#28857;&#65306; &#20114;&#32852;&#32593;&#26381;&#21153;&#20110;&#20154;&#32780;&#19981;&#26159;&#26426;&#22120;&#12290; &#35201;&#24320;&#21457;&#19968;&#20010;&#30495;&#27491;&#20196;&#20154;&#24515;&#21160;&#30340;&#32593;&#31449;&#65292;&#25105;&#20204;&#24517;&#39035;&#38754;&#23545;&#27983;&#35272;&#22120;&#21518;&#38754;&#27963;&#29983;&#29983;&#30340;&#20154;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#24456;&#19981;&#24184;&#65292;&#36825;&#24182;&#19981;&#23481;&#26131;&#12290; HTTP&#34987;&#35774;&#35745;&#20026;&#8221;&#26080;&#29366;&#24577;&#8221;&#65292;&#27599;&#27425;&#35831;&#27714;&#37117;&#22788;&#20110;&#30456;&#21516;&#30340;&#31354;&#38388;&#20013;&#12290; &#22312;&#19968;&#27425;&#35831;&#27714;&#21644;&#19979;&#19968;&#27425;&#35831;&#27714;&#20043;&#38388;&#27809;&#26377;&#20219;&#20309;&#29366;&#24577;&#20445;&#25345;&#65292;&#25105;&#20204;&#26080;&#27861;&#26681;&#25454;&#35831;&#27714;&#30340;&#20219;&#20309;&#26041;&#38754;(IP&#22320;&#22336;&#65292;&#29992;&#25143;&#20195;&#29702;&#31561;)&#26469;&#35782;&#21035;&#26469;&#33258;&#21516;&#19968;&#20154;&#30340;&#36830;&#32493;&#35831;&#27714;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#22312;&#26412;&#31456;&#20013;&#20320;&#23558;&#23398;&#20250;&#22914;&#20309;&#25630;&#23450;&#29366;&#24577;&#30340;&#38382;&#39064;&#12290; &#22909;&#20102;&#65292;&#25105;&#20204;&#20250;&#20174;&#36739;&#20302;&#30340;&#23618;&#27425;(&lt;em&gt;cookies&lt;/em&gt;)&#24320;&#22987;&#65292;&#28982;&#21518;&#36807;&#28193;&#21040;&#29992;&#39640;&#23618;&#30340;&#24037;&#20855;&#26469;&#25630;&#23450;&#20250;&#35805;&#65292;&#29992;&#25143;&#21644;&#27880;&#20876;&#30340;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;cookies&quot;&gt;
&lt;span id=&quot;cn5&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn5&quot;&gt;Cookies&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&#27983;&#35272;&#22120;&#30340;&#24320;&#21457;&#32773;&#22312;&#24456;&#26089;&#30340;&#26102;&#20505;&#23601;&#24050;&#32463;&#24847;&#35782;&#21040;&#65292; HTTP&#8217;s &#30340;&#26080;&#29366;&#24577;&#20250;&#23545;Web&#24320;&#21457;&#32773;&#24102;&#26469;&#24456;&#22823;&#30340;&#38382;&#39064;&#65292;&#20110;&#26159;(&lt;em&gt;cookies&lt;/em&gt;)&#24212;&#36816;&#32780;&#29983;&#12290; cookies &#26159;&#27983;&#35272;&#22120;&#20026; Web &#26381;&#21153;&#22120;&#23384;&#20648;&#30340;&#19968;&#23567;&#27573;&#20449;&#24687;&#12290; &#27599;&#27425;&#27983;&#35272;&#22120;&#20174;&#26576;&#20010;&#26381;&#21153;&#22120;&#35831;&#27714;&#39029;&#38754;&#26102;&#65292;&#23427;&#21521;&#26381;&#21153;&#22120;&#22238;&#36865;&#20043;&#21069;&#25910;&#21040;&#30340;cookies&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#26469;&#30475;&#30475;&#23427;&#26159;&#24590;&#20040;&#24037;&#20316;&#30340;&#12290; &#24403;&#20320;&#25171;&#24320;&#27983;&#35272;&#22120;&#24182;&#35775;&#38382; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;google.com&lt;/span&gt;&lt;/tt&gt; &#65292;&#20320;&#30340;&#27983;&#35272;&#22120;&#20250;&#32473;Google&#21457;&#36865;&#19968;&#20010;HTTP&#35831;&#27714;&#65292;&#36215;&#22987;&#37096;&#20998;&#23601;&#35937;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn9&quot;&gt;GET / HTTP/1.1
Host: google.com
...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#24403; Google&#21709;&#24212;&#26102;&#65292;HTTP&#30340;&#21709;&#24212;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn12&quot;&gt;HTTP/1.1 200 OK
Content-Type: text/html
Set-Cookie: PREF=ID=5b14f22bdaf1e81c:TM=1167000671:LM=1167000671;
            expires=Sun, 17-Jan-2038 19:14:07 GMT;
            path=/; domain=.google.com
Server: GWS/2.1
...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&#27880;&#24847; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Set-Cookie&lt;/span&gt;&lt;/tt&gt; &#30340;&#22836;&#37096;&#12290; &#20320;&#30340;&#27983;&#35272;&#22120;&#20250;&#23384;&#20648;cookie&#20540;( &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PREF=ID=5b14f22bdaf1e81c:TM=1167000671:LM=1167000671&lt;/span&gt;&lt;/tt&gt; ) &#65292;&#32780;&#19988;&#27599;&#27425;&#35775;&#38382;google &#31449;&#28857;&#37117;&#20250;&#22238;&#36865;&#36825;&#20010;cookie&#20540;&#12290; &#22240;&#27492;&#24403;&#20320;&#19979;&#27425;&#35775;&#38382;Google&#26102;&#65292;&#20320;&#30340;&#27983;&#35272;&#22120;&#20250;&#21457;&#36865;&#20687;&#36825;&#26679;&#30340;&#35831;&#27714;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn15&quot;&gt;GET / HTTP/1.1
Host: google.com
Cookie: PREF=ID=5b14f22bdaf1e81c:TM=1167000671:LM=1167000671
...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#20110;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Cookies&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#20250;&#21578;&#35785;Google&#65292;&#20320;&#23601;&#26159;&#26089;&#20123;&#26102;&#20505;&#35775;&#38382;&#36807;Google&#32593;&#31449;&#30340;&#20154;&#12290; &#36825;&#20010;&#20540;&#21487;&#33021;&#26159;&#25968;&#25454;&#24211;&#20013;&#23384;&#20648;&#29992;&#25143;&#20449;&#24687;&#30340;key&#65292;&#21487;&#20197;&#29992;&#23427;&#22312;&#39029;&#38754;&#19978;&#26174;&#31034;&#20320;&#30340;&#29992;&#25143;&#21517;&#12290; Google&#20250;&#65288;&#20197;&#21450;&#30446;&#21069;&#65289;&#20351;&#29992;&#23427;&#22312;&#32593;&#39029;&#19978;&#26174;&#31034;&#20320;&#36134;&#21495;&#30340;&#29992;&#25143;&#21517;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn17&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#23384;&#21462;Cookies&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#22312;Django&#20013;&#22788;&#29702;&#25345;&#20037;&#21270;&#65292;&#22823;&#37096;&#20998;&#26102;&#20505;&#20320;&#20250;&#26356;&#24895;&#24847;&#29992;&#39640;&#23618;&#20123;&#30340;session &#21644;/&#25110; &#21518;&#38754;&#35201;&#35752;&#35770;&#30340;user &#26694;&#26550;&#12290; &#20294;&#22312;&#27492;&#20043;&#21069;&#65292;&#25105;&#20204;&#38656;&#35201;&#20572;&#19979;&#26469;&#22312;&#24213;&#23618;&#30475;&#30475;&#22914;&#20309;&#35835;&#20889;cookies&#12290; &#36825;&#20250;&#24110;&#21161;&#20320;&#29702;&#35299;&#26412;&#31456;&#33410;&#21518;&#38754;&#35201;&#35752;&#35770;&#30340;&#24037;&#20855;&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#65292;&#32780;&#19988;&#22914;&#26524;&#20320;&#38656;&#35201;&#33258;&#24049;&#25805;&#20316;cookies&#65292;&#36825;&#20063;&#20250;&#26377;&#25152;&#24110;&#21161;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#35835;&#21462;&#24050;&#32463;&#35774;&#32622;&#22909;&#30340;cookies&#26497;&#20854;&#31616;&#21333;&#12290; &#27599;&#19968;&#20010;`` HttpRequest`` &#23545;&#35937;&#37117;&#26377;&#19968;&#20010;`` COOKIES`` &#23545;&#35937;&#65292;&#35813;&#23545;&#35937;&#30340;&#34892;&#20026;&#31867;&#20284;&#19968;&#20010;&#23383;&#20856;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#23427;&#35835;&#21462;&#20219;&#20309;&#27983;&#35272;&#22120;&#21457;&#36865;&#32473;&#35270;&#22270;&#65288;view&#65289;&#30340;cookies&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn21&quot;&gt;def show_color(request):
    if &quot;favorite_color&quot; in request.COOKIES:
        return HttpResponse(&quot;Your favorite color is %s&quot; %             request.COOKIES[&quot;favorite_color&quot;])
    else:
        return HttpResponse(&quot;You don&apos;t have a favorite color.&quot;)
&lt;/pre&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;&#20889;cookies&#31245;&#24494;&#22797;&#26434;&#28857;&#12290; &#20320;&#38656;&#35201;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;set_cookie()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#12290; &#36825;&#20799;&#26377;&#20010;&#22522;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#26469;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;favorite_color&lt;/span&gt;&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p class=&quot;first last cn&quot; id=&quot;cn22&quot;&gt;cookie&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn24&quot;&gt;def set_color(request):
    if &quot;favorite_color&quot; in request.GET:

        # Create an HttpResponse object...
        response = HttpResponse(&quot;Your favorite color is now %s&quot; %             request.GET[&quot;favorite_color&quot;])

        # ... and set a cookie on the response
        response.set_cookie(&quot;favorite_color&quot;,
                            request.GET[&quot;favorite_color&quot;])

        return response

    else:
        return HttpResponse(&quot;You didn&apos;t give a favorite color.&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#20320;&#21487;&#20197;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;response.set_cookie()&lt;/span&gt;&lt;/tt&gt; &#20256;&#36882;&#19968;&#20123;&#21487;&#36873;&#30340;&#21442;&#25968;&#26469;&#25511;&#21046;cookie&#30340;&#34892;&#20026;&#65292;&#35814;&#35265;&#34920;14-1&#12290;&lt;/p&gt;
&lt;div class=&quot;system-message&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: ERROR/3 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 145)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;Error parsing content block for the &#8220;table&#8221; directive: exactly one table expected.&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn26&quot;&gt;.. table:: &#34920; 14-1: Cookie &#36873;&#39033;

   +---------------------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   |&#21442;&#25968;                             |&#32570;&#30465;&#20540;                     |&#25551;&#36848;                                                                                                                                                                                |
   +=================================+===========================+====================================================================================================================================================================================+
   |``max_age``                      |``None``                   |cookie&#38656;&#35201;&#24310;&#32493;&#30340;&#26102;&#38388;&#65288;&#20197;&#31186;&#20026;&#21333;&#20301;&#65289; &#22914;&#26524;&#21442;&#25968;&#26159;\ `` None`` &#65292;&#36825;&#20010;cookie&#20250;&#24310;&#32493;&#21040;&#27983;&#35272;&#22120;&#20851;&#38381;&#20026;&#27490;&#12290;                                                                                       |
   +---------------------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``expires``                      |``None``                   |cookie&#22833;&#25928;&#30340;&#23454;&#38469;&#26085;&#26399;/&#26102;&#38388;&#12290; &#23427;&#30340;&#26684;&#24335;&#24517;&#39035;&#26159;&#65306;\ `` &quot;Wdy, DD-Mth-YY HH:MM:SS GMT&quot;`` &#12290;&#22914;&#26524;&#32473;&#20986;&#20102;&#36825;&#20010;&#21442;&#25968;&#65292;&#23427;&#20250;&#35206;&#30422;\ `` max_age`` &#21442;&#25968;&#12290;                                                |
   +---------------------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``path``                         |``&quot;/&quot;``                    |cookie&#29983;&#25928;&#30340;&#36335;&#24452;&#21069;&#32512;&#12290; &#27983;&#35272;&#22120;&#21482;&#20250;&#25226;cookie&#22238;&#20256;&#32473;&#24102;&#26377;&#35813;&#36335;&#24452;&#30340;&#39029; &#38754;&#65292;&#36825;&#26679;&#20320;&#21487;&#20197;&#36991;&#20813;&#23558;cookie&#20256;&#32473;&#31449;&#28857;&#20013;&#30340;&#20854;&#20182;&#30340;&#24212;&#29992;&#12290;                                                                    |
   |                                 |                           |                                                                                                                                                                                    |
   |                                 |                           |&#24403;&#20320;&#19981;&#26159;&#25511;&#21046;&#20320;&#30340;&#31449;&#28857;&#30340;&#39030;&#23618;&#26102;&#65292;&#36825;&#26679;&#20570;&#26159;&#29305;&#21035;&#26377;&#29992;&#30340;&#12290;                                                                                                                                  |
   +---------------------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``domain``                       |``None``                   |&#36825;&#20010;cookie&#26377;&#25928;&#30340;&#31449;&#28857;&#12290; &#20320;&#21487;&#20197;&#20351;&#29992;&#36825;&#20010;&#21442;&#25968;&#35774;&#32622;&#19968;&#20010;&#36328;&#31449;&#28857;&#65288;cross-domain&#65289;&#30340;cookie&#12290; &#27604;&#22914;&#65292;\ `` domain=&quot;.example.com&quot;`` &#21487;&#20197;&#35774;&#32622;&#19968;&#20010;&#22312;\ `` www.example.com`` &#12289;\ `` www2.example.com`` &#20197;&#21450;\ `` an.other.sub.domain.example.com`` &#31449;&#28857;&#19979;&#37117;&#21487;&#35835;&#21040;&#30340;cookie&#12290;|
   |                                 |                           |                                                                                                                                                                                    |
   |                                 |                           |&#22914;&#26524;&#36825;&#20010;&#21442;&#25968;&#34987;&#35774;&#25104;\ `` None`` &#65292;cookie&#23558;&#21482;&#33021;&#22312;&#35774;&#32622;&#23427;&#30340;&#31449;&#28857;&#19979;&#21487;&#20197;&#35835;&#21040;&#12290;                                                                                                              |
   +---------------------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   |``False``                        |``False``                  |&#22914;&#26524;&#35774;&#32622;&#20026; ``True`` &#65292;&#27983;&#35272;&#22120;&#23558;&#36890;&#36807;HTTPS&#26469;&#22238;&#20256;cookie&#12290;                                                                                                                               |
   +---------------------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn27&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&#22909;&#22351;&#21442;&#21322;&#30340;Cookies&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&#20063;&#35768;&#20320;&#24050;&#32463;&#27880;&#24847;&#21040;&#20102;&#65292;cookies&#30340;&#24037;&#20316;&#26041;&#24335;&#21487;&#33021;&#23548;&#33268;&#30340;&#38382;&#39064;&#12290; &#35753;&#25105;&#20204;&#30475;&#19968;&#19979;&#20854;&#20013;&#19968;&#20123;&#27604;&#36739;&#37325;&#35201;&#30340;&#38382;&#39064;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;cookie&#30340;&#23384;&#20648;&#26159;&#33258;&#24895;&#30340;&#65292;&#19968;&#20010;&#23458;&#25143;&#31471;&#19981;&#19968;&#23450;&#35201;&#21435;&#25509;&#21463;&#25110;&#23384;&#20648;cookie&#12290; &#20107;&#23454;&#19978;&#65292;&#25152;&#26377;&#30340;&#27983;&#35272;&#22120;&#37117;&#35753;&#29992;&#25143;&#33258;&#24049;&#25511;&#21046; &#26159;&#21542;&#25509;&#21463;cookies&#12290; &#22914;&#26524;&#20320;&#24819;&#30693;&#36947;cookies&#23545;&#20110;Web&#24212;&#29992;&#26377;&#22810;&#37325;&#35201;&#65292;&#20320;&#21487;&#20197;&#35797;&#30528;&#25171;&#24320;&#36825;&#20010;&#27983;&#35272;&#22120;&#30340; &#36873;&#39033;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#23613;&#31649;cookies&#24191;&#20026;&#20351;&#29992;&#65292;&#20294;&#20173;&#34987;&#35748;&#20026;&#26159;&#19981;&#21487;&#38752;&#30340;&#30340;&#12290; &#36825;&#24847;&#21619;&#30528;&#65292;&#24320;&#21457;&#32773;&#20351;&#29992;cookies&#20043;&#21069;&#24517;&#39035; &#26816;&#26597;&#29992;&#25143;&#26159;&#21542;&#21487;&#20197;&#25509;&#25910;cookie&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;Cookie(&#29305;&#21035;&#26159;&#37027;&#20123;&#27809;&#36890;&#36807;HTTPS&#20256;&#36755;&#30340;)&#26159;&#38750;&#24120;&#19981;&#23433;&#20840;&#30340;&#12290; &#22240;&#20026;HTTP&#25968;&#25454;&#26159;&#20197;&#26126;&#25991;&#21457;&#36865;&#30340;&#65292;&#25152;&#20197; &#29305;&#21035;&#23481;&#26131;&#21463;&#21040;&#21957;&#25506;&#25915;&#20987;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;&#21957;&#25506;&#25915;&#20987;&#32773;&#21487;&#20197;&#22312;&#32593;&#32476;&#20013;&#25318;&#25130;&#24182;&#35835;&#21462;cookies&#65292;&#22240;&#27492;&#20320;&#35201; &#32477;&#23545;&#36991;&#20813;&#22312;cookies&#20013;&#23384;&#20648;&#25935;&#24863;&#20449;&#24687;&#12290; &#36825;&#23601;&#24847;&#21619;&#30528;&#24744;&#19981;&#24212;&#35813;&#20351;&#29992;cookie&#26469;&#22312;&#23384;&#20648;&#20219;&#20309;&#25935;&#24863;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#36824;&#26377;&#19968;&#31181;&#34987;&#31216;&#20026;&#8221;&#20013;&#38388;&#20154;&#8221;&#30340;&#25915;&#20987;&#26356;&#38452;&#38505;&#65292;&#25915;&#20987;&#32773;&#25318;&#25130;&#19968;&#20010;cookie&#24182;&#23558;&#20854;&#29992;&#20110;&#21478;&#19968;&#20010;&#29992;&#25143;&#12290;
&#31532;19&#31456;&#23558;&#28145;&#20837;&#35752;&#35770;&#36825;&#31181;&#25915;&#20987;&#30340;&#26412;&#36136;&#20197;&#21450;&#22914;&#20309;&#36991;&#20813;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#21363;&#20351;&#20174;&#39044;&#24819;&#20013;&#30340;&#25509;&#25910;&#32773;&#36820;&#22238;&#30340;cookie&#20063;&#26159;&#19981;&#23433;&#20840;&#30340;&#12290; &#22312;&#22823;&#22810;&#25968;&#27983;&#35272;&#22120;&#20013;&#24744;&#21487;&#20197;&#38750;&#24120;&#23481;&#26131;&#22320;&#20462;&#25913;cookies&#20013;&#30340;&#20449;&#24687;&#12290;&#26377;&#32463;&#39564;&#30340;&#29992;&#25143;&#29978;&#33267;&#21487;&#20197;&#36890;&#36807;&#20687;mechanize(&lt;a class=&quot;reference external&quot; href=&quot;http://wwwsearch.sourceforge.net/mechanize/&quot;&gt;http://wwwsearch.sourceforge.net/mechanize/&lt;/a&gt;)
&#36825;&#26679;&#30340;&#24037;&#20855;&#25163;&#24037;&#26500;&#36896;&#19968;&#20010;HTTP&#35831;&#27714;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#22240;&#27492;&#19981;&#33021;&#22312;cookies&#20013;&#23384;&#20648;&#21487;&#33021;&#20250;&#34987;&#31713;&#25913;&#30340;&#25935;&#24863;&#25968;&#25454;&#12290; &#22312;cookies&#20013;&#23384;&#20648; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;IsLoggedIn=1&lt;/span&gt;&lt;/tt&gt; &#65292;&#20197;&#26631;&#35782;&#29992;&#25143;&#24050;&#32463;&#30331;&#24405;&#12290; &#29359;&#36825;&#31867;&#38169;&#35823;&#30340;&#31449;&#28857;&#25968;&#37327;&#22810;&#30340;&#20196;&#20154;&#38590;&#20197;&#32622;&#20449;&#65307; &#32469;&#36807;&#36825;&#20123;&#32593;&#31449;&#30340;&#23433;&#20840;&#31995;&#32479;&#20063;&#26159;&#26131;&#22914;&#21453;&#25484;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django-session&quot;&gt;
&lt;span id=&quot;cn35&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn35&quot;&gt;Django&#30340; Session &#26694;&#26550;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&#30001;&#20110;&#23384;&#22312;&#30340;&#38480;&#21046;&#19982;&#23433;&#20840;&#28431;&#27934;&#65292;cookies&#21644;&#25345;&#32493;&#24615;&#20250;&#35805;&#24050;&#32463;&#25104;&#20026;Web&#24320;&#21457;&#20013;&#20196;&#20154;&#22836;&#30140;&#30340;&#20856;&#33539;&#12290; &#22909;&#28040;&#24687;&#26159;&#65292;Django&#30340;&#30446;&#26631;&#27491;&#26159;&#39640;&#25928;&#30340;&#8220;&#22836;&#30140;&#26432;&#25163;&#8221;&#65292;&#23427;&#33258;&#24102;&#30340;session&#26694;&#26550;&#20250;&#24110;&#20320;&#25630;&#23450;&#36825;&#20123;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#20320;&#21487;&#20197;&#29992;session &#26694;&#26550;&#26469;&#23384;&#21462;&#27599;&#20010;&#35775;&#38382;&#32773;&#20219;&#24847;&#25968;&#25454;&#65292; &#36825;&#20123;&#25968;&#25454;&#22312;&#26381;&#21153;&#22120;&#31471;&#23384;&#20648;&#65292;&#24182;&#23545;cookie&#30340;&#25910;&#21457;&#36827;&#34892;&#20102;&#25277;&#35937;&#12290; Cookies&#21482;&#23384;&#20648;&#25968;&#25454;&#30340;&#21704;&#24076;&#20250;&#35805;ID&#65292;&#32780;&#19981;&#26159;&#25968;&#25454;&#26412;&#36523;&#65292;&#20174;&#32780;&#36991;&#20813;&#20102;&#22823;&#37096;&#20998;&#30340;&#24120;&#35265;cookie&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#19979;&#38754;&#25105;&#20204;&#26469;&#30475;&#30475;&#22914;&#20309;&#25171;&#24320;session&#21151;&#33021;&#65292;&#24182;&#22312;&#35270;&#22270;&#20013;&#20351;&#29992;&#23427;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;sessions&quot;&gt;
&lt;span id=&quot;cn39&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&#25171;&#24320; Sessions&#21151;&#33021;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn40&quot;&gt;Sessions &#21151;&#33021;&#26159;&#36890;&#36807;&#19968;&#20010;&#20013;&#38388;&#20214;(&#21442;&#35265;&#31532;17&#31456;)&#21644;&#19968;&#20010;&#27169;&#22411;(model)&#26469;&#23454;&#29616;&#30340;&#12290; &#35201;&#25171;&#24320;sessions&#21151;&#33021;&#65292;&#38656;&#35201;&#20197;&#19979;&#20960;&#27493;&#25805;&#20316;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn41&quot;&gt;&#32534;&#36753; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#37197;&#32622;&#65292;&#30830;&#20445; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#20013;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.sessions.middleware.SessionMiddleware&apos;&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn42&quot;&gt;&#30830;&#35748; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#20013;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.sessions&apos;&lt;/span&gt;&lt;/tt&gt; (&#22914;&#26524;&#20320;&#26159;&#21018;&#25171;&#24320;&#36825;&#20010;&#24212;&#29992;&#65292;&#21035;&#24536;&#20102;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&#22914;&#26524;&#39033;&#30446;&#26159;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt;&lt;/tt&gt; &#26469;&#21019;&#24314;&#30340;&#65292;&#37197;&#32622;&#25991;&#20214;&#20013;&#37117;&#24050;&#32463;&#23433;&#35013;&#20102;&#36825;&#20123;&#19996;&#35199;&#65292;&#38500;&#38750;&#20320;&#33258;&#24049;&#21024;&#38500;&#65292;&#27491;&#24120;&#24773;&#20917;&#19979;&#65292;&#20320;&#26080;&#38656;&#20219;&#20309;&#35774;&#32622;&#23601;&#21487;&#20197;&#20351;&#29992;session&#21151;&#33021;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#22914;&#26524;&#19981;&#38656;&#35201;session&#21151;&#33021;&#65292;&#20320;&#21487;&#20197;&#21024;&#38500; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SessionMiddleware&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.sessions&apos;&lt;/span&gt;&lt;/tt&gt; &#12290;&#34429;&#28982;&#36825;&#21482;&#20250;&#33410;&#30465;&#24456;&#23569;&#30340;&#24320;&#38144;&#65292;&#20294;&#31215;&#23569;&#25104;&#22810;&#21834;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;session&quot;&gt;
&lt;span id=&quot;cn45&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#22312;&#35270;&#22270;&#20013;&#20351;&#29992;Session&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SessionMiddleware&lt;/span&gt;&lt;/tt&gt; &#28608;&#27963;&#21518;&#65292;&#27599;&#20010;&#20256;&#32473;&#35270;&#22270;(view)&#20989;&#25968;&#30340;&#31532;&#19968;&#20010;&#21442;&#25968;``HttpRequest`` &#23545;&#35937;&#37117;&#26377;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;session&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;&#65292;&#36825;&#26159;&#19968;&#20010;&#23383;&#20856;&#22411;&#30340;&#23545;&#35937;&#12290; &#20320;&#21487;&#20197;&#35937;&#29992;&#26222;&#36890;&#23383;&#20856;&#19968;&#26679;&#26469;&#29992;&#23427;&#12290; &#20363;&#22914;&#65292;&#22312;&#35270;&#22270;(view)&#20013;&#20320;&#21487;&#20197;&#36825;&#26679;&#29992;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn48&quot;&gt;# Set a session value:
request.session[&quot;fav_color&quot;] = &quot;blue&quot;

# Get a session value -- this could be called in a different view,
# or many requests later (or both):
fav_color = request.session[&quot;fav_color&quot;]

# Clear an item from the session:
del request.session[&quot;fav_color&quot;]

# Check if the session has a given key:
if &quot;fav_color&quot; in request.session:
    ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#20854;&#20182;&#30340;&#26144;&#23556;&#26041;&#27861;&#65292;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;keys()&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;items()&lt;/span&gt;&lt;/tt&gt; &#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.session&lt;/span&gt;&lt;/tt&gt; &#21516;&#26679;&#26377;&#25928;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20123;&#26377;&#25928;&#20351;&#29992;Django sessions&#30340;&#31616;&#21333;&#35268;&#21017;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&#29992;&#27491;&#24120;&#30340;&#23383;&#31526;&#20018;&#20316;&#20026;key&#26469;&#35775;&#38382;&#23383;&#20856; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.session&lt;/span&gt;&lt;/tt&gt; &#65292; &#32780;&#19981;&#26159;&#25972;&#25968;&#12289;&#23545;&#35937;&#25110;&#20854;&#23427;&#20160;&#20040;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;Session&#23383;&#20856;&#20013;&#20197;&#19979;&#21010;&#32447;&#24320;&#22836;&#30340;key&#20540;&#26159;Django&#20869;&#37096;&#20445;&#30041;key&#20540;&#12290; &#26694;&#26550;&#21482;&#20250;&#29992;&#24456;&#23569;&#30340;&#20960;&#20010;&#19979;&#21010;&#32447; &#24320;&#22836;&#30340;session&#21464;&#37327;&#65292;&#38500;&#38750;&#20320;&#30693;&#36947;&#20182;&#20204;&#30340;&#20855;&#20307;&#21547;&#20041;&#65292;&#32780;&#19988;&#24895;&#24847;&#36319;&#19978;Django&#30340;&#21464;&#21270;&#65292;&#21542;&#21017;&#65292;&#26368;&#22909; &#19981;&#35201;&#29992;&#36825;&#20123;&#19979;&#21010;&#32447;&#24320;&#22836;&#30340;&#21464;&#37327;&#65292;&#23427;&#20204;&#20250;&#35753;Django&#25605;&#20081;&#20320;&#30340;&#24212;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#27604;&#22914;&#65292;&#19981;&#35201;&#35937;&#36825;&#26679;&#20351;&#29992;`` _fav_color`` &#20250;&#35805;&#23494;&#38053;(session key)&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn55&quot;&gt;request.session[&apos;_fav_color&apos;] = &apos;blue&apos; # Don&apos;t do this!
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#19981;&#35201;&#29992;&#19968;&#20010;&#26032;&#23545;&#35937;&#26469;&#26367;&#25442;&#25481; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.session&lt;/span&gt;&lt;/tt&gt; &#65292;&#20063;&#19981;&#35201;&#23384;&#21462;&#20854;&#23646;&#24615;&#12290; &#21487;&#20197;&#20687;Python&#20013;&#30340;&#23383;&#20856;&#37027;&#26679;&#20351;&#29992;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn58&quot;&gt;request.session = some_other_object # Don&apos;t do this!

request.session.foo = &apos;bar&apos; # Don&apos;t do this!
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#25105;&#20204;&#26469;&#30475;&#20010;&#31616;&#21333;&#30340;&#20363;&#23376;&#12290; &#36825;&#26159;&#20010;&#31616;&#21333;&#21040;&#19981;&#33021;&#20877;&#31616;&#21333;&#30340;&#20363;&#23376;&#65306;&#22312;&#29992;&#25143;&#21457;&#20102;&#19968;&#27425;&#35780;&#35770;&#21518;&#23558;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;has_commented&lt;/span&gt;&lt;/tt&gt;&#35774;&#32622;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt;&#12290; &#36825;&#26159;&#20010;&#31616;&#21333;&#65288;&#20294;&#19981;&#24456;&#23433;&#20840;&#65289;&#30340;&#12289;&#38450;&#27490;&#29992;&#25143;&#22810;&#27425;&#35780;&#35770;&#30340;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn61&quot;&gt;def post_comment(request):
    if request.method != &apos;POST&apos;:
        raise Http404(&apos;Only POSTs are allowed&apos;)

    if &apos;comment&apos; not in request.POST:
        raise Http404(&apos;Comment not submitted&apos;)

    if request.session.get(&apos;has_commented&apos;, False):
        return HttpResponse(&quot;You&apos;ve already commented.&quot;)

    c = comments.Comment(comment=request.POST[&apos;comment&apos;])
    c.save()
    request.session[&apos;has_commented&apos;] = True
    return HttpResponse(&apos;Thanks for your comment!&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20010;&#24456;&#31616;&#21333;&#30340;&#31449;&#28857;&#30331;&#24405;&#35270;&#22270;(view)&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn64&quot;&gt;def login(request):
    if request.method != &apos;POST&apos;:
        raise Http404(&apos;Only POSTs are allowed&apos;)
    try:
        m = Member.objects.get(username=request.POST[&apos;username&apos;])
        if m.password == request.POST[&apos;password&apos;]:
            request.session[&apos;member_id&apos;] = m.id
            return HttpResponseRedirect(&apos;/you-are-logged-in/&apos;)
    except Member.DoesNotExist:
        return HttpResponse(&quot;Your username and password didn&apos;t match.&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#19979;&#38754;&#30340;&#20363;&#23376;&#23558;&#30331;&#20986;&#19968;&#20010;&#22312;&#19978;&#38754;&#24050;&#36890;&#36807;`` login()`` &#30331;&#24405;&#30340;&#29992;&#25143;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn67&quot;&gt;def logout(request):
    try:
        del request.session[&apos;member_id&apos;]
    except KeyError:
        pass
    return HttpResponse(&quot;You&apos;re logged out.&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#22312;&#23454;&#36341;&#20013;&#65292;&#36825;&#26159;&#24456;&#28866;&#30340;&#29992;&#25143;&#30331;&#24405;&#26041;&#24335;&#65292;&#31245;&#21518;&#35752;&#35770;&#30340;&#35748;&#35777;(authentication )&#26694;&#26550;&#20250;&#24110;&#20320;&#20197;&#26356;&#20581;&#22766;&#21644;&#26377;&#21033;&#30340;&#26041;&#24335;&#26469;&#22788;&#29702;&#36825;&#20123;&#38382;&#39064;&#12290; &#36825;&#20123;&#38750;&#24120;&#31616;&#21333;&#30340;&#20363;&#23376;&#21482;&#26159;&#24819;&#35753;&#20320;&#30693;&#36947;&#36825;&#19968;&#20999;&#26159;&#22914;&#20309;&#24037;&#20316;&#30340;&#12290;
&#36825;&#20123;&#23454;&#20363;&#23613;&#37327;&#31616;&#21333;&#65292;&#36825;&#26679;&#20320;&#21487;&#20197;&#26356;&#23481;&#26131;&#30475;&#21040;&#21457;&#29983;&#20102;&#20160;&#20040;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn70&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#35774;&#32622;&#27979;&#35797;Cookies&lt;/h3&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;&#23601;&#20687;&#21069;&#38754;&#25552;&#21040;&#30340;&#65292;&#20320;&#19981;&#33021;&#25351;&#26395;&#25152;&#26377;&#30340;&#27983;&#35272;&#22120;&#37117;&#21487;&#20197;&#25509;&#21463;cookie&#12290; &#22240;&#27492;&#65292;&#20026;&#20102;&#20351;&#29992;&#26041;&#20415;&#65292;Django&#25552;&#20379;&#20102;&#19968;&#20010;&#31616;&#21333;&#30340;&#26041;&#27861;&#26469;&#27979;&#35797;&#29992;&#25143;&#30340;&#27983;&#35272;&#22120;&#26159;&#21542;&#25509;&#21463;cookie&#12290; &#20320;&#21482;&#38656;&#22312;&#35270;&#22270;(view)&#20013;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.session.set_test_cookie()&lt;/span&gt;&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p class=&quot;first last cn&quot; id=&quot;cn71&quot;&gt;&#65292;&#24182;&#22312;&#21518;&#32493;&#30340;&#35270;&#22270;(view)&#12289;&#32780;&#19981;&#26159;&#24403;&#21069;&#30340;&#35270;&#22270;(view)&#20013;&#26816;&#26597; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.session.test_cookie_worked()&lt;/span&gt;&lt;/tt&gt;
&#12290;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&#34429;&#28982;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;set_test_cookie()&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;test_cookie_worked()&lt;/span&gt;&lt;/tt&gt; &#20998;&#24320;&#30340;&#20570;&#27861;&#30475;&#36215;&#26469;&#26377;&#20123;&#31528;&#25305;&#65292;&#20294;&#30001;&#20110;cookie&#30340;&#24037;&#20316;&#26041;&#24335;&#65292;&#36825;&#26080;&#21487;&#36991;&#20813;&#12290; &#24403;&#35774;&#32622;&#19968;&#20010;cookie&#26102;&#20505;&#65292;&#21482;&#33021;&#31561;&#27983;&#35272;&#22120;&#19979;&#27425;&#35775;&#38382;&#30340;&#26102;&#20505;&#65292;&#20320;&#25165;&#33021;&#30693;&#36947;&#27983;&#35272;&#22120;&#26159;&#21542;&#25509;&#21463;cookie&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&#26816;&#26597;cookie&#26159;&#21542;&#21487;&#20197;&#27491;&#24120;&#24037;&#20316;&#21518;&#65292;&#20320;&#24471;&#33258;&#24049;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;delete_test_cookie()&lt;/span&gt;&lt;/tt&gt; &#26469;&#28165;&#38500;&#23427;&#65292;&#36825;&#26159;&#20010;&#22909;&#20064;&#24815;&#12290; &#22312;&#20320;&#35777;&#23454;&#20102;&#27979;&#35797;cookie&#24050;&#24037;&#20316;&#20102;&#20043;&#21518;&#36825;&#26679;&#25805;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#36825;&#26159;&#20010;&#20856;&#22411;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn76&quot;&gt;def login(request):

    # If we submitted the form...
    if request.method == &apos;POST&apos;:

        # Check that the test cookie worked (we set it below):
        if request.session.test_cookie_worked():

            # The test cookie worked, so delete it.
            request.session.delete_test_cookie()

            # In practice, we&apos;d need some logic to check username/password
            # here, but since this is an example...
            return HttpResponse(&quot;You&apos;re logged in.&quot;)

        # The test cookie failed, so display an error message. If this
        # were a real site, we&apos;d want to display a friendlier message.
        else:
            return HttpResponse(&quot;Please enable cookies and try again.&quot;)

    # If we didn&apos;t post, send the test cookie along with the login form.
    request.session.set_test_cookie()
    return render_to_response(&apos;foo/login_form.html&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#20877;&#27425;&#24378;&#35843;&#65292;&#20869;&#32622;&#30340;&#35748;&#35777;&#20989;&#25968;&#20250;&#24110;&#20320;&#20570;&#26816;&#26597;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;view-session&quot;&gt;
&lt;span id=&quot;cn79&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&#22312;&#35270;&#22270;(View)&#22806;&#20351;&#29992;Session&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#20174;&#20869;&#37096;&#26469;&#30475;&#65292;&#27599;&#20010;session&#37117;&#21482;&#26159;&#19968;&#20010;&#26222;&#36890;&#30340;Django model&#65288;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sessions.models&lt;/span&gt;&lt;/tt&gt; &#20013;&#23450;&#20041;)&#12290;&#27599;&#20010;session&#37117;&#30001;&#19968;&#20010;&#38543;&#26426;&#30340;32&#23383;&#33410;&#21704;&#24076;&#20018;&#26469;&#26631;&#35782;&#65292;&#24182;&#23384;&#20648;&#20110;cookie&#20013;&#12290; &#22240;&#20026;&#23427;&#26159;&#19968;&#20010;&#26631;&#20934;&#30340;&#27169;&#22411;&#65292;&#25152;&#20197;&#20320;&#21487;&#20197;&#20351;&#29992;Django&#25968;&#25454;&#24211;API&#26469;&#23384;&#21462;session&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn82&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.contrib.sessions.models import Session
&amp;gt;&amp;gt;&amp;gt; s = Session.objects.get(pk=&apos;2b1189a188b44ad18c35e113ac6ceead&apos;)
&amp;gt;&amp;gt;&amp;gt; s.expire_date
datetime.datetime(2005, 8, 20, 13, 35, 12)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#20320;&#38656;&#35201;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_decoded()&lt;/span&gt;&lt;/tt&gt; &#26469;&#35835;&#21462;&#23454;&#38469;&#30340;session&#25968;&#25454;&#12290; &#36825;&#26159;&#24517;&#38656;&#30340;&#65292;&#22240;&#20026;&#23383;&#20856;&#23384;&#20648;&#20026;&#19968;&#31181;&#29305;&#23450;&#30340;&#32534;&#30721;&#26684;&#24335;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn85&quot;&gt;&amp;gt;&amp;gt;&amp;gt; s.session_data
&apos;KGRwMQpTJ19hdXRoX3VzZXJfaWQnCnAyCkkxCnMuMTExY2ZjODI2Yj...&apos;
&amp;gt;&amp;gt;&amp;gt; s.get_decoded()
{&apos;user_id&apos;: 42}
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn86&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#20309;&#26102;&#20445;&#23384;Session&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#32570;&#30465;&#30340;&#24773;&#20917;&#19979;&#65292;Django&#21482;&#20250;&#22312;session&#21457;&#29983;&#21464;&#21270;&#30340;&#26102;&#20505;&#25165;&#20250;&#23384;&#20837;&#25968;&#25454;&#24211;&#65292;&#27604;&#22914;&#35828;&#65292;&#23383;&#20856;&#36171;&#20540;&#25110;&#21024;&#38500;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn89&quot;&gt;# Session is modified.
request.session[&apos;foo&apos;] = &apos;bar&apos;

# Session is modified.
del request.session[&apos;foo&apos;]

# Session is modified.
request.session[&apos;foo&apos;] = {}

# Gotcha: Session is NOT modified, because this alters
# request.session[&apos;foo&apos;] instead of request.session.
request.session[&apos;foo&apos;][&apos;bar&apos;] = &apos;baz&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn90&quot;&gt;&#20320;&#21487;&#20197;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_SAVE_EVERY_REQUEST&lt;/span&gt;&lt;/tt&gt; &#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#26469;&#25913;&#21464;&#36825;&#19968;&#32570;&#30465;&#34892;&#20026;&#12290;&#22914;&#26524;&#32622;&#20026;True&#30340;&#35805;&#65292;Django&#20250;&#22312;&#27599;&#27425;&#25910;&#21040;&#35831;&#27714;&#30340;&#26102;&#20505;&#20445;&#23384;session&#65292;&#21363;&#20351;&#27809;&#21457;&#29983;&#21464;&#21270;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#27880;&#24847;&#65292;&#20250;&#35805;cookie&#21482;&#20250;&#22312;&#21019;&#24314;&#21644;&#20462;&#25913;&#30340;&#26102;&#20505;&#25165;&#20250;&#36865;&#20986;&#12290; &#20294;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_SAVE_EVERY_REQUEST&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#65292;&#20250;&#35805;cookie&#22312;&#27599;&#27425;&#35831;&#27714;&#30340;&#26102;&#20505;&#37117;&#20250;&#36865;&#20986;&#12290; &#21516;&#26102;&#65292;&#27599;&#27425;&#20250;&#35805;cookie&#36865;&#20986;&#30340;&#26102;&#20505;&#65292;&#20854; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;expires&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#37117;&#20250;&#26356;&#26032;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;vs&quot;&gt;
&lt;span id=&quot;cn92&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#27983;&#35272;&#22120;&#20851;&#38381;&#21363;&#22833;&#25928;&#20250;&#35805; vs &#25345;&#20037;&#20250;&#35805;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&#20320;&#21487;&#33021;&#27880;&#24847;&#21040;&#20102;&#65292;Google&#32473;&#25105;&#20204;&#21457;&#36865;&#30340;cookie&#20013;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;expires=Sun,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;17-Jan-2038&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;19:14:07&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;GMT;&lt;/span&gt;&lt;/tt&gt; cookie&#21487;&#20197;&#26377;&#36807;&#26399;&#26102;&#38388;&#65292;&#36825;&#26679;&#27983;&#35272;&#22120;&#23601;&#30693;&#36947;&#20160;&#20040;&#26102;&#20505;&#21487;&#20197;&#21024;&#38500;cookie&#20102;&#12290; &#22914;&#26524;cookie&#27809;&#26377;&#35774;&#32622;&#36807;&#26399;&#26102;&#38388;&#65292;&#24403;&#29992;&#25143;&#20851;&#38381;&#27983;&#35272;&#22120;&#30340;&#26102;&#20505;&#65292;cookie&#23601;&#33258;&#21160;&#36807;&#26399;&#20102;&#12290; &#20320;&#21487;&#20197;&#25913;&#21464; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_EXPIRE_AT_BROWSER_CLOSE&lt;/span&gt;&lt;/tt&gt; &#30340;&#35774;&#32622;&#26469;&#25511;&#21046;session&#26694;&#26550;&#30340;&#36825;&#19968;&#34892;&#20026;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&#32570;&#30465;&#24773;&#20917;&#19979;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_EXPIRE_AT_BROWSER_CLOSE&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#26679;&#65292;&#20250;&#35805;cookie&#21487;&#20197;&#22312;&#29992;&#25143;&#27983;&#35272;&#22120;&#20013;&#20445;&#25345;&#26377;&#25928;&#36798; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_COOKIE_AGE&lt;/span&gt;&lt;/tt&gt; &#31186;&#65288;&#32570;&#30465;&#35774;&#32622;&#26159;&#20004;&#21608;&#65292;&#21363;1,209,600 &#31186;&#65289;&#12290; &#22914;&#26524;&#20320;&#19981;&#24819;&#29992;&#25143;&#27599;&#27425;&#25171;&#24320;&#27983;&#35272;&#22120;&#37117;&#24517;&#39035;&#37325;&#26032;&#30331;&#38470;&#30340;&#35805;&#65292;&#29992;&#36825;&#20010;&#21442;&#25968;&#26469;&#24110;&#20320;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_EXPIRE_AT_BROWSER_CLOSE&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#65292;&#24403;&#27983;&#35272;&#22120;&#20851;&#38381;&#26102;&#65292;Django&#20250;&#20351;cookie&#22833;&#25928;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn96&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#20854;&#20182;&#30340;Session&#35774;&#32622;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#38500;&#20102;&#19978;&#38754;&#25552;&#21040;&#30340;&#35774;&#32622;&#65292;&#36824;&#26377;&#19968;&#20123;&#20854;&#20182;&#30340;&#35774;&#32622;&#21487;&#20197;&#24433;&#21709;Django session&#26694;&#26550;&#22914;&#20309;&#20351;&#29992;cookie&#65292;&#35814;&#35265;&#34920; 14-2.&lt;/p&gt;
&lt;table class=&quot;cn docutils&quot; id=&quot;cn98&quot;&gt;
&lt;caption&gt;&#34920; 14-2.  &#24433;&#21709;cookie&#34892;&#20026;&#30340;&#35774;&#32622;&lt;/caption&gt;
&lt;colgroup&gt;
&lt;col width=&quot;31%&quot;&gt;
&lt;col width=&quot;50%&quot;&gt;
&lt;col width=&quot;19%&quot;&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&#35774;&#32622;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#25551;&#36848;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#32570;&#30465;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_COOKIE_DOMAIN&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#20351;&#29992;&#20250;&#35805;cookie&#65288;session cookies&#65289;&#30340;&#31449;&#28857;&#12290;
&#23558;&#23427;&#35774;&#25104;&#19968;&#20010;&#23383;&#31526;&#20018;&#65292;&#23601;&#22909;&#35937;`` &#8220;.example.com&#8221;`` &#20197;&#29992;&#20110;&#36328;&#31449;&#28857;&#65288;cross-domain&#65289;&#30340;cookie&#65292;&#25110;`` None`` &#20197;&#29992;&#20110;&#21333;&#20010;&#31449;&#28857;&#12290;&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_COOKIE_NAME&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#20250;&#35805;&#20013;&#20351;&#29992;&#30340;cookie&#30340;&#21517;&#23383;&#12290; &#23427;&#21487;&#20197;&#26159;&#20219;&#24847;&#30340;&#23383;&#31526;&#20018;&#12290;&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;sessionid&quot;&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_COOKIE_SECURE&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#26159;&#21542;&#22312;session&#20013;&#20351;&#29992;&#23433;&#20840;cookie&#12290; &#22914;&#26524;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; , cookie&#23601;&#20250;&#26631;&#35760;&#20026;&#23433;&#20840;&#65292; &#36825;&#24847;&#21619;&#30528;cookie&#21482;&#20250;&#36890;&#36807;HTTPS&#26469;&#20256;&#36755;&#12290;&lt;/td&gt;
&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#25216;&#26415;&#32454;&#33410;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#22914;&#26524;&#20320;&#36824;&#26159;&#22909;&#22855;&#30340;&#35805;&#65292;&#19979;&#38754;&#26159;&#19968;&#20123;&#20851;&#20110;session&#26694;&#26550;&#20869;&#37096;&#24037;&#20316;&#26041;&#24335;&#30340;&#25216;&#26415;&#32454;&#33410;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;session &#23383;&#20856;&#25509;&#21463;&#20219;&#20309;&#25903;&#25345;&#24207;&#21015;&#21270;&#30340;Python&#23545;&#35937;&#12290; &#21442;&#32771;Python&#20869;&#24314;&#27169;&#22359;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pickle&lt;/span&gt;&lt;/tt&gt;&#30340;&#25991;&#26723;&#20197;&#33719;&#21462;&#26356;&#22810;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn102&quot;&gt;Session &#25968;&#25454;&#23384;&#22312;&#25968;&#25454;&#24211;&#34920; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django_session&lt;/span&gt;&lt;/tt&gt; &#20013;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;Session &#25968;&#25454;&#22312;&#38656;&#35201;&#30340;&#26102;&#20505;&#25165;&#20250;&#35835;&#21462;&#12290; &#22914;&#26524;&#20320;&#20174;&#19981;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.session&lt;/span&gt;&lt;/tt&gt; &#65292;
Django&#19981;&#20250;&#21160;&#30456;&#20851;&#25968;&#25454;&#24211;&#34920;&#30340;&#19968;&#26681;&#27611;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn104&quot;&gt;Django &#21482;&#22312;&#38656;&#35201;&#30340;&#26102;&#20505;&#25165;&#36865;&#20986;cookie&#12290; &#22914;&#26524;&#20320;&#21387;&#26681;&#20799;&#23601;&#27809;&#26377;&#35774;&#32622;&#20219;&#20309;&#20250;&#35805;&#25968;&#25454;&#65292;&#23427;&#19981;&#20250; &#36865;&#20986;&#20250;&#35805;cookie(&#38500;&#38750; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_SAVE_EVERY_REQUEST&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; )&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn105&quot;&gt;Django session &#26694;&#26550;&#23436;&#20840;&#32780;&#19988;&#21482;&#33021;&#22522;&#20110;cookie&#12290; &#23427;&#19981;&#20250;&#21518;&#36864;&#21040;&#25226;&#20250;&#35805;ID&#32534;&#30721;&#22312;URL&#20013;&#65288;&#20687;&#26576;&#20123;&#24037;&#20855;(PHP,JSP)&#37027;&#26679;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#36825;&#26159;&#19968;&#20010;&#26377;&#24847;&#32780;&#20026;&#20043;&#30340;&#35774;&#35745;&#12290; &#25226;session&#25918;&#22312;URL&#20013;&#19981;&#21482;&#26159;&#38590;&#30475;&#65292;&#26356;&#37325;&#35201;&#30340;&#26159;&#36825;&#35753;&#20320;&#30340;&#31449;&#28857; &#24456;&#23481;&#26131;&#21463;&#21040;&#25915;&#20987;&#8212;&#8212;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Referer&lt;/span&gt;&lt;/tt&gt; header&#36827;&#34892;session ID&#8221;&#31363;&#21548;&#8221;&#32780;&#23454;&#26045;&#30340;&#25915;&#20987;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#22914;&#26524;&#20320;&#36824;&#26159;&#22909;&#22855;&#65292;&#38405;&#35835;&#28304;&#20195;&#30721;&#26159;&#26368;&#30452;&#25509;&#21150;&#27861;&#65292;&#35814;&#35265; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sessions&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;authentication&quot;&gt;
&lt;span id=&quot;cn108&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&#29992;&#25143;&#19982;Authentication&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&#36890;&#36807;session&#65292;&#25105;&#20204;&#21487;&#20197;&#22312;&#22810;&#27425;&#27983;&#35272;&#22120;&#35831;&#27714;&#20013;&#20445;&#25345;&#25968;&#25454;&#65292; &#25509;&#19979;&#26469;&#30340;&#37096;&#20998;&#23601;&#26159;&#29992;session&#26469;&#22788;&#29702;&#29992;&#25143;&#30331;&#24405;&#20102;&#12290; &#24403;&#28982;&#65292;&#19981;&#33021;&#20165;&#20973;&#29992;&#25143;&#30340;&#19968;&#38754;&#20043;&#35789;&#65292;&#25105;&#20204;&#23601;&#30456;&#20449;&#65292;&#25152;&#20197;&#25105;&#20204;&#38656;&#35201;&#35748;&#35777;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&#24403;&#28982;&#20102;&#65292;Django &#20063;&#25552;&#20379;&#20102;&#24037;&#20855;&#26469;&#22788;&#29702;&#36825;&#26679;&#30340;&#24120;&#35265;&#20219;&#21153;&#65288;&#23601;&#20687;&#20854;&#20182;&#24120;&#35265;&#20219;&#21153;&#19968;&#26679;&#65289;&#12290;
Django &#29992;&#25143;&#35748;&#35777;&#31995;&#32479;&#22788;&#29702;&#29992;&#25143;&#24080;&#21495;&#65292;&#32452;&#65292;&#26435;&#38480;&#20197;&#21450;&#22522;&#20110;cookie&#30340;&#29992;&#25143;&#20250;&#35805;&#12290; &#36825;&#20010;&#31995;&#32479;&#19968;&#33324;&#34987;&#31216;&#20026; &lt;em&gt;auth/auth&lt;/em&gt; (&#35748;&#35777;&#19982;&#25480;&#26435;)&#31995;&#32479;&#12290; &#36825;&#20010;&#31995;&#32479;&#30340;&#21517;&#31216;&#21516;&#26102;&#20063;&#34920;&#26126;&#20102;&#29992;&#25143;&#24120;&#35265;&#30340;&#20004;&#27493;&#22788;&#29702;&#12290; &#25105;&#20204;&#38656;&#35201;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn111&quot;&gt;&#39564;&#35777; (&lt;em&gt;&#35748;&#35777;&lt;/em&gt;) &#29992;&#25143;&#26159;&#21542;&#26159;&#20182;&#25152;&#23459;&#31216;&#30340;&#29992;&#25143;(&#19968;&#33324;&#36890;&#36807;&#26597;&#35810;&#25968;&#25454;&#24211;&#39564;&#35777;&#20854;&#29992;&#25143;&#21517;&#21644;&#23494;&#30721;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn112&quot;&gt;&#39564;&#35777;&#29992;&#25143;&#26159;&#21542;&#25317;&#26377;&#25191;&#34892;&#26576;&#31181;&#25805;&#20316;&#30340; &lt;em&gt;&#25480;&#26435;&lt;/em&gt; (&#36890;&#24120;&#20250;&#36890;&#36807;&#26816;&#26597;&#19968;&#20010;&#26435;&#38480;&#34920;&#26469;&#30830;&#35748;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#26681;&#25454;&#36825;&#20123;&#38656;&#27714;&#65292;Django &#35748;&#35777;/&#25480;&#26435; &#31995;&#32479;&#20250;&#21253;&#21547;&#20197;&#19979;&#30340;&#37096;&#20998;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn114&quot;&gt;&lt;em&gt;&#29992;&#25143;&lt;/em&gt; : &#22312;&#32593;&#31449;&#27880;&#20876;&#30340;&#20154;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn115&quot;&gt;&lt;em&gt;&#26435;&#38480;&lt;/em&gt; : &#29992;&#20110;&#26631;&#35782;&#29992;&#25143;&#26159;&#21542;&#21487;&#20197;&#25191;&#34892;&#26576;&#31181;&#25805;&#20316;&#30340;&#20108;&#36827;&#21046;(yes/no)&#26631;&#24535;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn116&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn116&quot;&gt;&lt;em&gt;&#32452;&lt;/em&gt; :&#19968;&#31181;&#21487;&#20197;&#23558;&#26631;&#35760;&#21644;&#26435;&#38480;&#24212;&#29992;&#20110;&#22810;&#20010;&#29992;&#25143;&#30340;&#24120;&#29992;&#26041;&#27861;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn117&quot;&gt;&lt;em&gt;Messages&lt;/em&gt; : &#21521;&#29992;&#25143;&#26174;&#31034;&#38431;&#21015;&#24335;&#30340;&#31995;&#32479;&#28040;&#24687;&#30340;&#24120;&#29992;&#26041;&#27861;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&#22914;&#26524;&#20320;&#24050;&#32463;&#29992;&#20102;admin&#24037;&#20855;(&#35814;&#35265;&#31532;6&#31456;)&#65292;&#23601;&#20250;&#30475;&#35265;&#36825;&#20123;&#24037;&#20855;&#30340;&#22823;&#37096;&#20998;&#12290;&#22914;&#26524;&#20320;&#22312;admin&#24037;&#20855;&#20013;&#32534;&#36753;&#36807;&#29992;&#25143;&#25110;&#32452;&#65292;&#37027;&#20040;&#23454;&#38469;&#19978;&#20320;&#24050;&#32463;&#32534;&#36753;&#36807;&#25480;&#26435;&#31995;&#32479;&#30340;&#25968;&#25454;&#24211;&#34920;&#20102;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn119&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#25171;&#24320;&#35748;&#35777;&#25903;&#25345;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn120&quot;&gt;&#20687;session&#24037;&#20855;&#19968;&#26679;&#65292;&#35748;&#35777;&#25903;&#25345;&#20063;&#26159;&#19968;&#20010;Django&#24212;&#29992;&#65292;&#25918;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt; &#20013;&#65292;&#25152;&#20197;&#20063;&#38656;&#35201;&#23433;&#35013;&#12290; &#19982;session&#31995;&#32479;&#30456;&#20284;&#65292;&#23427;&#20063;&#26159;&#32570;&#30465;&#23433;&#35013;&#30340;&#65292;&#20294;&#22914;&#26524;&#23427;&#24050;&#32463;&#34987;&#21024;&#38500;&#20102;&#65292;&#36890;&#36807;&#20197;&#19979;&#27493;&#39588;&#20063;&#33021;&#37325;&#26032;&#23433;&#35013;&#19978;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn121&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn121&quot;&gt;&#26681;&#25454;&#26412;&#31456;&#26089;&#21069;&#30340;&#37096;&#20998;&#30830;&#35748;&#24050;&#32463;&#23433;&#35013;&#20102;session &#26694;&#26550;&#12290; &#38656;&#35201;&#30830;&#35748;&#29992;&#25143;&#20351;&#29992;cookie&#65292;&#36825;&#26679;sesson &#26694;&#26550;&#25165;&#33021;&#27491;&#24120;&#20351;&#29992;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn122&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn122&quot;&gt;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.auth&apos;&lt;/span&gt;&lt;/tt&gt; &#25918;&#22312;&#20320;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#65292;&#28982;&#21518;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt;&#20197;&#21019;&#24314;&#23545;&#24212;&#30340;&#25968;&#25454;&#24211;&#34920;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn123&quot;&gt;&#30830;&#35748; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SessionMiddleware&lt;/span&gt;&lt;/tt&gt; &#21518;&#38754;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.auth.middleware.AuthenticationMiddleware&apos;&lt;/span&gt;&lt;/tt&gt; SessionMiddleware&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#36825;&#26679;&#23433;&#35013;&#21518;&#65292;&#25105;&#20204;&#23601;&#21487;&#20197;&#22312;&#35270;&#22270;(view)&#30340;&#20989;&#25968;&#20013;&#22788;&#29702;user&#20102;&#12290; &#22312;&#35270;&#22270;&#20013;&#23384;&#21462;users&#65292;&#20027;&#35201;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.user&lt;/span&gt;&lt;/tt&gt; &#65307;&#36825;&#20010;&#23545;&#35937;&#34920;&#31034;&#24403;&#21069;&#24050;&#30331;&#24405;&#30340;&#29992;&#25143;&#12290;
&#22914;&#26524;&#29992;&#25143;&#36824;&#27809;&#30331;&#24405;&#65292;&#36825;&#23601;&#26159;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;AnonymousUser&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;(&#32454;&#33410;&#35265;&#19979;)&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#20320;&#21487;&#20197;&#24456;&#23481;&#26131;&#22320;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;is_authenticated()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#26469;&#21028;&#26029;&#19968;&#20010;&#29992;&#25143;&#26159;&#21542;&#24050;&#32463;&#30331;&#24405;&#20102;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn127&quot;&gt;if request.user.is_authenticated():
    # Do something for authenticated users.
else:
    # Do something for anonymous users.
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;user&quot;&gt;
&lt;span id=&quot;cn128&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#20351;&#29992;User&#23545;&#35937;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&#19968;&#33324;&#20174; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.user&lt;/span&gt;&lt;/tt&gt; &#65292;&#25110;&#26159;&#20854;&#20182;&#19979;&#38754;&#21363;&#23558;&#35201;&#35752;&#35770;&#21040;&#30340;&#26041;&#27861;&#21462;&#24471;&#65292;&#23427;&#26377;&#24456;&#22810;&#23646;&#24615;&#21644;&#26041;&#27861;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;AnonymousUser&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#27169;&#25311;&#20102; &lt;em&gt;&#37096;&#20998;&lt;/em&gt; &#30340;&#25509;&#21475;&#65292;&#20294;&#19981;&#26159;&#20840;&#37096;&#65292;&#22312;&#25226;&#23427;&#24403;&#25104;&#30495;&#27491;&#30340;user&#23545;&#35937; &#20351;&#29992;&#21069;&#65292;&#20320;&#24471;&#26816;&#26597;&#19968;&#19979; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user.is_authenticated()&lt;/span&gt;&lt;/tt&gt; &#34920;14-3&#21644;14-4&#20998;&#21035;&#21015;&#20986;&#20102;`` User`` &#23545;&#35937;&#20013;&#30340;&#23646;&#24615;&#65288;fields)&#21644;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;table class=&quot;cn docutils&quot; id=&quot;cn130&quot;&gt;
&lt;caption&gt;&#34920; 14-3.  &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#23646;&#24615;&lt;/caption&gt;
&lt;colgroup&gt;
&lt;col width=&quot;20%&quot;&gt;
&lt;col width=&quot;80%&quot;&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&#23646;&#24615;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#25551;&#36848;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;username&lt;/td&gt;
&lt;td&gt;&#24517;&#38656;&#30340;&#65292;&#19981;&#33021;&#22810;&#20110;30&#20010;&#23383;&#31526;&#12290; &#20165;&#29992;&#23383;&#27597;&#25968;&#23383;&#24335;&#23383;&#31526;&#65288;&#23383;&#27597;&#12289;&#25968;&#23383;&#21644;&#19979;&#21010;&#32447;&#65289;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;first_name&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#21487;&#36873;; &#23569;&#20110;&#31561;&#20110;30&#23383;&#31526;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;last_name&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#21487;&#36873;; &#23569;&#20110;&#31561;&#20110;30&#23383;&#31526;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;email&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#21487;&#36873;&#12290; &#37038;&#20214;&#22320;&#22336;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;password&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#24517;&#38656;&#30340;&#12290; &#23494;&#30721;&#30340;&#21704;&#24076;&#20540;&#65288;Django&#19981;&#20648;&#23384;&#21407;&#22987;&#23494;&#30721;&#65289;&#12290; See the Passwords section for
more about this value.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;is_staff&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#24067;&#23572;&#20540;&#12290; &#29992;&#25143;&#26159;&#21542;&#25317;&#26377;&#32593;&#31449;&#30340;&#31649;&#29702;&#26435;&#38480;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;is_active&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#24067;&#23572;&#20540;. &#35774;&#32622;&#35813;&#36134;&#25143;&#26159;&#21542;&#21487;&#20197;&#30331;&#24405;&#12290;
&#25226;&#35813;&#26631;&#24535;&#20301;&#32622;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt;&#32780;&#19981;&#26159;&#30452;&#25509;&#21024;&#38500;&#36134;&#25143;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;is_superuser&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#24067;&#23572;&#20540; &#26631;&#35782;&#29992;&#25143;&#26159;&#21542;&#25317;&#26377;&#25152;&#26377;&#26435;&#38480;&#65292;&#26080;&#38656;&#26174;&#24335;&#22320;&#26435;&#38480;&#20998;&#37197;&#23450;&#20041;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;last_login&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#29992;&#25143;&#19978;&#27425;&#30331;&#24405;&#30340;&#26102;&#38388;&#26085;&#26399;&#12290; &#23427;&#34987;&#40664;&#35748;&#35774;&#32622;&#20026;&#24403;&#21069;&#30340;&#26085;&#26399;/&#26102;&#38388;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;date_joined&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#36134;&#21495;&#34987;&#21019;&#24314;&#30340;&#26085;&#26399;&#26102;&#38388; &#24403;&#36134;&#21495;&#34987;&#21019;&#24314;&#26102;&#65292;&#23427;&#34987;&#40664;&#35748;&#35774;&#32622;&#20026;&#24403;&#21069;&#30340;&#26085;&#26399;/&#26102;&#38388;&#12290;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div class=&quot;system-message&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: ERROR/3 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 735)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;Error parsing content block for the &#8220;table&#8221; directive: exactly one table expected.&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn131&quot;&gt;.. table:: &#34920; 14-4. ``User`` &#23545;&#35937;&#26041;&#27861;

    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter15</id>
        <title type="html">chapter15</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter15"/>
        <published>2015-02-26T23:07:34+08:00</published>
        <updated>2015-02-26T23:07:34+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#21313;&#20116;&#31456;&#65306; &#32531;&#23384;&#26426;&#21046;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#21160;&#24577;&#32593;&#31449;&#30340;&#38382;&#39064;&#23601;&#22312;&#20110;&#23427;&#26159;&#21160;&#24577;&#30340;&#12290; &#20063;&#23601;&#26159;&#35828;&#27599;&#27425;&#29992;&#25143;&#35775;&#38382;&#19968;&#20010;&#39029;&#38754;&#65292;&#26381;&#21153;&#22120;&#35201;&#25191;&#34892;&#25968;&#25454;&#24211;&#26597;&#35810;&#65292;&#21551;&#21160;&#27169;&#26495;&#65292;&#25191;&#34892;&#19994;&#21153;&#36923;&#36753;&#20197;&#21450;&#26368;&#32456;&#29983;&#25104;&#19968;&#20010;&#20320;&#25152;&#30475;&#21040;&#30340;&#32593;&#39029;&#65292;&#36825;&#19968;&#20999;&#37117;&#26159;&#21160;&#24577;&#21363;&#26102;&#29983;&#25104;&#30340;&#12290;
&#20174;&#22788;&#29702;&#22120;&#36164;&#28304;&#30340;&#35282;&#24230;&#26469;&#30475;&#65292;&#36825;&#26159;&#27604;&#36739;&#26114;&#36149;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#23545;&#20110;&#22823;&#22810;&#25968;&#32593;&#32476;&#24212;&#29992;&#26469;&#35828;&#65292;&#36807;&#36733;&#24182;&#19981;&#26159;&#22823;&#38382;&#39064;&#12290; &#22240;&#20026;&#22823;&#22810;&#25968;&#32593;&#32476;&#24212;&#29992;&#24182;&#19981;&#26159;washingtonpost.com&#25110;Slashdot&#65307;&#23427;&#20204;&#36890;&#24120;&#26159;&#24456;&#23567;&#24456;&#31616;&#21333;&#65292;&#25110;&#32773;&#26159;&#20013;&#31561;&#35268;&#27169;&#30340;&#31449;&#28857;&#65292;&#21482;&#26377;&#24456;&#23569;&#30340;&#27969;&#37327;&#12290; &#20294;&#26159;&#23545;&#20110;&#20013;&#31561;&#33267;&#22823;&#35268;&#27169;&#27969;&#37327;&#30340;&#31449;&#28857;&#26469;&#35828;&#65292;&#23613;&#21487;&#33021;&#22320;&#35299;&#20915;&#36807;&#36733;&#38382;&#39064;&#26159;&#38750;&#24120;&#24517;&#35201;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#36825;&#23601;&#38656;&#35201;&#29992;&#21040;&#32531;&#23384;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#32531;&#23384;&#30340;&#30446;&#30340;&#26159;&#20026;&#20102;&#36991;&#20813;&#37325;&#22797;&#35745;&#31639;&#65292;&#29305;&#21035;&#26159;&#23545;&#19968;&#20123;&#27604;&#36739;&#32791;&#26102;&#38388;&#12289;&#36164;&#28304;&#30340;&#35745;&#31639;&#12290; &#19979;&#38754;&#30340;&#20266;&#20195;&#30721;&#28436;&#31034;&#20102;&#22914;&#20309;&#23545;&#21160;&#24577;&#39029;&#38754;&#30340;&#32467;&#26524;&#36827;&#34892;&#32531;&#23384;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn6&quot;&gt;given a URL, try finding that page in the cache
if the page is in the cache:
    return the cached page
else:
    generate the page
    save the generated page in the cache (for next time)
    return the generated page
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#20026;&#27492;&#65292;Django&#25552;&#20379;&#20102;&#19968;&#20010;&#31283;&#23450;&#30340;&#32531;&#23384;&#31995;&#32479;&#35753;&#20320;&#32531;&#23384;&#21160;&#24577;&#39029;&#38754;&#30340;&#32467;&#26524;&#65292;&#36825;&#26679;&#22312;&#25509;&#19979;&#26469;&#26377;&#30456;&#21516;&#30340;&#35831;&#27714;&#23601;&#21487;&#20197;&#30452;&#25509;&#20351;&#29992;&#32531;&#23384;&#20013;&#30340;&#25968;&#25454;&#65292;&#36991;&#20813;&#19981;&#24517;&#35201;&#30340;&#37325;&#22797;&#35745;&#31639;&#12290; &#21478;&#22806;Django&#36824;&#25552;&#20379;&#20102;&#19981;&#21516;&#31890;&#24230;&#25968;&#25454;&#30340;&#32531;&#23384;&#65292;&#20363;&#22914;&#65306; &#20320;&#21487;&#20197;&#32531;&#23384;&#25972;&#20010;&#39029;&#38754;&#65292;&#20063;&#21487;&#20197;&#32531;&#23384;&#26576;&#20010;&#37096;&#20998;&#65292;&#29978;&#33267;&#32531;&#23384;&#25972;&#20010;&#32593;&#31449;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;Django&#20063;&#21644;&#8221;&#19978;&#28216;&#8221;&#32531;&#23384;&#24037;&#20316;&#30340;&#24456;&#22909;&#65292;&#20363;&#22914;Squid(&lt;a class=&quot;reference external&quot; href=&quot;http://www.squid-cache.org/&quot;&gt;http://www.squid-cache.org&lt;/a&gt;)&#21644;&#22522;&#20110;&#27983;&#35272;&#22120;&#30340;&#32531;&#23384;&#12290; &#36825;&#20123;&#31867;&#22411;&#30340;&#32531;&#23384;&#20320;&#19981;&#30452;&#25509;&#25511;&#21046;&#65292;&#20294;&#26159;&#20320;&#21487;&#20197;&#25552;&#20379;&#20851;&#20110;&#20320;&#30340;&#31449;&#28857;&#21738;&#37096;&#20998;&#24212;&#35813;&#34987;&#32531;&#23384;&#21644;&#24590;&#26679;&#32531;&#23384;&#30340;&#32447;&#32034;(&#36890;&#36807;HTTP&#22836;&#37096;)&#32473;&#23427;&#20204;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn9&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#35774;&#23450;&#32531;&#23384;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#32531;&#23384;&#31995;&#32479;&#38656;&#35201;&#19968;&#20123;&#23569;&#37327;&#30340;&#35774;&#23450;&#24037;&#20316;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;&#20320;&#24517;&#39035;&#21578;&#35785;&#23427;&#32531;&#23384;&#30340;&#25968;&#25454;&#24212;&#35813;&#25918;&#22312;&#21738;&#37324;&#65292;&#22312;&#25968;&#25454;&#24211;&#20013;&#65292;&#22312;&#25991;&#20214;&#31995;&#32479;&#65292;&#25110;&#30452;&#25509;&#22312;&#20869;&#23384;&#20013;&#12290;
&#36825;&#26159;&#19968;&#20010;&#37325;&#35201;&#30340;&#20915;&#23450;&#65292;&#24433;&#21709;&#24744;&#30340;&#39640;&#36895;&#32531;&#23384;&#30340;&#24615;&#33021;&#65292;&#26159;&#30340;&#65292;&#26377;&#20123;&#31867;&#22411;&#30340;&#32531;&#23384;&#27604;&#20854;&#23427;&#31867;&#22411;&#24555;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#32531;&#23384;&#35774;&#32622;&#22312;settings&#25991;&#20214;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CACHE_BACKEND&lt;/span&gt;&lt;/tt&gt;&#20013;&#12290; &#36825;&#37324;&#26159;&#19968;&#20010;CACHE_BACKEND&#25152;&#26377;&#21487;&#29992;&#20540;&#30340;&#35299;&#37322;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn12&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&#20869;&#23384;&#32531;&#20914;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn13&quot;&gt;Memcached&#26159;&#36804;&#20170;&#20026;&#27490;&#21487;&#29992;&#20110;Django&#30340;&#26368;&#24555;&#65292;&#26368;&#26377;&#25928;&#30340;&#32531;&#23384;&#31867;&#22411;&#65292;Memcached&#26159;&#23436;&#20840;&#22522;&#20110;&#20869;&#23384;&#30340;&#32531;&#23384;&#26694;&#26550;&#65292;&#26368;&#21021;&#24320;&#21457;&#23427;&#26159;&#29992;&#20197;&#22788;&#29702;&#39640;&#36127;&#33655;&#30340;LiveJournal.com&#38543;&#21518;&#30001;Danga Interactive&#20844;&#21496;&#24320;&#28304;&#12290; &#23427;&#34987;&#29992;&#20110;&#19968;&#20123;&#31449;&#28857;&#65292;&#20363;&#22914;Facebook&#21644;&#32500;&#22522;&#30334;&#31185;&#32593;&#31449;&#65292;&#20197;&#20943;&#23569;&#25968;&#25454;&#24211;&#35775;&#38382;&#65292;&#24182;&#22823;&#24133;&#25552;&#39640;&#31449;&#28857;&#30340;&#24615;&#33021;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;Memcached&#26159;&#20813;&#36153;&#30340;&#65288;http://danga.com/memcached&#65289;&#12290;&#23427;&#20316;&#20026;&#19968;&#20010;&#23432;&#25252;&#36827;&#31243;&#36816;&#34892;&#65292;&#24182;&#20998;&#37197;&#20102;&#29305;&#23450;&#25968;&#37327;&#30340;&#20869;&#23384;&#12290; &#23427;&#21482;&#26159;&#25552;&#20379;&#20102;&#28155;&#21152;&#65292;&#26816;&#32034;&#21644;&#21024;&#38500;&#32531;&#23384;&#20013;&#30340;&#20219;&#24847;&#25968;&#25454;&#30340;&#39640;&#36895;&#25509;&#21475;&#12290; &#25152;&#26377;&#25968;&#25454;&#37117;&#30452;&#25509;&#23384;&#20648;&#22312;&#20869;&#23384;&#20013;&#65292;&#25152;&#20197;&#27809;&#26377;&#23545;&#20351;&#29992;&#30340;&#25968;&#25454;&#24211;&#25110;&#25991;&#20214;&#31995;&#32479;&#30340;&#24320;&#38144;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#22312;&#23433;&#35013;&#20102;Memcached&#26412;&#36523;&#20043;&#21518;&#65292;&#20320;&#23558;&#38656;&#35201;&#23433;&#35013;Memcached Python&#32465;&#23450;&#65292;&#23427;&#27809;&#26377;&#30452;&#25509;&#21644;Django&#32465;&#23450;&#12290; &#36825;&#20004;&#20010;&#21487;&#29992;&#29256;&#26412;&#12290; &#36873;&#25321;&#21644;&#23433;&#35013;&#20197;&#19979;&#27169;&#22359;&#20043;&#19968;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn16&quot;&gt;&#26368;&#24555;&#30340;&#21487;&#29992;&#36873;&#39033;&#26159;&#19968;&#20010;&#27169;&#22359;&#65292;&#31216;&#20026;cmemcache&#65292;&#22312;http://gijsbert.org/cmemcache&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn17&quot;&gt;&#22914;&#26524;&#24744;&#26080;&#27861;&#23433;&#35013;cmemcache&#65292;&#24744;&#21487;&#20197;&#23433;&#35013;python - Memcached&#65292;&#22312;ftp://ftp.tummy.com/pub/python-memcached/&#12290;&#22914;&#26524;&#35813;&#32593;&#22336;&#24050;&#19981;&#20877;&#26377;&#25928;&#65292;&#21482;&#35201;&#21040;Memcached&#30340;&#32593;&#31449;http://www.danga.com/memcached/&#65289;&#65292;&#24182;&#20174;&#23458;&#25143;&#31471;API&#23436;&#25104;Python&#32465;&#23450;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#33509;&#35201;&#20351;&#29992;Memcached&#30340;Django&#65292;&#35774;&#32622;CACHE_BACKEND&#21040;memcached&#65306;/ / IP&#65306;port/&#65292;&#20854;&#20013;IP&#26159;Memcached&#30340;&#23432;&#25252;&#36827;&#31243;&#30340;IP&#22320;&#22336;&#65292;port&#26159;Memcached&#36816;&#34892;&#30340;&#31471;&#21475;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;Memcached&#36816;&#34892;&#22312;&#26412;&#22320;&#20027;&#26426; (127.0.0.1)&#19978;,&#31471;&#21475;&#20026;11211&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn21&quot;&gt;CACHE_BACKEND = &apos;memcached://127.0.0.1:11211/&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;Memcached&#30340;&#19968;&#20010;&#26497;&#22909;&#30340;&#29305;&#24615;&#26159;&#23427;&#22312;&#22810;&#20010;&#26381;&#21153;&#22120;&#38388;&#20998;&#20139;&#32531;&#23384;&#30340;&#33021;&#21147;&#12290;
&#36825;&#24847;&#21619;&#30528;&#24744;&#21487;&#20197;&#22312;&#22810;&#21488;&#26426;&#22120;&#19978;&#36816;&#34892;Memcached&#30340;&#23432;&#25252;&#36827;&#31243;&#65292;&#35813;&#31243;&#24207;&#20250;&#25226;&#36825;&#20123;&#26426;&#22120;&#24403;&#25104;&#19968;&#20010;&#21333;&#19968;&#32531;&#23384;&#65292;&#32780;&#26080;&#38656;&#37325;&#22797;&#27599;&#21488;&#26426;&#22120;&#19978;&#30340;&#32531;&#23384;&#20540;&#12290; &#35201;&#20805;&#20998;&#21033;&#29992;&#27492;&#21151;&#33021;&#65292;&#35831;&#22312;CACHE_BACKEND&#37324;&#24341;&#20837;&#25152;&#26377;&#26381;&#21153;&#22120;&#30340;&#22320;&#22336;&#65292;&#29992;&#20998;&#21495;&#20998;&#38548;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#32531;&#23384;&#22312;&#36816;&#34892;&#22312;IP&#22320;&#22336;&#20026;172.19.26.240&#21644;172.19.26.242&#65292;&#31471;&#21475;&#21495;&#20026;11211&#30340;Memcached&#23454;&#20363;&#38388;&#20998;&#20139;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn25&quot;&gt;CACHE_BACKEND = &apos;memcached://172.19.26.240:11211;172.19.26.242:11211/&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#32531;&#23384;&#22312;&#36816;&#34892;&#22312;172.19.26.240(&#31471;&#21475;11211)&#65292;172.19.26.242(&#31471;&#21475;11212)&#65292;172.19.26.244(&#31471;&#21475;11213)&#30340;Memcached&#23454;&#20363;&#38388;&#20998;&#20139;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn28&quot;&gt;CACHE_BACKEND = &apos;memcached://172.19.26.240:11211;172.19.26.242:11212;172.19.26.244:11213/&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#26368;&#21518;&#26377;&#20851;Memcached&#30340;&#19968;&#28857;&#26159;&#65292;&#22522;&#20110;&#20869;&#23384;&#30340;&#32531;&#23384;&#26377;&#19968;&#20010;&#37325;&#22823;&#30340;&#32570;&#28857;&#12290; &#30001;&#20110;&#32531;&#23384;&#30340;&#25968;&#25454;&#23384;&#20648;&#22312;&#20869;&#23384;&#20013;&#65292;&#25152;&#20197;&#22914;&#26524;&#24744;&#30340;&#26381;&#21153;&#22120;&#23849;&#28291;&#65292;&#25968;&#25454;&#23558;&#20250;&#28040;&#22833;&#12290;
&#26174;&#28982;&#65292;&#20869;&#23384;&#19981;&#26159;&#29992;&#26469;&#25345;&#20037;&#21270;&#25968;&#25454;&#30340;&#65292;&#22240;&#27492;&#19981;&#35201;&#25226;&#22522;&#20110;&#20869;&#23384;&#30340;&#32531;&#23384;&#20316;&#20026;&#24744;&#21807;&#19968;&#30340;&#23384;&#20648;&#25968;&#25454;&#32531;&#23384;&#12290; &#27627;&#26080;&#30097;&#38382;&#65292;&#22312;Django&#30340;&#32531;&#23384;&#21518;&#31471;&#19981;&#24212;&#35813;&#29992;&#20110;&#25345;&#20037;&#21270;&#65292;&#23427;&#20204;&#26412;&#26469;&#23601;&#34987;&#35774;&#35745;&#25104;&#32531;&#23384;&#30340;&#35299;&#20915;&#26041;&#26696;&#12290;&#20294;&#25105;&#20204;&#20173;&#28982;&#25351;&#20986;&#27492;&#28857;&#65292;&#36825;&#37324;&#26159;&#22240;&#20026;&#22522;&#20110;&#20869;&#23384;&#30340;&#32531;&#23384;&#26159;&#26242;&#26102;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn30&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#25968;&#25454;&#24211;&#32531;&#23384;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#20026;&#20102;&#20351;&#29992;&#25968;&#25454;&#24211;&#34920;&#20316;&#20026;&#32531;&#23384;&#21518;&#31471;&#65292;&#39318;&#20808;&#22312;&#25968;&#25454;&#24211;&#20013;&#36816;&#34892;&#36825;&#20010;&#21629;&#20196;&#20197;&#21019;&#24314;&#32531;&#23384;&#34920;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn33&quot;&gt;python manage.py createcachetable [cache_table_name]
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#36825;&#37324;&#30340;[cache_table_name]&#26159;&#35201;&#21019;&#24314;&#30340;&#25968;&#25454;&#24211;&#34920;&#21517;&#12290; &#65288;&#36825;&#20010;&#21517;&#23383;&#38543;&#20320;&#30340;&#20415;&#65292;&#21482;&#35201;&#23427;&#26159;&#19968;&#20010;&#26377;&#25928;&#30340;&#34920;&#21517;&#65292;&#32780;&#19988;&#19981;&#26159;&#24050;&#32463;&#22312;&#24744;&#30340;&#25968;&#25454;&#24211;&#20013;&#20351;&#29992;&#30340;&#34920;&#21517;&#12290;&#65289;&#36825;&#20010;&#21629;&#20196;&#20197;Django&#30340;&#25968;&#25454;&#24211;&#32531;&#23384;&#31995;&#32479;&#25152;&#26399;&#26395;&#30340;&#26684;&#24335;&#21019;&#24314;&#19968;&#20010;&#34920;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#19968;&#26086;&#20320;&#21019;&#24314;&#20102;&#25968;&#25454;&#24211;&#34920;&#65292;&#25226;&#20320;&#30340;CACHE_BACKEND&#35774;&#32622;&#20026;&#8221;db://tablename&#8221;&#65292;&#36825;&#37324;&#30340;tablename&#26159;&#25968;&#25454;&#24211;&#34920;&#30340;&#21517;&#23383;&#65292;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#32531;&#23384;&#34920;&#21517;&#20026;my_cache_table: &#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#39640;&#36895;&#32531;&#23384;&#34920;&#30340;&#21517;&#23383;&#26159;my_cache_table&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn37&quot;&gt;CACHE_BACKEND = &apos;db://my_cache_table&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#25968;&#25454;&#24211;&#32531;&#23384;&#21518;&#31471;&#20351;&#29992;&#20320;&#30340;settings&#25991;&#20214;&#25351;&#23450;&#30340;&#21516;&#19968;&#25968;&#25454;&#24211;&#12290;
&#20320;&#19981;&#33021;&#20026;&#20320;&#30340;&#32531;&#23384;&#34920;&#20351;&#29992;&#19981;&#21516;&#30340;&#25968;&#25454;&#24211;&#21518;&#31471;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&#22914;&#26524;&#20320;&#24050;&#32463;&#26377;&#20102;&#19968;&#20010;&#24555;&#36895;&#65292;&#33391;&#22909;&#30340;&#32034;&#24341;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#65292;&#37027;&#20040;&#25968;&#25454;&#24211;&#32531;&#23384;&#30340;&#25928;&#26524;&#26368;&#26126;&#26174;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn40&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn40&quot;&gt;&#25991;&#20214;&#31995;&#32479;&#32531;&#23384;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#35201;&#25226;&#32531;&#23384;&#39033;&#30446;&#25918;&#22312;&#25991;&#20214;&#31995;&#32479;&#19978;&#65292;&#35831;&#20026;CACHE_BACKEND&#20351;&#29992;&#8221;&lt;a class=&quot;reference external&quot; href=&quot;file://&quot;&gt;file://&lt;/a&gt;&#8220;&#30340;&#32531;&#23384;&#31867;&#22411;&#12290;&#20363;&#22914;&#65292;&#35201;&#25226;&#32531;&#23384;&#25968;&#25454;&#23384;&#20648;&#22312;/var/tmp/django_cache&#19978;&#65292;&#35831;&#20351;&#29992;&#27492;&#35774;&#32622;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn43&quot;&gt;CACHE_BACKEND = &apos;file:///var/tmp/django_cache&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#27880;&#24847;&#20363;&#23376;&#20013;&#24320;&#22836;&#26377;&#19977;&#20010;&#26012;&#32447;&#12290; &#22836;&#20004;&#39033;&#26159;file://&#65292;&#31532;&#19977;&#20010;&#26159;&#31532;&#19968;&#20010;&#23383;&#31526;&#30340;&#30446;&#24405;&#36335;&#24452;&#65292;/var/tmp/django_cache&#12290;&#22914;&#26524;&#20320;&#20351;&#29992;&#30340;&#26159;Windows&#65292;&#22312;file://&#20043;&#21518;&#21152;&#19978;&#25991;&#20214;&#30340;&#39537;&#21160;&#22120;&#21495;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn46&quot;&gt;file://c:/foo/bar
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#30446;&#24405;&#36335;&#24452;&#24212;&#35813;&#26159;*&#32477;&#23545;*&#36335;&#24452;&#65292;&#21363;&#24212;&#35813;&#20197;&#20320;&#30340;&#25991;&#20214;&#31995;&#32479;&#30340;&#26681;&#24320;&#22987;&#12290; &#22312;&#35774;&#32622;&#30340;&#32467;&#23614;&#25918;&#32622;&#26012;&#32447;&#19982;&#21542;&#26080;&#20851;&#32039;&#35201;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#30830;&#35748;&#35813;&#35774;&#32622;&#25351;&#21521;&#30340;&#30446;&#24405;&#23384;&#22312;&#24182;&#19988;&#20320;&#30340;Web&#26381;&#21153;&#22120;&#36816;&#34892;&#30340;&#31995;&#32479;&#30340;&#29992;&#25143;&#21487;&#20197;&#35835;&#20889;&#35813;&#30446;&#24405;&#12290; &#32487;&#32493;&#19978;&#38754;&#30340;&#20363;&#23376;&#65292;&#22914;&#26524;&#20320;&#30340;&#26381;&#21153;&#22120;&#20197;&#29992;&#25143;apache&#36816;&#34892;&#65292;&#30830;&#35748;/var/tmp/django_cache&#23384;&#22312;&#24182;&#19988;&#29992;&#25143;apache&#21487;&#20197;&#35835;&#20889;/var/tmp/django_cache&#30446;&#24405;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#27599;&#20010;&#32531;&#23384;&#20540;&#23558;&#34987;&#23384;&#20648;&#20026;&#21333;&#29420;&#30340;&#25991;&#20214;&#65292;&#20854;&#20869;&#23481;&#26159;Python&#30340;pickle&#27169;&#22359;&#20197;&#24207;&#21015;&#21270;(&#8220;pickled&#8221;)&#24418;&#24335;&#20445;&#23384;&#30340;&#32531;&#23384;&#25968;&#25454;&#12290; &#27599;&#20010;&#25991;&#20214;&#30340;&#21517;&#31216;&#26159;&#32531;&#23384;&#38190;&#65292;&#20197;&#35268;&#36991;&#24320;&#23433;&#20840;&#25991;&#20214;&#31995;&#32479;&#30340;&#20351;&#29992;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn50&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#26412;&#22320;&#20869;&#23384;&#32531;&#23384;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&#22914;&#26524;&#20320;&#24819;&#21033;&#29992;&#20869;&#23384;&#32531;&#23384;&#30340;&#36895;&#24230;&#20248;&#21183;&#65292;&#20294;&#21448;&#19981;&#33021;&#20351;&#29992;Memcached&#65292;&#21487;&#20197;&#32771;&#34385;&#20351;&#29992;&#26412;&#22320;&#23384;&#20648;&#22120;&#32531;&#23384;&#21518;&#31471;&#12290; &#27492;&#32531;&#23384;&#30340;&#22810;&#36827;&#31243;&#21644;&#32447;&#31243;&#23433;&#20840;&#12290; &#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CACHE_BACKEND&lt;/span&gt;&lt;/tt&gt; &#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locmem:///&lt;/span&gt;&lt;/tt&gt; &#26469;&#20351;&#29992;&#23427;&#65292;&#20363;&#22914;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn53&quot;&gt;CACHE_BACKEND = &apos;locmem:///&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&#35831;&#27880;&#24847;&#65292;&#27599;&#20010;&#36827;&#31243;&#37117;&#26377;&#33258;&#24049;&#31169;&#26377;&#30340;&#32531;&#23384;&#23454;&#20363;&#65292;&#36825;&#24847;&#21619;&#30528;&#36328;&#36827;&#31243;&#32531;&#23384;&#26159;&#19981;&#21487;&#33021;&#30340;&#12290; &#36825;&#26174;&#28982;&#20063;&#24847;&#21619;&#30528;&#26412;&#22320;&#20869;&#23384;&#32531;&#23384;&#25928;&#29575;&#24182;&#19981;&#26159;&#29305;&#21035;&#39640;&#65292;&#25152;&#20197;&#23545;&#20135;&#21697;&#29615;&#22659;&#26469;&#35828;&#23427;&#21487;&#33021;&#19981;&#26159;&#19968;&#20010;&#22909;&#36873;&#25321;&#12290; &#23545;&#24320;&#21457;&#26469;&#35828;&#36824;&#19981;&#38169;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn55&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#20223;&#32531;&#23384;&#65288;&#20379;&#24320;&#21457;&#26102;&#20351;&#29992;&#65289;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#26368;&#21518;&#65292;Django&#25552;&#20379;&#20102;&#19968;&#20010;&#20551;&#32531;&#23384;&#65288;&#21482;&#26159;&#23454;&#29616;&#20102;&#32531;&#23384;&#25509;&#21475;&#65292;&#23454;&#38469;&#19978;&#20160;&#20040;&#37117;&#19981;&#20570;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#20551;&#22914;&#20320;&#26377;&#19968;&#20010;&#20135;&#21697;&#31449;&#28857;&#65292;&#22312;&#35768;&#22810;&#22320;&#26041;&#20351;&#29992;&#39640;&#24230;&#32531;&#23384;&#65292;&#20294;&#22312;&#24320;&#21457;/&#27979;&#35797;&#29615;&#22659;&#20013;&#65292;&#20320;&#19981;&#24819;&#32531;&#23384;&#65292;&#20063;&#19981;&#24819;&#25913;&#21464;&#20195;&#30721;&#65292;&#36825;&#23601;&#38750;&#24120;&#26377;&#29992;&#20102;&#12290; &#35201;&#28608;&#27963;&#34394;&#25311;&#32531;&#23384;&#65292;&#23601;&#20687;&#36825;&#26679;&#35774;&#32622;CACHE_BACKEND&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn59&quot;&gt;CACHE_BACKEND = &apos;dummy:///&apos;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn60&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#20351;&#29992;&#33258;&#23450;&#20041;&#32531;&#23384;&#21518;&#31471;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&#23613;&#31649;Django&#21253;&#21547;&#23545;&#35768;&#22810;&#32531;&#23384;&#21518;&#31471;&#30340;&#25903;&#25345;&#65292;&#22312;&#26576;&#20123;&#24773;&#20917;&#19979;&#65292;&#20320;&#20173;&#28982;&#24819;&#20351;&#29992;&#33258;&#23450;&#20041;&#32531;&#23384;&#21518;&#31471;&#12290; &#35201;&#35753;Django&#20351;&#29992;&#22806;&#37096;&#32531;&#23384;&#21518;&#31471;&#65292;&#38656;&#35201;&#20351;&#29992;&#19968;&#20010;Python import&#36335;&#24452;&#20316;&#20026;&#30340;CACHE_BACKEND URI&#30340;&#65288;&#31532;&#19968;&#20010;&#20882;&#21495;&#21069;&#30340;&#37096;&#20998;&#65289;&#65292;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn63&quot;&gt;CACHE_BACKEND = &apos;path.to.backend://&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#22914;&#26524;&#24744;&#26500;&#24314;&#33258;&#24049;&#30340;&#21518;&#31471;&#65292;&#20320;&#21487;&#20197;&#21442;&#32771;&#26631;&#20934;&#32531;&#23384;&#21518;&#31471;&#30340;&#23454;&#29616;&#12290; &#28304;&#20195;&#30721;&#22312;Django&#30340;&#20195;&#30721;&#30446;&#24405;&#30340;django/core/cache/backends/&#19979;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#27880;&#24847; &#22914;&#26524;&#27809;&#26377;&#19968;&#20010;&#30495;&#27491;&#20196;&#20154;&#20449;&#26381;&#30340;&#29702;&#30001;&#65292;&#27604;&#22914;&#20027;&#26426;&#19981;&#25903;&#25345;&#65292;&#20320;&#23601;&#24212;&#35813;&#22362;&#25345;&#20351;&#29992;Django&#21253;&#21547;&#30340;&#32531;&#23384;&#21518;&#31471;&#12290; &#23427;&#20204;&#32463;&#36807;&#22823;&#37327;&#27979;&#35797;&#65292;&#24182;&#19988;&#26131;&#20110;&#20351;&#29992;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;cache-backend&quot;&gt;
&lt;span id=&quot;cn66&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn66&quot;&gt;CACHE_BACKEND&#21442;&#25968;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&#27599;&#20010;&#32531;&#23384;&#21518;&#31471;&#37117;&#21487;&#33021;&#20351;&#29992;&#21442;&#25968;&#12290; &#23427;&#20204;&#22312;CACHE_BACKEND&#35774;&#32622;&#20013;&#20197;&#26597;&#35810;&#23383;&#31526;&#20018;&#24418;&#24335;&#32473;&#20986;&#12290; &#26377;&#25928;&#21442;&#25968;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;timeout&lt;/span&gt;&lt;/tt&gt;:&#29992;&#20110;&#32531;&#23384;&#30340;&#36807;&#26399;&#26102;&#38388;&#65292;&#20197;&#31186;&#20026;&#21333;&#20301;&#12290; &#36825;&#20010;&#21442;&#25968;&#40664;&#35748;&#34987;&#35774;&#32622;&#20026;300&#31186;&#65288;&#20116;&#20998;&#38047;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;max_entries&#65306;&#23545;&#20110;&#20869;&#23384;&#65292;&#25991;&#20214;&#31995;&#32479;&#21644;&#25968;&#25454;&#24211;&#21518;&#31471;&#65292;&#39640;&#36895;&#32531;&#23384;&#20801;&#35768;&#30340;&#26368;&#22823;&#26465;&#30446;&#25968;&#65292;&#36229;&#20986;&#36825;&#20010;&#25968;&#21017;&#26087;&#20540;&#23558;&#34987;&#21024;&#38500;&#12290; &#36825;&#20010;&#21442;&#25968;&#40664;&#35748;&#26159;300&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cull_percentage&lt;/span&gt;&lt;/tt&gt; :&#24403;&#36798;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;max_entries&lt;/span&gt;&lt;/tt&gt; &#30340;&#26102;&#20505;,&#34987;&#21024;&#38500;&#30340;&#26465;&#30446;&#27604;&#29575;&#12290; &#23454;&#38469;&#30340;&#27604;&#29575;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;1/cull_percentage&lt;/span&gt;&lt;/tt&gt; ,&#25152;&#20197;&#35774;&#32622;cull_frequency=2&#23601;&#26159;&#22312;&#36798;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;max_entries&lt;/span&gt;&lt;/tt&gt; &#30340;&#26102;&#20505;&#21435;&#38500;&#19968;&#21322;&#25968;&#37327;&#30340;&#32531;&#23384;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cull_frequency&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;0&lt;/span&gt;&lt;/tt&gt; &#24847;&#21619;&#30528;&#24403;&#36798;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;max_entries&lt;/span&gt;&lt;/tt&gt; &#26102;,&#32531;&#23384;&#23558;&#34987;&#28165;&#31354;&#12290; &#36825;&#23558;&#20197;&#24456;&#22810;&#32531;&#23384;&#20002;&#22833;&#20026;&#20195;&#20215;,&#22823;&#22823;&#25552;&#39640;&#25509;&#21463;&#35775;&#38382;&#30340;&#36895;&#24230;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;timeout&lt;/span&gt;&lt;/tt&gt; &#34987;&#35774;&#25104; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;60&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn74&quot;&gt;CACHE_BACKEND = &quot;memcached://127.0.0.1:11211/?timeout=60&quot;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#32780;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;timeout&lt;/span&gt;&lt;/tt&gt; &#35774;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;30&lt;/span&gt;&lt;/tt&gt; &#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;max_entries&lt;/span&gt;&lt;/tt&gt; &#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;400&lt;/span&gt;&lt;/tt&gt; :&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn77&quot;&gt;CACHE_BACKEND = &quot;locmem:///?timeout=30&amp;amp;max_entries=400&quot;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#20854;&#20013;&#65292;&#38750;&#27861;&#30340;&#21442;&#25968;&#19982;&#38750;&#27861;&#30340;&#21442;&#25968;&#20540;&#37117;&#23558;&#34987;&#24573;&#30053;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;cache&quot;&gt;
&lt;span id=&quot;cn79&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&#31449;&#28857;&#32423; Cache&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#19968;&#26086;&#39640;&#36895;&#32531;&#23384;&#35774;&#32622;&#65292;&#26368;&#31616;&#21333;&#30340;&#26041;&#27861;&#26159;&#20351;&#29992;&#32531;&#23384;&#32531;&#23384;&#25972;&#20010;&#32593;&#31449;&#12290;
&#24744;
&#38656;&#35201;&#28155;&#21152;&#8217;django.middleware.cache.UpdateCacheMiddleware&#8217;&#21644;
&#8216;django.middleware.cache.FetchFromCacheMiddleware&#8217;&#21040;&#24744;&#30340;MIDDLEWARE_CLASSES&#35774;&#32622;&#20013;&#65292;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#26159;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn82&quot;&gt;MIDDLEWARE_CLASSES = (
    &apos;django.middleware.cache.UpdateCacheMiddleware&apos;,
    &apos;django.middleware.common.CommonMiddleware&apos;,
    &apos;django.middleware.cache.FetchFromCacheMiddleware&apos;,
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#27880;&#24847;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#19981;&#65292;&#36825;&#37324;&#24182;&#27809;&#26377;&#25490;&#29256;&#38169;&#35823;&#65306; &#20462;&#25913;&#30340;&#20013;&#38388;&#20214;&#65292;&#24517;&#39035;&#25918;&#22312;&#21015;&#34920;&#30340;&#24320;&#22987;&#20301;&#32622;&#65292;&#32780;fectch&#20013;&#38388;&#20214;&#65292;&#24517;&#39035;&#25918;&#22312;&#26368;&#21518;&#12290; &#32454;&#33410;&#26377;&#28857;&#36153;&#35299;&#65292;&#22914;&#26524;&#24744;&#24819;&#20102;&#35299;&#23436;&#25972;&#20869;&#24149;&#35831;&#21442;&#30475;&#19979;&#38754;&#30340;MIDDLEWARE_CLASSES&#39034;&#24207;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&#28982;&#21518;&#65292;&#22312;&#20320;&#30340;Django settings&#25991;&#20214;&#37324;&#21152;&#20837;&#19979;&#38754;&#25152;&#38656;&#30340;&#35774;&#32622;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn86&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CACHE_MIDDLEWARE_SECONDS&lt;/span&gt;&lt;/tt&gt; :&#27599;&#20010;&#39029;&#38754;&#24212;&#35813;&#34987;&#32531;&#23384;&#30340;&#31186;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn87&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CACHE_MIDDLEWARE_KEY_PREFIX&lt;/span&gt;&lt;/tt&gt; &#65306;&#22914;&#26524;&#32531;&#23384;&#34987;&#22810;&#20010;&#20351;&#29992;&#30456;&#21516;Django&#23433;&#35013;&#30340;&#32593;&#31449;&#25152;&#20849;&#20139;&#65292;&#37027;&#20040;&#25226;&#36825;&#20010;&#20540;&#35774;&#25104;&#24403;&#21069;&#32593;&#31449;&#21517;&#65292;&#25110;&#20854;&#20182;&#33021;&#20195;&#34920;&#36825;&#20010;Django&#23454;&#20363;&#30340;&#21807;&#19968;&#23383;&#31526;&#20018;&#65292;&#20197;&#36991;&#20813;key&#21457;&#29983;&#20914;&#31361;&#12290; &#22914;&#26524;&#20320;&#19981;&#22312;&#24847;&#30340;&#35805;&#21487;&#20197;&#35774;&#25104;&#31354;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#32531;&#23384;&#20013;&#38388;&#20214;&#32531;&#23384;&#27599;&#20010;&#27809;&#26377;GET&#25110;&#32773;POST&#21442;&#25968;&#30340;&#39029;&#38754;&#12290;
&#25110;&#32773;&#65292;&#22914;&#26524;CACHE_MIDDLEWARE_ANONYMOUS_ONLY&#35774;&#32622;&#20026;True&#65292;&#21482;&#26377;&#21311;&#21517;&#35831;&#27714;&#65288;&#21363;&#19981;&#26159;&#30001;&#30331;&#24405;&#30340;&#29992;&#25143;&#65289;&#23558;&#34987;&#32531;&#23384;&#12290; &#22914;&#26524;&#24819;&#21462;&#28040;&#29992;&#25143;&#30456;&#20851;&#39029;&#38754;&#65288;user-specific pages&#65289;&#30340;&#32531;&#23384;&#65292;&#20363;&#22914;Djangos &#30340;&#31649;&#29702;&#30028;&#38754;&#65292;&#36825;&#26159;&#19968;&#31181;&#26082;&#31616;&#21333;&#21448;&#26377;&#25928;&#30340;&#26041;&#27861;&#12290; CACHE_MIDDLEWARE_ANONYMOUS_ONLY&#65292;&#20320;&#24212;&#35813;&#30830;&#20445;&#20320;&#24050;&#32463;&#21551;&#21160;AuthenticationMiddleware&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#27492;&#22806;&#65292;&#32531;&#23384;&#20013;&#38388;&#20214;&#20026;&#27599;&#20010;HttpResponse&#33258;&#21160;&#35774;&#32622;&#20102;&#20960;&#20010;&#22836;&#37096;&#20449;&#24687;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn90&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn90&quot;&gt;&#24403;&#19968;&#20010;&#26032;(&#27809;&#32531;&#23384;&#30340;)&#29256;&#26412;&#30340;&#39029;&#38754;&#34987;&#35831;&#27714;&#26102;&#35774;&#32622;Last-Modified&#22836;&#37096;&#20026;&#24403;&#21069;&#26085;&#26399;/&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn91&quot;&gt;&#35774;&#32622;Expires&#22836;&#37096;&#20026;&#24403;&#21069;&#26085;&#26399;/&#26102;&#38388;&#21152;&#19978;&#23450;&#20041;&#30340;CACHE_MIDDLEWARE_SECONDS&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn92&quot;&gt;&#35774;&#32622;Cache-Control&#22836;&#37096;&#26469;&#32473;&#39029;&#38754;&#19968;&#20010;&#26368;&#38271;&#30340;&#26377;&#25928;&#26399;&#65292;&#20540;&#26469;&#33258;&#20110;CACHE_MIDDLEWARE_SECONDS&#35774;&#32622;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&#21442;&#38405;&#26356;&#22810;&#30340;&#20013;&#38388;&#20214;&#31532;17&#31456;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&#22914;&#26524;&#35270;&#22270;&#35774;&#32622;&#33258;&#24049;&#30340;&#32531;&#23384;&#21040;&#26399;&#26102;&#38388;&#65288;&#21363; &#23427;&#26377;&#19968;&#20010;&#26368;&#22823;&#24180;&#40836;&#22312;&#22836;&#37096;&#20449;&#24687;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Cache-Control&lt;/span&gt;&lt;/tt&gt;&#20013;&#65289;&#65292;&#37027;&#20040;&#39029;&#38754;&#23558;&#32531;&#23384;&#30452;&#21040;&#36807;&#26399;&#65292;&#32780;&#19981;&#26159;CACHE_MIDDLEWARE_SECONDS&#12290;&#20351;&#29992;django.views.decorators.cache&#35013;&#39280;&#22120;&#65292;&#24744;&#21487;&#20197;&#36731;&#26494;&#22320;&#35774;&#32622;&#35270;&#22270;&#30340;&#21040;&#26399;&#26102;&#38388;&#65288;&#20351;&#29992;cache_control&#35013;&#39280;&#22120;&#65289;&#25110;&#31105;&#29992;&#32531;&#23384;&#35270;&#22270;&#65288;&#20351;&#29992;never_cache&#35013;&#39280;&#22120;&#65289;&#12290; &#35831;&#21442;&#38405;&#19979;&#38754;&#30340;&#8221;&#20351;&#29992;&#20854;&#20182;&#22836;&#37096;&#20449;&#24687;&#8220;&#23567;&#33410;&#20197;&#20102;&#35299;&#35013;&#39280;&#22120;&#30340;&#26356;&#22810;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn95&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#35270;&#22270;&#32423;&#32531;&#23384;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#26356;&#21152;&#39063;&#31890;&#32423;&#30340;&#32531;&#23384;&#26694;&#26550;&#20351;&#29992;&#26041;&#27861;&#26159;&#23545;&#21333;&#20010;&#35270;&#22270;&#30340;&#36755;&#20986;&#36827;&#34892;&#32531;&#23384;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.views.decorators.cache&lt;/span&gt;&lt;/tt&gt;&#23450;&#20041;&#20102;&#19968;&#20010;&#33258;&#21160;&#32531;&#23384;&#35270;&#22270;&#21709;&#24212;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_page&lt;/span&gt;&lt;/tt&gt;&#35013;&#39280;&#22120;&#12290; &#20182;&#26159;&#24456;&#23481;&#26131;&#20351;&#29992;&#30340;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn98&quot;&gt;from django.views.decorators.cache import cache_page

def my_view(request):
    # ...

my_view = cache_page(my_view, 60 * 15)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#20063;&#21487;&#20197;&#20351;&#29992;Python2.4&#30340;&#35013;&#39280;&#22120;&#35821;&#27861;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn101&quot;&gt;@cache_page(60 * 15)
def my_view(request):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn102&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_page&lt;/span&gt;&lt;/tt&gt; &#21482;&#25509;&#21463;&#19968;&#20010;&#21442;&#25968;&#65306; &#20197;&#31186;&#35745;&#30340;&#32531;&#23384;&#36229;&#26102;&#26102;&#38388;&#12290; &#22312;&#21069;&#20363;&#20013;&#65292; &#8220;my_view()&#8221; &#35270;&#22270;&#30340;&#32467;&#26524;&#23558;&#34987;&#32531;&#23384; 15 &#20998;&#38047;&#12290; &#65288;&#27880;&#24847;&#65306; &#20026;&#20102;&#25552;&#39640;&#21487;&#35835;&#24615;&#65292;&#35813;&#21442;&#25968;&#34987;&#20070;&#20889;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;15&lt;/span&gt;&lt;/tt&gt; &#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;15&lt;/span&gt;&lt;/tt&gt; &#23558;&#34987;&#35745;&#31639;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;900&lt;/span&gt;&lt;/tt&gt; &#65292;&#20063;&#23601;&#26159;&#35828;15 &#20998;&#38047;&#20056;&#20197;&#27599;&#20998;&#38047; 60 &#31186;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#21644;&#31449;&#28857;&#32531;&#23384;&#19968;&#26679;&#65292;&#35270;&#22270;&#32531;&#23384;&#19982; URL &#26080;&#20851;&#12290; &#22914;&#26524;&#22810;&#20010; URL &#25351;&#21521;&#21516;&#19968;&#35270;&#22270;&#65292;&#27599;&#20010;&#35270;&#22270;&#23558;&#20250;&#20998;&#21035;&#32531;&#23384;&#12290; &#32487;&#32493; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;my_view&lt;/span&gt;&lt;/tt&gt; &#33539;&#20363;&#65292;&#22914;&#26524; URLconf &#22914;&#19979;&#25152;&#31034;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn105&quot;&gt;urlpatterns = (&apos;&apos;,
    (r&apos;^foo/(\d{1,2})/$&apos;, my_view),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#37027;&#20040;&#27491;&#22914;&#20320;&#25152;&#26399;&#24453;&#30340;&#37027;&#26679;&#65292;&#21457;&#36865;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/foo/1/&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/foo/23/&lt;/span&gt;&lt;/tt&gt; &#30340;&#35831;&#27714;&#23558;&#20250;&#20998;&#21035;&#32531;&#23384;&#12290; &#20294;&#19968;&#26086;&#21457;&#20986;&#20102;&#29305;&#23450;&#30340;&#35831;&#27714;&#65288;&#22914;&#65306; /foo/23/ &#65289;&#65292;&#20043;&#21518;&#20877;&#24230;&#21457;&#20986;&#30340;&#25351;&#21521;&#35813; URL &#30340;&#35831;&#27714;&#23558;&#20351;&#29992;&#32531;&#23384;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;urlconf&quot;&gt;
&lt;span id=&quot;cn107&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&#22312; URLconf &#20013;&#25351;&#23450;&#35270;&#22270;&#32531;&#23384;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&#21069;&#19968;&#33410;&#20013;&#30340;&#33539;&#20363;&#23558;&#35270;&#22270;&#30828;&#32534;&#30721;&#20026;&#20351;&#29992;&#32531;&#23384;&#65292;&#22240;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_page&lt;/span&gt;&lt;/tt&gt; &#22312;&#36866;&#24403;&#30340;&#20301;&#32622;&#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;my_view&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#36827;&#34892;&#20102;&#36716;&#25442;&#12290; &#35813;&#26041;&#27861;&#23558;&#35270;&#22270;&#19982;&#32531;&#23384;&#31995;&#32479;&#36827;&#34892;&#20102;&#32806;&#21512;&#65292;&#20174;&#20960;&#20010;&#26041;&#38754;&#26469;&#35828;&#24182;&#19981;&#29702;&#24819;&#12290; &#20363;&#22914;&#65292;&#20320;&#21487;&#33021;&#24819;&#22312;&#26576;&#20010;&#26080;&#32531;&#23384;&#30340;&#31449;&#28857;&#20013;&#37325;&#29992;&#35813;&#35270;&#22270;&#20989;&#25968;&#65292;&#25110;&#32773;&#20320;&#21487;&#33021;&#24819;&#23558;&#35813;&#35270;&#22270;&#21457;&#24067;&#32473;&#37027;&#20123;&#19981;&#24819;&#36890;&#36807;&#32531;&#23384;&#20351;&#29992;&#23427;&#20204;&#30340;&#20154;&#12290; &#35299;&#20915;&#36825;&#20123;&#38382;&#39064;&#30340;&#26041;&#27861;&#26159;&#22312; URLconf &#20013;&#25351;&#23450;&#35270;&#22270;&#32531;&#23384;&#65292;&#32780;&#19981;&#26159;&#32039;&#25384;&#30528;&#36825;&#20123;&#35270;&#22270;&#20989;&#25968;&#26412;&#36523;&#26469;&#25351;&#23450;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&#23436;&#25104;&#36825;&#39033;&#24037;&#20316;&#38750;&#24120;&#31616;&#21333;&#65306; &#22312; URLconf &#20013;&#29992;&#21040;&#36825;&#20123;&#35270;&#22270;&#20989;&#25968;&#30340;&#26102;&#20505;&#31616;&#21333;&#22320;&#21253;&#35065;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_page&lt;/span&gt;&lt;/tt&gt; &#12290;&#20197;&#19979;&#26159;&#21018;&#25165;&#29992;&#21040;&#36807;&#30340; URLconf : &#36825;&#26159;&#20043;&#21069;&#30340;URLconf&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn111&quot;&gt;urlpatterns = (&apos;&apos;,
    (r&apos;^foo/(\d{1,2})/$&apos;, my_view),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&#20197;&#19979;&#26159;&#21516;&#19968;&#20010; URLconf &#65292;&#19981;&#36807;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_page&lt;/span&gt;&lt;/tt&gt; &#21253;&#35065;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;my_view&lt;/span&gt;&lt;/tt&gt; &#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn114&quot;&gt;from django.views.decorators.cache import cache_page

urlpatterns = (&apos;&apos;,
    (r&apos;^foo/(\d{1,2})/$&apos;, cache_page(my_view, 60 * 15)),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#22914;&#26524;&#37319;&#21462;&#36825;&#31181;&#26041;&#27861;, &#19981;&#35201;&#24536;&#35760;&#22312; URLconf &#20013;&#23548;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_page&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn116&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn116&quot;&gt;&#27169;&#26495;&#30862;&#29255;&#32531;&#23384;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&#20320;&#21516;&#26679;&#21487;&#20197;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache&lt;/span&gt;&lt;/tt&gt;&#26631;&#31614;&#26469;&#32531;&#23384;&#27169;&#26495;&#29255;&#27573;&#12290; &#22312;&#27169;&#26495;&#30340;&#39030;&#31471;&#38468;&#36817;&#21152;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;cache&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#20197;&#36890;&#30693;&#27169;&#26495;&#23384;&#21462;&#32531;&#23384;&#26631;&#31614;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&#27169;&#26495;&#26631;&#31614;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;cache&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#22312;&#32473;&#23450;&#30340;&#26102;&#38388;&#20869;&#32531;&#23384;&#20102;&#22359;&#30340;&#20869;&#23481;&#12290; &#23427;&#33267;&#23569;&#38656;&#35201;&#20004;&#20010;&#21442;&#25968;: &#32531;&#23384;&#36229;&#26102;&#26102;&#38388;&#65288;&#20197;&#31186;&#35745;&#65289;&#21644;&#25351;&#23450;&#32531;&#23384;&#29255;&#27573;&#30340;&#21517;&#31216;&#12290; &#31034;&#20363;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn120&quot;&gt;{% load cache %}
{% cache 500 sidebar %}
    .. sidebar ..
{% endcache %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn121&quot;&gt;&#26377;&#26102;&#20320;&#21487;&#33021;&#24819;&#32531;&#23384;&#22522;&#20110;&#29255;&#27573;&#30340;&#21160;&#24577;&#20869;&#23481;&#30340;&#22810;&#20221;&#25335;&#36125;&#12290; &#27604;&#22914;&#65292;&#20320;&#24819;&#20026;&#19978;&#19968;&#20010;&#20363;&#23376;&#30340;&#27599;&#20010;&#29992;&#25143;&#20998;&#21035;&#32531;&#23384;&#20391;&#36793;&#26639;&#12290; &#36825;&#26679;&#21482;&#38656;&#35201;&#32473;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;cache&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#20256;&#36882;&#39069;&#22806;&#30340;&#21442;&#25968;&#20197;&#26631;&#35782;&#32531;&#23384;&#29255;&#27573;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn123&quot;&gt;{% load cache %}
{% cache 500 sidebar request.user.username %}
    .. sidebar for logged in user ..
{% endcache %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#20256;&#36882;&#19981;&#27490;&#19968;&#20010;&#21442;&#25968;&#20063;&#26159;&#21487;&#34892;&#30340;&#12290; &#31616;&#21333;&#22320;&#25226;&#21442;&#25968;&#20256;&#32473;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;cache&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#32531;&#23384;&#36229;&#26102;&#26102;&#38388;&#21487;&#20197;&#20316;&#20026;&#27169;&#26495;&#21464;&#37327;&#65292;&#21482;&#35201;&#23427;&#21487;&#20197;&#35299;&#26512;&#20026;&#25972;&#25968;&#20540;&#12290; &#20363;&#22914;&#65292;&#22914;&#26524;&#27169;&#26495;&#21464;&#37327;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;my_timeout&lt;/span&gt;&lt;/tt&gt;&#20540;&#20026;600&#65292;&#37027;&#20040;&#20197;&#19979;&#20004;&#20010;&#20363;&#23376;&#26159;&#31561;&#20215;&#30340;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn127&quot;&gt;{% cache 600 sidebar %} ... {% endcache %}
{% cache my_timeout sidebar %} ... {% endcache %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#36825;&#20010;&#29305;&#24615;&#22312;&#36991;&#20813;&#27169;&#26495;&#37325;&#22797;&#26041;&#38754;&#38750;&#24120;&#26377;&#29992;&#12290; &#21487;&#20197;&#25226;&#36229;&#26102;&#26102;&#38388;&#20445;&#23384;&#22312;&#21464;&#37327;&#37324;&#65292;&#28982;&#21518;&#22312;&#21035;&#30340;&#22320;&#26041;&#22797;&#29992;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;api&quot;&gt;
&lt;span id=&quot;cn129&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#20302;&#23618;&#27425;&#32531;&#23384;API&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#26377;&#20123;&#26102;&#20505;&#65292;&#23545;&#25972;&#20010;&#32463;&#35299;&#26512;&#30340;&#39029;&#38754;&#36827;&#34892;&#32531;&#23384;&#24182;&#19981;&#20250;&#32473;&#20320;&#24102;&#26469;&#22826;&#22810;&#22909;&#22788;&#65292;&#20107;&#23454;&#19978;&#21487;&#33021;&#20250;&#36807;&#29369;&#19981;&#21450;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#27604;&#22914;&#35828;&#65292;&#20063;&#35768;&#20320;&#30340;&#31449;&#28857;&#25152;&#21253;&#21547;&#30340;&#19968;&#20010;&#35270;&#22270;&#20381;&#36182;&#20960;&#20010;&#36153;&#26102;&#30340;&#26597;&#35810;&#65292;&#27599;&#38548;&#19968;&#27573;&#26102;&#38388;&#32467;&#26524;&#23601;&#20250;&#21457;&#29983;&#21464;&#21270;&#12290; &#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#20351;&#29992;&#31449;&#28857;&#32423;&#32531;&#23384;&#25110;&#32773;&#35270;&#22270;&#32423;&#32531;&#23384;&#31574;&#30053;&#25152;&#25552;&#20379;&#30340;&#25972;&#39029;&#32531;&#23384;&#24182;&#19981;&#26159;&#26368;&#29702;&#24819;&#30340;&#65292;&#22240;&#20026;&#20320;&#21487;&#33021;&#19981;&#20250;&#24819;&#23545;&#25972;&#20010;&#32467;&#26524;&#36827;&#34892;&#32531;&#23384;&#65288;&#22240;&#20026;&#19968;&#20123;&#25968;&#25454;&#32463;&#24120;&#21464;&#21270;&#65289;&#65292;&#20294;&#20320;&#20173;&#28982;&#20250;&#24819;&#23545;&#24456;&#23569;&#21464;&#21270;&#30340;&#37096;&#20998;&#36827;&#34892;&#32531;&#23384;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&#38024;&#23545;&#36825;&#26679;&#30340;&#24773;&#20917;&#65292;Django&#25552;&#20379;&#20102;&#31616;&#21333;&#20302;&#32423;&#30340;&#32531;&#23384;API&#12290; &#20320;&#21487;&#20197;&#36890;&#36807;&#36825;&#20010;API&#65292;&#20197;&#20219;&#20309;&#20320;&#38656;&#35201;&#30340;&#31890;&#24230;&#26469;&#32531;&#23384;&#23545;&#35937;&#12290; &#20320;&#21487;&#20197;&#23545;&#25152;&#26377;&#33021;&#22815;&#23433;&#20840;&#36827;&#34892; pickle &#22788;&#29702;&#30340; Python &#23545;&#35937;&#36827;&#34892;&#32531;&#23384;&#65306; &#23383;&#31526;&#20018;&#12289;&#23383;&#20856;&#21644;&#27169;&#22411;&#23545;&#35937;&#21015;&#34920;&#31561;&#31561;&#12290; &#65288;&#26597;&#38405; Python &#25991;&#26723;&#21487;&#20197;&#20102;&#35299;&#21040;&#26356;&#22810;&#20851;&#20110; pickling &#30340;&#20449;&#24687;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#32531;&#23384;&#27169;&#22359;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.core.cache&lt;/span&gt;&lt;/tt&gt;&#25317;&#26377;&#19968;&#20010;&#33258;&#21160;&#20381;&#25454;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CACHE_BACKEND&lt;/span&gt;&lt;/tt&gt;&#35774;&#32622;&#21019;&#24314;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.core.cache&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn135&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.core.cache import cache
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn136&quot;&gt;&#22522;&#26412;&#30340;&#25509;&#21475;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;set(key,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;value,&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;timeout_seconds)&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get(key)&lt;/span&gt;&lt;/tt&gt; :&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn138&quot;&gt;&amp;gt;&amp;gt;&amp;gt; cache.set(&apos;my_key&apos;, &apos;hello, world!&apos;, 30)
&amp;gt;&amp;gt;&amp;gt; cache.get(&apos;my_key&apos;)
&apos;hello, world!&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;timeout_seconds&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#26159;&#21487;&#36873;&#30340;, &#24182;&#19988;&#40664;&#35748;&#20026;&#21069;&#38754;&#35762;&#36807;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CACHE_BACKEND&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;timeout&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn140&quot;&gt;&#22914;&#26524;&#32531;&#23384;&#20013;&#19981;&#23384;&#22312;&#35813;&#23545;&#35937;&#65292;&#37027;&#20040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache.get()&lt;/span&gt;&lt;/tt&gt;&#20250;&#36820;&#22238;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn142&quot;&gt;# Wait 30 seconds for &apos;my_key&apos; to expire...

&amp;gt;&amp;gt;&amp;gt; cache.get(&apos;my_key&apos;)
None
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn143&quot;&gt;&#25105;&#20204;&#19981;&#24314;&#35758;&#22312;&#32531;&#23384;&#20013;&#20445;&#23384; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; &#24120;&#37327;&#65292;&#22240;&#20026;&#20320;&#23558;&#26080;&#27861;&#21306;&#20998;&#20320;&#20445;&#23384;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#21450;&#30001;&#36820;&#22238;&#20540; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; &#25152;&#26631;&#35782;&#30340;&#32531;&#23384;&#26410;&#21629;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn144&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache.get()&lt;/span&gt;&lt;/tt&gt; &#25509;&#21463;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#32570;&#30465;&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#12290; &#23427;&#25351;&#23450;&#20102;&#24403;&#32531;&#23384;&#20013;&#19981;&#23384;&#22312;&#35813;&#23545;&#35937;&#26102;&#25152;&#36820;&#22238;&#30340;&#20540;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn146&quot;&gt;&amp;gt;&amp;gt;&amp;gt; cache.get(&apos;my_key&apos;, &apos;has expired&apos;)
&apos;has expired&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn147&quot;&gt;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;add()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#26469;&#26032;&#22686;&#19968;&#20010;&#21407;&#26469;&#27809;&#26377;&#30340;&#38190;&#20540;&#12290; &#23427;&#25509;&#21463;&#30340;&#21442;&#25968;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;set()&lt;/span&gt;&lt;/tt&gt;&#19968;&#26679;&#65292;&#20294;&#26159;&#24182;&#19981;&#21435;&#23581;&#35797;&#26356;&#26032;&#24050;&#32463;&#23384;&#22312;&#30340;&#38190;&#20540;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn149&quot;&gt;&amp;gt;&amp;gt;&amp;gt; cache.set(&apos;add_key&apos;, &apos;Initial value&apos;)
&amp;gt;&amp;gt;&amp;gt; cache.add(&apos;add_key&apos;, &apos;New value&apos;)
&amp;gt;&amp;gt;&amp;gt; cache.get(&apos;add_key&apos;)
&apos;Initial value&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn150&quot;&gt;&#22914;&#26524;&#24819;&#30830;&#23450;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;add()&lt;/span&gt;&lt;/tt&gt;&#26159;&#21542;&#25104;&#21151;&#28155;&#21152;&#20102;&#32531;&#23384;&#20540;&#65292;&#20320;&#24212;&#35813;&#27979;&#35797;&#36820;&#22238;&#20540;&#12290; &#25104;&#21151;&#36820;&#22238;True&#65292;&#22833;&#36133;&#36820;&#22238;False&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn151&quot;&gt;&#36824;&#26377;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_many()&lt;/span&gt;&lt;/tt&gt;&#25509;&#21475;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_many()&lt;/span&gt;&lt;/tt&gt; &#25152;&#36820;&#22238;&#30340;&#23383;&#20856;&#21253;&#25324;&#20102;&#20320;&#25152;&#35831;&#27714;&#30340;&#23384;&#22312;&#20110;&#32531;&#23384;&#20013;&#19988;&#26410;&#36229;&#26102;&#30340;&#25152;&#26377;&#38190;&#20540;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn153&quot;&gt;&amp;gt;&amp;gt;&amp;gt; cache.set(&apos;a&apos;, 1)
&amp;gt;&amp;gt;&amp;gt; cache.set(&apos;b&apos;, 2)
&amp;gt;&amp;gt;&amp;gt; cache.set(&apos;c&apos;, 3)
&amp;gt;&amp;gt;&amp;gt; cache.get_many([&apos;a&apos;, &apos;b&apos;, &apos;c&apos;])
{&apos;a&apos;: 1, &apos;b&apos;: 2, &apos;c&apos;: 3}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&#26368;&#21518;,&#20320;&#21487;&#20197;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache.delete()&lt;/span&gt;&lt;/tt&gt; &#26174;&#24335;&#22320;&#21024;&#38500;&#20851;&#38190;&#23383;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn156&quot;&gt;&amp;gt;&amp;gt;&amp;gt; cache.delete(&apos;a&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn157&quot;&gt;&#20063;&#21487;&#20197;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;incr()&lt;/span&gt;&lt;/tt&gt;&#25110;&#32773;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;decr()&lt;/span&gt;&lt;/tt&gt;&#26469;&#22686;&#21152;&#25110;&#32773;&#20943;&#23569;&#24050;&#32463;&#23384;&#22312;&#30340;&#38190;&#20540;&#12290; &#40664;&#35748;&#24773;&#20917;&#19979;&#65292;&#22686;&#21152;&#25110;&#20943;&#23569;&#30340;&#20540;&#26159;1&#12290;&#21487;&#20197;&#29992;&#21442;&#25968;&#26469;&#21046;&#23450;&#20854;&#20182;&#20540;&#12290; &#22914;&#26524;&#23581;&#35797;&#22686;&#20943;&#19981;&#23384;&#22312;&#30340;&#38190;&#20540;&#20250;&#25243;&#20986;ValueError&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn159&quot;&gt;&amp;gt;&amp;gt;&amp;gt; cache.set(&apos;num&apos;, 1)
&amp;gt;&amp;gt;&amp;gt; cache.incr(&apos;num&apos;)
2
&amp;gt;&amp;gt;&amp;gt; cache.incr(&apos;num&apos;, 10)
12
&amp;gt;&amp;gt;&amp;gt; cache.decr(&apos;num&apos;)
11
&amp;gt;&amp;gt;&amp;gt; cache.decr(&apos;num&apos;, 5)
6
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn160&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn161&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;incr()&lt;/span&gt;&lt;/tt&gt;/&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;decr()&lt;/span&gt;&lt;/tt&gt;&#26041;&#27861;&#19981;&#26159;&#21407;&#23376;&#25805;&#20316;&#12290; &#22312;&#25903;&#25345;&#21407;&#23376;&#22686;&#20943;&#30340;&#32531;&#23384;&#21518;&#31471;&#19978;&#65288;&#26368;&#33879;&#21517;&#30340;&#26159;memcached&#65289;&#65292;&#22686;&#20943;&#25805;&#20316;&#25165;&#26159;&#21407;&#23376;&#30340;&#12290; &#28982;&#32780;&#65292;&#22914;&#26524;&#21518;&#31471;&#24182;&#19981;&#21407;&#29983;&#25903;&#25345;&#22686;&#20943;&#25805;&#20316;&#65292;&#20063;&#21487;&#20197;&#36890;&#36807;&#21462;&#20540;/&#26356;&#26032;&#20004;&#27493;&#25805;&#20316;&#26469;&#23454;&#29616;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn162&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#19978;&#28216;&#32531;&#23384;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn163&quot;&gt;&#30446;&#21069;&#20026;&#27490;&#65292;&#26412;&#31456;&#30340;&#28966;&#28857;&#19968;&#30452;&#26159;&#23545;&#20320; &lt;em&gt;&#33258;&#24049;&#30340;&lt;/em&gt; &#25968;&#25454;&#36827;&#34892;&#32531;&#23384;&#12290; &#20294;&#36824;&#26377;&#19968;&#31181;&#19982; Web &#24320;&#21457;&#30456;&#20851;&#30340;&#32531;&#23384;&#65306; &#19978;&#28216;&#32531;&#23384;&#12290; &#26377;&#19968;&#20123;&#31995;&#32479;&#29978;&#33267;&#22312;&#35831;&#27714;&#21040;&#36798;&#31449;&#28857;&#20043;&#21069;&#23601;&#20026;&#29992;&#25143;&#36827;&#34892;&#39029;&#38754;&#32531;&#23384;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn164&quot;&gt;&#19979;&#38754;&#26159;&#19978;&#28216;&#32531;&#23384;&#30340;&#20960;&#20010;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn165&quot;&gt;&#20320;&#30340; ISP (&#20114;&#32852;&#32593;&#26381;&#21153;&#21830;)&#21487;&#33021;&#20250;&#23545;&#29305;&#23450;&#30340;&#39029;&#38754;&#36827;&#34892;&#32531;&#23384;&#65292;&#22240;&#27492;&#22914;&#26524;&#20320;&#21521; &lt;a class=&quot;reference external&quot; href=&quot;http://example.com/&quot;&gt;http://example.com/&lt;/a&gt; &#35831;&#27714;&#19968;&#20010;&#39029;&#38754;&#65292;&#20320;&#30340; ISP &#21487;&#33021;&#26080;&#38656;&#30452;&#25509;&#35775;&#38382; example.com &#23601;&#33021;&#23558;&#39029;&#38754;&#21457;&#36865;&#32473;&#20320;&#12290; &#32780; example.com &#30340;&#32500;&#25252;&#32773;&#20204;&#21364;&#26080;&#20174;&#24471;&#30693;&#36825;&#31181;&#32531;&#23384;&#65292;ISP &#20301;&#20110; example.com &#21644;&#20320;&#30340;&#32593;&#39029;&#27983;&#35272;&#22120;&#20043;&#38388;&#65292;&#36879;&#26126;&#22320;&#22788;&#29702;&#25152;&#26377;&#30340;&#32531;&#23384;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn166&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn166&quot;&gt;&#20320;&#30340; Django &#32593;&#31449;&#21487;&#33021;&#20301;&#20110;&#26576;&#20010; &lt;em&gt;&#20195;&#29702;&#32531;&#23384;&lt;/em&gt; &#20043;&#21518;&#65292;&#20363;&#22914; Squid &#32593;&#39029;&#20195;&#29702;&#32531;&#23384; (&lt;a class=&quot;reference external&quot; href=&quot;http://www.squid-cache.org/&quot;&gt;http://www.squid-cache.org/&lt;/a&gt;)&#65292;&#35813;&#32531;&#23384;&#20026;&#25552;&#39640;&#24615;&#33021;&#32780;&#23545;&#39029;&#38754;&#36827;&#34892;&#32531;&#23384;&#12290; &#22312;&#27492;&#24773;&#20917;&#19979; &#65292;&#27599;&#20010;&#35831;&#27714;&#23558;&#39318;&#20808;&#30001;&#20195;&#29702;&#26381;&#21153;&#22120;&#36827;&#34892;&#22788;&#29702;&#65292;&#28982;&#21518;&#20165;&#22312;&#38656;&#35201;&#30340;&#24773;&#20917;&#19979;&#25165;&#34987;&#20256;&#36882;&#33267;&#20320;&#30340;&#24212;&#29992;&#31243;&#24207;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn167&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn167&quot;&gt;&#20320;&#30340;&#32593;&#39029;&#27983;&#35272;&#22120;&#20063;&#23545;&#39029;&#38754;&#36827;&#34892;&#32531;&#23384;&#12290; &#22914;&#26524;&#26576;&#32593;&#39029;&#36865;&#20986;&#20102;&#30456;&#24212;&#30340;&#22836;&#37096;&#65292;&#20320;&#30340;&#27983;&#35272;&#22120;&#23558;&#22312;&#20026;&#23545;&#35813;&#32593;&#39029;&#30340;&#21518;&#32493;&#30340;&#35775;&#38382;&#35831;&#27714;&#20351;&#29992;&#26412;&#22320;&#32531;&#23384;&#30340;&#25335;&#36125;&#65292;&#29978;&#33267;&#19981;&#20250;&#20877;&#27425;&#32852;&#31995;&#35813;&#32593;&#39029;&#26597;&#30475;&#26159;&#21542;&#21457;&#29983;&#20102;&#21464;&#21270;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&#19978;&#28216;&#32531;&#23384;&#23558;&#20250;&#20135;&#29983;&#38750;&#24120;&#26126;&#26174;&#30340;&#25928;&#29575;&#25552;&#21319;&#65292;&#20294;&#20063;&#23384;&#22312;&#19968;&#23450;&#39118;&#38505;&#12290; &#35768;&#22810;&#32593;&#39029;&#30340;&#20869;&#23481;&#20381;&#25454;&#36523;&#20221;&#39564;&#35777;&#20197;&#21450;&#35768;&#22810;&#20854;&#20182;&#21464;&#37327;&#30340;&#24773;&#20917;&#21457;&#29983;&#21464;&#21270;&#65292;&#32531;&#23384;&#31995;&#32479;&#20165;&#30450;&#30446;&#22320;&#26681;&#25454; URL &#20445;&#23384;&#39029;&#38754;&#65292;&#21487;&#33021;&#20250;&#21521;&#36825;&#20123;&#39029;&#38754;&#30340;&#21518;&#32493;&#35775;&#38382;&#32773;&#26292;&#38706;&#19981;&#27491;&#30830;&#25110;&#32773;&#25935;&#24863;&#30340;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn169&quot;&gt;&#20030;&#20010;&#20363;&#23376;&#65292;&#20551;&#23450;&#20320;&#22312;&#20351;&#29992;&#32593;&#39029;&#30005;&#37038;&#31995;&#32479;&#65292;&#26174;&#28982;&#25910;&#20214;&#31665;&#39029;&#38754;&#30340;&#20869;&#23481;&#21462;&#20915;&#20110;&#30331;&#24405;&#30340;&#26159;&#21738;&#20010;&#29992;&#25143;&#12290; &#22914;&#26524; ISP &#30450;&#30446;&#22320;&#32531;&#23384;&#20102;&#35813;&#31449;&#28857;&#65292;&#37027;&#20040;&#31532;&#19968;&#20010;&#29992;&#25143;&#36890;&#36807;&#35813; ISP &#30331;&#24405;&#20043;&#21518;&#65292;&#20182;&#65288;&#25110;&#22905;&#65289;&#30340;&#29992;&#25143;&#25910;&#20214;&#31665;&#39029;&#38754;&#23558;&#20250;&#32531;&#23384;&#32473;&#21518;&#32493;&#30340;&#35775;&#38382;&#32773;&#12290; &#36825;&#19968;&#28857;&#20063;&#19981;&#22909;&#29609;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn170&quot;&gt;&#24184;&#36816;&#30340;&#26159;&#65292; HTTP &#25552;&#20379;&#20102;&#35299;&#20915;&#35813;&#38382;&#39064;&#30340;&#26041;&#26696;&#12290; &#24050;&#26377;&#19968;&#20123; HTTP &#22836;&#26631;&#29992;&#20110;&#25351;&#24341;&#19978;&#28216;&#32531;&#23384;&#26681;&#25454;&#25351;&#23450;&#21464;&#37327;&#26469;&#21306;&#20998;&#32531;&#23384;&#20869;&#23481;&#65292;&#24182;&#36890;&#30693;&#32531;&#23384;&#26426;&#21046;&#19981;&#23545;&#29305;&#23450;&#39029;&#38754;&#36827;&#34892;&#32531;&#23384;&#12290; &#25105;&#20204;&#23558;&#22312;&#26412;&#33410;&#21518;&#32493;&#37096;&#20998;&#23558;&#23545;&#36825;&#20123;&#22836;&#26631;&#36827;&#34892;&#38416;&#36848;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;vary&quot;&gt;
&lt;span id=&quot;cn171&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn171&quot;&gt;&#20351;&#29992; Vary&#22836;&#37096;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn172&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Vary&lt;/span&gt;&lt;/tt&gt; &#22836;&#37096;&#23450;&#20041;&#20102;&#32531;&#23384;&#26426;&#21046;&#22312;&#26500;&#24314;&#20854;&#32531;&#23384;&#38190;&#20540;&#26102;&#24212;&#24403;&#23558;&#21738;&#20010;&#35831;&#27714;&#22836;&#26631;&#32771;&#34385;&#22312;&#20869;&#12290; &#20363;&#22914;&#65292;&#22914;&#26524;&#32593;&#39029;&#30340;&#20869;&#23481;&#21462;&#20915;&#20110;&#29992;&#25143;&#30340;&#35821;&#35328;&#20559;&#22909;&#65292;&#35813;&#39029;&#38754;&#34987;&#31216;&#20026;&#26681;&#25454;&#35821;&#35328;&#32780;&#19981;&#21516;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn173&quot;&gt;&#32570;&#30465;&#24773;&#20917;&#19979;&#65292;Django &#30340;&#32531;&#23384;&#31995;&#32479;&#20351;&#29992;&#25152;&#35831;&#27714;&#30340;&#36335;&#24452;&#65288;&#27604;&#22914;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;/stories/2005/jun/23/bank_robbed/&quot;&lt;/span&gt;&lt;/tt&gt; &#65289;&#26469;&#21019;&#24314;&#20854;&#32531;&#23384;&#38190;&#12290;&#36825;&#24847;&#21619;&#30528;&#27599;&#27425;&#35831;&#27714;&#37117;&#20250;&#20351;&#29992;&#21516;&#26679;&#30340;&#32531;&#23384;&#29256;&#26412;&#65292;&#19981;&#32771;&#34385;&#25165;&#23458;&#25143;&#31471;cookie&#21644;&#35821;&#35328;&#37197;&#32622;&#30340;&#19981;&#21516;&#12290; &#38500;&#38750;&#20320;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Vary&lt;/span&gt;&lt;/tt&gt;&#22836;&#37096;&#36890;&#30693;&#32531;&#23384;&#26426;&#21046;&#39029;&#38754;&#36755;&#20986;&#35201;&#20381;&#25454;&#35831;&#27714;&#22836;&#37324;&#30340;cookie&#65292;&#35821;&#35328;&#31561;&#30340;&#35774;&#32622;&#32780;&#19981;&#21516;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#35201;&#22312; Django &#23436;&#25104;&#36825;&#39033;&#24037;&#20316;&#65292;&#21487;&#20351;&#29992;&#20415;&#21033;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;vary_on_headers&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#35013;&#39280;&#22120;&#65292;&#22914;&#19979;&#25152;&#31034;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn176&quot;&gt;from django.views.decorators.vary import vary_on_headers

# Python 2.3 syntax.
def my_view(request):
    # ...
my_view = vary_on_headers(my_view, &apos;User-Agent&apos;)

# Python 2.4+ decorator syntax.
@vary_on_headers(&apos;User-Agent&apos;)
def my_view(request):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn177&quot;&gt;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#32531;&#23384;&#26426;&#21046;&#65288;&#22914; Django &#33258;&#24049;&#30340;&#32531;&#23384;&#20013;&#38388;&#20214;&#65289;&#23558;&#20250;&#20026;&#27599;&#19968;&#20010;&#21333;&#29420;&#30340;&#29992;&#25143;&#27983;&#35272;&#22120;&#32531;&#23384;&#19968;&#20010;&#29420;&#31435;&#30340;&#39029;&#38754;&#29256;&#26412;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn178&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;vary_on_headers&lt;/span&gt;&lt;/tt&gt; &#35013;&#39280;&#22120;&#32780;&#19981;&#26159;&#25163;&#21160;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Vary&lt;/span&gt;&lt;/tt&gt; &#22836;&#37096;&#65288;&#20351;&#29992;&#20687; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;response[&apos;Vary&apos;]&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&apos;user-agent&apos;&lt;/span&gt;&lt;/tt&gt; &#20043;&#31867;&#30340;&#20195;&#30721;&#65289;&#30340;&#22909;&#22788;&#26159;&#20462;&#39280;&#22120;&#22312;&#65288;&#21487;&#33021;&#24050;&#32463;&#23384;&#22312;&#30340;&#65289; &lt;em&gt;Vary&lt;/em&gt; &#20043;&#19978;&#36827;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#28155;&#21152;&lt;/span&gt;&lt;/tt&gt; &#65292;&#32780;&#19981;&#26159;&#20174;&#38646;&#24320;&#22987;&#35774;&#32622;&#65292;&#19988;&#21487;&#33021;&#35206;&#30422;&#35813;&#22788;&#24050;&#32463;&#23384;&#22312;&#30340;&#35774;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn179&quot;&gt;&#20320;&#21487;&#20197;&#21521; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;vary_on_headers()&lt;/span&gt;&lt;/tt&gt; &#20256;&#20837;&#22810;&#20010;&#22836;&#26631;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn181&quot;&gt;@vary_on_headers(&apos;User-Agent&apos;, &apos;Cookie&apos;)
def my_view(request):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn182&quot;&gt;&#35813;&#27573;&#20195;&#30721;&#36890;&#30693;&#19978;&#28216;&#32531;&#23384;&#23545; &lt;em&gt;&#20004;&#32773;&lt;/em&gt; &#37117;&#36827;&#34892;&#19981;&#21516;&#25805;&#20316;&#65292;&#20063;&#23601;&#26159;&#35828; user-agent &#21644; cookie &#30340;&#27599;&#31181;&#32452;&#21512;&#37117;&#24212;&#33719;&#21462;&#33258;&#24049;&#30340;&#32531;&#23384;&#20540;&#12290; &#20030;&#20363;&#26469;&#35828;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Mozilla&lt;/span&gt;&lt;/tt&gt; &#20316;&#20026; user-agent &#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo=bar&lt;/span&gt;&lt;/tt&gt; &#20316;&#20026; cookie &#20540;&#30340;&#35831;&#27714;&#24212;&#35813;&#21644;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Mozilla&lt;/span&gt;&lt;/tt&gt; &#20316;&#20026; user-agent &#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo=ham&lt;/span&gt;&lt;/tt&gt; &#30340;&#35831;&#27714;&#24212;&#35813;&#34987;&#35270;&#20026;&#19981;&#21516;&#35831;&#27714;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn183&quot;&gt;&#30001;&#20110;&#26681;&#25454; cookie &#32780;&#21306;&#20998;&#23545;&#24453;&#26159;&#24456;&#24120;&#35265;&#30340;&#24773;&#20917;&#65292;&#22240;&#27492;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;vary_on_cookie&lt;/span&gt;&lt;/tt&gt; &#35013;&#39280;&#22120;&#12290; &#20197;&#19979;&#20004;&#20010;&#35270;&#22270;&#26159;&#31561;&#25928;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn185&quot;&gt;@vary_on_cookie
def my_view(request):
    # ...

@vary_on_headers(&apos;Cookie&apos;)
def my_view(request):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#20256;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;vary_on_headers&lt;/span&gt;&lt;/tt&gt; &#22836;&#26631;&#26159;&#22823;&#23567;&#20889;&#19981;&#25935;&#24863;&#30340;&#65307; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;User-Agent&quot;&lt;/span&gt;&lt;/tt&gt; &#19982; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;user-agent&quot;&lt;/span&gt;&lt;/tt&gt; &#23436;&#20840;&#30456;&#21516;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn187&quot;&gt;&#20320;&#20063;&#21487;&#20197;&#30452;&#25509;&#20351;&#29992;&#24110;&#21161;&#20989;&#25968;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.cache.patch_vary_headers&lt;/span&gt;&lt;/tt&gt;&#12290;
&#35813;&#20989;&#25968;&#35774;&#32622;&#25110;&#22686;&#21152; Vary header &#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn189&quot;&gt;from django.utils.cache import patch_vary_headers

def my_view(request):
    # ...
    response = render_to_response(&apos;template_name&apos;, context)
    patch_vary_headers(response, [&apos;Cookie&apos;])
    return response
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;patch_vary_headers&lt;/span&gt;&lt;/tt&gt; &#20197;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#23454;&#20363;&#20026;&#31532;&#19968;&#20010;&#21442;&#25968;&#65292;&#20197;&#19968;&#20010;&#22823;&#23567;&#20889;&#19981;&#25935;&#24863;&#30340;&#22836;&#26631;&#21517;&#31216;&#21015;&#34920;&#25110;&#20803;&#32452;&#20026;&#31532;&#20108;&#20010;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn191&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn191&quot;&gt;&#25511;&#21046;&#32531;&#23384;&#65306; &#20351;&#29992;&#20854;&#23427;&#22836;&#37096;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn192&quot;&gt;&#20851;&#20110;&#32531;&#23384;&#21097;&#19979;&#30340;&#38382;&#39064;&#26159;&#25968;&#25454;&#30340;&#38544;&#31169;&#24615;&#20197;&#21450;&#22312;&#32423;&#32852;&#32531;&#23384;&#20013;&#25968;&#25454;&#24212;&#35813;&#22312;&#20309;&#22788;&#20648;&#23384;&#30340;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&#36890;&#24120;&#29992;&#25143;&#23558;&#20250;&#38754;&#23545;&#20004;&#31181;&#32531;&#23384;&#65306; &#20182;&#25110;&#22905;&#33258;&#24049;&#30340;&#27983;&#35272;&#22120;&#32531;&#23384;&#65288;&#31169;&#26377;&#32531;&#23384;&#65289;&#20197;&#21450;&#20182;&#25110;&#22905;&#30340;&#25552;&#20379;&#32773;&#32531;&#23384;&#65288;&#20844;&#20849;&#32531;&#23384;&#65289;&#12290; &#20844;&#20849;&#32531;&#23384;&#30001;&#22810;&#20010;&#29992;&#25143;&#20351;&#29992;&#65292;&#32780;&#21463;&#20854;&#20182;&#26576;&#20154;&#30340;&#25511;&#21046;&#12290; &#36825;&#23601;&#20135;&#29983;&#20102;&#20320;&#19981;&#24819;&#36935;&#21040;&#30340;&#25935;&#24863;&#25968;&#25454;&#30340;&#38382;&#39064;&#65292;&#27604;&#22914;&#35828;&#20320;&#30340;&#38134;&#34892;&#36134;&#21495;&#34987;&#23384;&#20648;&#22312;&#20844;&#20247;&#32531;&#23384;&#20013;&#12290; &#22240;&#27492;&#65292;Web &#24212;&#29992;&#31243;&#24207;&#38656;&#35201;&#20197;&#26576;&#31181;&#26041;&#24335;&#21578;&#35785;&#32531;&#23384;&#37027;&#20123;&#25968;&#25454;&#26159;&#31169;&#26377;&#30340;&#65292;&#21738;&#20123;&#26159;&#20844;&#20849;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn194&quot;&gt;&#35299;&#20915;&#26041;&#26696;&#26159;&#26631;&#31034;&#20986;&#26576;&#20010;&#39029;&#38754;&#32531;&#23384;&#24212;&#24403;&#26159;&#31169;&#26377;&#30340;&#12290; &#35201;&#22312; Django &#20013;&#23436;&#25104;&#27492;&#39033;&#24037;&#20316;&#65292;&#21487;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_control&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#20462;&#39280;&#22120;&#65306; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn196&quot;&gt;from django.views.decorators.cache import cache_control

@cache_control(private=True)
def my_view(request):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&#35813;&#20462;&#39280;&#22120;&#36127;&#36131;&#22312;&#21518;&#21488;&#21457;&#36865;&#30456;&#24212;&#30340; HTTP &#22836;&#37096;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&#36824;&#26377;&#19968;&#20123;&#20854;&#20182;&#26041;&#27861;&#21487;&#20197;&#25511;&#21046;&#32531;&#23384;&#21442;&#25968;&#12290; &#20363;&#22914;, HTTP &#20801;&#35768;&#24212;&#29992;&#31243;&#24207;&#25191;&#34892;&#22914;&#19979;&#25805;&#20316;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn199&quot;&gt;&#23450;&#20041;&#39029;&#38754;&#21487;&#20197;&#34987;&#32531;&#23384;&#30340;&#26368;&#22823;&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn200&quot;&gt;&#25351;&#23450;&#26576;&#20010;&#32531;&#23384;&#26159;&#21542;&#24635;&#26159;&#26816;&#26597;&#36739;&#26032;&#29256;&#26412;&#65292;&#20165;&#24403;&#26080;&#26356;&#26032;&#26102;&#25165;&#20256;&#36882;&#25152;&#32531;&#23384;&#20869;&#23481;&#12290; &#65288;&#19968;&#20123;&#32531;&#23384;&#21363;&#20415;&#22312;&#26381;&#21153;&#22120;&#39029;&#38754;&#21457;&#29983;&#21464;&#21270;&#30340;&#24773;&#20917;&#19979;&#20173;&#28982;&#20250;&#20256;&#36865;&#25152;&#32531;&#23384;&#30340;&#20869;&#23481;&#65292;&#21482;&#22240;&#20026;&#32531;&#23384;&#25335;&#36125;&#27809;&#26377;&#36807;&#26399;&#12290;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn201&quot;&gt;&#22312; Django &#20013;&#65292;&#21487;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_control&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#20462;&#39280;&#22120;&#25351;&#23450;&#36825;&#20123;&#32531;&#23384;&#21442;&#25968;&#12290; &#22312;&#26412;&#20363;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_control&lt;/span&gt;&lt;/tt&gt; &#21578;&#35785;&#32531;&#23384;&#23545;&#27599;&#27425;&#35775;&#38382;&#37117;&#37325;&#26032;&#39564;&#35777;&#32531;&#23384;&#24182;&#22312;&#26368;&#38271; 3600 &#31186;&#20869;&#20445;&#23384;&#25152;&#32531;&#23384;&#29256;&#26412;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn203&quot;&gt;from django.views.decorators.cache import cache_control

@cache_control(must_revalidate=True, max_age=3600)
def my_view(request):
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn204&quot;&gt;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cache_control()&lt;/span&gt;&lt;/tt&gt; &#20013;&#65292;&#20219;&#20309;&#21512;&#27861;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Cache-Control&lt;/span&gt;&lt;/tt&gt; HTTP &#25351;&#20196;&#37117;&#26159;&#26377;&#25928;&#30340;&#12290;&#19979;&#38754;&#26159;&#23436;&#25972;&#21015;&#34920;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn205&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn205&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;public=True&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn206&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn206&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;private=True&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn207&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn207&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;no_cache=True&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn208&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn208&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;no_transform=True&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn209&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;must_revalidate=True&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn210&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;proxy_revalidate=True&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn211&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn211&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;max_age=num_seconds&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn212&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn212&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;s_maxage=num_seconds&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn213&quot;&gt;&#32531;&#23384;&#20013;&#38388;&#20214;&#24050;&#32463;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CACHE_MIDDLEWARE_SETTINGS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#35774;&#23450;&#20102;&#32531;&#23384;&#22836;&#37096; max-age &#12290; &#22914;&#26524;&#20320;&#22312;cache_control&#20462;&#39280;&#22120;&#20013;&#20351;&#29992;&#20102;&#33258;&#23450;&#20041;&#30340;max_age&#65292;&#35813;&#20462;&#39280;&#22120;&#23558;&#20250;&#21462;&#24471;&#20248;&#20808;&#26435;&#65292;&#35813;&#22836;&#37096;&#30340;&#20540;&#23558;&#34987;&#27491;&#30830;&#22320;&#34987;&#21512;&#24182;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn214&quot;&gt;&#22914;&#26524;&#20320;&#24819;&#29992;&#22836;&#37096;&#23436;&#20840;&#31105;&#25481;&#32531;&#23384;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.views.decorators.cache.never_cache&lt;/span&gt;&lt;/tt&gt;&#35013;&#39280;&#22120;&#21487;&#20197;&#28155;&#21152;&#30830;&#20445;&#21709;&#24212;&#19981;&#34987;&#32531;&#23384;&#30340;&#22836;&#37096;&#20449;&#24687;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn216&quot;&gt;from django.views.decorators.cache import never_cache

@never_cache
def myview(request):
    # ...
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn217&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&#20854;&#20182;&#20248;&#21270;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn218&quot;&gt;Django &#24102;&#26377;&#19968;&#20123;&#20854;&#23427;&#20013;&#38388;&#20214;&#21487;&#24110;&#21161;&#24744;&#20248;&#21270;&#24212;&#29992;&#31243;&#24207;&#30340;&#24615;&#33021;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn219&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn219&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.http.ConditionalGetMiddleware&lt;/span&gt;&lt;/tt&gt; &#20026;&#29616;&#20195;&#27983;&#35272;&#22120;&#22686;&#21152;&#20102;&#26377;&#26465;&#20214;&#30340;&#65292;&#22522;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ETag&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Last-Modified&lt;/span&gt;&lt;/tt&gt; &#22836;&#26631;&#30340;GET&#21709;&#24212;&#30340;&#30456;&#20851;&#25903;&#25345;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn220&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn220&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.gzip.GZipMiddleware&lt;/span&gt;&lt;/tt&gt; &#20026;&#25152;&#26377;&#29616;&#20195;&#27983;&#35272;&#22120;&#21387;&#32553;&#21709;&#24212;&#20869;&#23481;&#65292;&#20197;&#33410;&#30465;&#24102;&#23485;&#21644;&#20256;&#36865;&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;middleware-classes&quot;&gt;
&lt;span id=&quot;cn221&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn221&quot;&gt;MIDDLEWARE_CLASSES &#30340;&#39034;&#24207;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn222&quot;&gt;&#22914;&#26524;&#20351;&#29992;&#32531;&#23384;&#20013;&#38388;&#20214;&#65292;&#27880;&#24847;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt;&#35774;&#32622;&#20013;&#27491;&#30830;&#37197;&#32622;&#12290; &#22240;&#20026;&#32531;&#23384;&#20013;&#38388;&#20214;&#38656;&#35201;&#30693;&#36947;&#21738;&#20123;&#22836;&#37096;&#20449;&#24687;&#30001;&#21738;&#20123;&#32531;&#23384;&#21306;&#26469;&#21306;&#20998;&#12290; &#20013;&#38388;&#20214;&#24635;&#26159;&#23613;&#21487;&#33021;&#24471;&#24819;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Vary&lt;/span&gt;&lt;/tt&gt;&#21709;&#24212;&#22836;&#20013;&#28155;&#21152;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn223&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;UpdateCacheMiddleware&lt;/span&gt;&lt;/tt&gt;&#22312;&#30456;&#24212;&#38454;&#27573;&#36816;&#34892;&#12290;&#22240;&#20026;&#20013;&#38388;&#20214;&#26159;&#20197;&#30456;&#21453;&#39034;&#24207;&#36816;&#34892;&#30340;&#65292;&#25152;&#26377;&#21015;&#34920;&#39030;&#37096;&#30340;&#20013;&#38388;&#20214;&#21453;&#32780;&lt;em&gt;last&lt;/em&gt;&#22312;&#30456;&#24212;&#38454;&#27573;&#30340;&#26368;&#21518;&#36816;&#34892;&#12290;
&#25152;&#26377;&#65292;&#20320;&#38656;&#35201;&#30830;&#20445;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;UpdateCacheMiddleware&lt;/span&gt;&lt;/tt&gt;&#25490;&#22312;&#20219;&#20309;&#21487;&#33021;&#24448;&lt;em&gt;Vary&lt;/em&gt;&#22836;&#37096;&#28155;&#21152;&#20449;&#24687;&#30340;&#20013;&#38388;&#20214;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#20043;&#21069;&lt;/span&gt;&lt;/tt&gt;&#12290; &#19979;&#38754;&#30340;&#20013;&#38388;&#20214;&#27169;&#22359;&#23601;&#26159;&#36825;&#26679;&#30340;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn224&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn224&quot;&gt;&#28155;&#21152; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Cookie&lt;/span&gt;&lt;/tt&gt; &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SessionMiddleware&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn225&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn225&quot;&gt;&#28155;&#21152; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Accept-Encoding&lt;/span&gt;&lt;/tt&gt; &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GZipMiddleware&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn226&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn226&quot;&gt;&#28155;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Accept-Language&lt;/span&gt;&lt;/tt&gt;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocaleMiddleware&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn227&quot;&gt;&#21478;&#19968;&#26041;&#38754;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FetchFromCacheMiddleware&lt;/span&gt;&lt;/tt&gt;&#22312;&#35831;&#27714;&#38454;&#27573;&#36816;&#34892;&#65292;&#36825;&#26102;&#20013;&#38388;&#20214;&#24490;&#24207;&#25191;&#34892;&#65292;&#25152;&#20197;&#21015;&#34920;&#39030;&#31471;&#30340;&#39033;&#30446;&#20250;&lt;em&gt;&#39318;&#20808;&lt;/em&gt;&#25191;&#34892;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FetchFromCacheMiddleware&lt;/span&gt;&lt;/tt&gt;&#20063;&#38656;&#35201;&#22312;&#20250;&#20462;&#25913;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Vary&lt;/span&gt;&lt;/tt&gt;&#22836;&#37096;&#30340;&#20013;&#38388;&#20214;&#20043;&#21518;&#36816;&#34892;&#65292;&#25152;&#20197;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FetchFromCacheMiddleware&lt;/span&gt;&lt;/tt&gt;&#24517;&#39035;&#25918;&#22312;&#23427;&#20204;&lt;em&gt;&#21518;&#38754;&lt;/em&gt;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn228&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn228&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn229&quot;&gt;Django&#25414;&#32465;&#20102;&#19968;&#31995;&#21015;&#21487;&#36873;&#30340;&#26041;&#20415;&#29305;&#24615;&#12290; &#25105;&#20204;&#24050;&#32463;&#20171;&#32461;&#20102;&#19968;&#20123;&#65306; admin&#31449;&#28857;&#65288;&#31532;&#20845;&#31456;&#65289;&#21644;session/user&#26694;&#26550;&#65288;&#31532;&#21313;&#22235;&#31456;&#65289;&#12290;&lt;a href=&quot;./chapter16&quot;&gt; &#19979;&#19968;&#31456;&lt;/a&gt;&#20013;&#65292;&#25105;&#20204;&#23558;&#35762;&#36848;Django&#20013;&#20854;&#20182;&#30340;&#23376;&#26694;&#26550;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter16</id>
        <title type="html">chapter16</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter16"/>
        <published>2015-02-26T22:26:45+08:00</published>
        <updated>2015-02-26T23:03:42+08:00</updated> 
        <category term="/General" label="General" />
        <summary type="html"> </summary>
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;django-contrib&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#21313;&#20845;&#31456;&#65306;&#38598;&#25104;&#30340;&#23376;&#26694;&#26550; django.contrib&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;Python&#26377;&#20247;&#22810;&#20248;&#28857;&#65292;&#20854;&#20013;&#20043;&#19968;&#23601;&#26159;&#8220;&#24320;&#26426;&#21363;&#29992;&#8221;&#21407;&#21017;&#65306; &#23433;&#35013;Python&#30340;&#21516;&#26102;&#20250;&#23433;&#35013;&#22909;&#22823;&#37327;&#30340;&#26631;&#20934;&#36719;&#20214;&#21253;&#65292;&#36825;&#26679; &#20320;&#21487;&#20197;&#31435;&#21363;&#20351;&#29992;&#32780;&#19981;&#29992;&#33258;&#24049;&#21435;&#19979;&#36733;&#12290; Django&#20063;&#36981;&#24490;&#36825;&#20010;&#21407;&#21017;&#65292;&#23427;&#21516;&#26679;&#21253;&#21547;&#20102;&#33258;&#24049;&#30340;&#26631;&#20934;&#24211;&#12290;
&#36825;&#19968;&#31456;&#23601;&#26469;&#35762; &#36825;&#20123;&#38598;&#25104;&#30340;&#23376;&#26694;&#26550;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;django&quot;&gt;
&lt;span id=&quot;cn2&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn2&quot;&gt;Django&#26631;&#20934;&#24211;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;Django&#30340;&#26631;&#20934;&#24211;&#23384;&#25918;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt; &#21253;&#20013;&#12290;&#27599;&#20010;&#23376;&#21253;&#37117;&#26159;&#19968;&#20010;&#29420;&#31435;&#30340;&#38468;&#21152;&#21151;&#33021;&#21253;&#12290; &#36825;&#20123;&#23376;&#21253;&#19968;&#33324;&#26159;&#20114;&#30456;&#29420;&#31435;&#30340;&#65292;&#19981;&#36807;&#26377;&#20123;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt;&#23376;&#21253;&#38656;&#35201;&#20381;&#36182;&#20854;&#20182;&#23376;&#21253;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt; &#20013;&#23545;&#20989;&#25968;&#30340;&#31867;&#22411;&#24182;&#27809;&#26377;&#24378;&#21046;&#35201;&#27714; &#12290;&#20854;&#20013;&#19968;&#20123;&#21253;&#20013;&#24102;&#26377;&#27169;&#22411;&#65288;&#22240;&#27492;&#38656;&#35201;&#20320;&#22312;&#25968;&#25454;&#24211;&#20013;&#23433;&#35013;&#23545;&#24212;&#30340;&#25968;&#25454;&#34920;&#65289;&#65292;&#20294;&#20854;&#23427;&#19968;&#20123;&#30001;&#29420;&#31435;&#30340;&#20013;&#38388;&#20214;&#21450;&#27169;&#26495;&#26631;&#31614;&#32452;&#25104;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt; &#24320;&#21457;&#21253;&#20849;&#26377;&#30340;&#29305;&#24615;&#26159;: &#23601;&#31639;&#20320;&#23558;&#25972;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt;&#24320;&#21457;&#21253;&#21024;&#38500;&#65292;&#20320;&#20381;&#28982;&#21487;&#20197;&#20351;&#29992; Django &#30340;&#22522;&#30784;&#21151;&#33021;&#32780;&#19981;&#20250;&#36935;&#21040;&#20219;&#20309;&#38382;&#39064;&#12290; &#24403; Django &#24320;&#21457;&#32773;&#21521;&#26694;&#26550;&#22686;&#21152;&#26032;&#21151;&#33021;&#30340;&#26102;&#65292;&#20182;&#20204;&#20250;&#20005;&#26684;&#26681;&#25454;&#36825;&#19968;&#21407;&#21017;&#26469;&#20915;&#23450;&#26159;&#21542;&#25226;&#26032;&#21151;&#33021;&#25918;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt; &#30001;&#20197;&#19979;&#24320;&#21457;&#21253;&#32452;&#25104;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn7&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;admin&lt;/span&gt;&lt;/tt&gt; : &#33258;&#21160;&#21270;&#30340;&#31449;&#28857;&#31649;&#29702;&#24037;&#20855;&#12290; &#35831;&#26597;&#30475;&#31532;6&#31456;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn8&quot;&gt; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;admindocs&lt;/span&gt;&lt;/tt&gt;:&#20026;Django admin&#31449;&#28857;&#25552;&#20379;&#33258;&#21160;&#25991;&#26723;&#12290; &#26412;&#20070;&#27809;&#26377;&#20171;&#32461;&#36825;&#26041;&#38754;&#30340;&#30693;&#35782;&#65307;&#35814;&#24773;&#35831;&#21442;&#38405;Django&#23448;&#26041;&#25991;&#26723;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn9&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;auth&lt;/span&gt;&lt;/tt&gt; : Django&#30340;&#29992;&#25143;&#39564;&#35777;&#26694;&#26550;&#12290; &#21442;&#35265;&#31532;&#21313;&#22235;&#31456;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn10&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;comments&lt;/span&gt;&lt;/tt&gt; : &#19968;&#20010;&#35780;&#35770;&#24212;&#29992;&#65292;&#30446;&#21069;&#65292;&#36825;&#20010;&#24212;&#29992;&#27491;&#22312;&#32039;&#24352;&#30340;&#24320;&#21457;&#20013;&#65292;&#22240;&#27492;&#22312;&#26412;&#20070;&#20986;&#29256;&#30340;&#26102;&#20505;&#36824;&#19981;&#33021;&#32473;&#20986;&#19968;&#20010;&#23436;&#25972;&#30340;&#35828;&#26126;&#65292;&#20851;&#20110;&#36825;&#20010;&#24212;&#29992;&#30340;&#26356;&#22810;&#20449;&#24687;&#35831;&#21442;&#35265;Django&#30340;&#23448;&#26041;&#32593;&#31449;. &#26412;&#20070;&#27809;&#26377;&#20171;&#32461;&#36825;&#26041;&#38754;&#30340;&#30693;&#35782;&#65307;&#35814;&#24773;&#35831;&#21442;&#38405;Django&#23448;&#26041;&#25991;&#26723;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn11&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;contenttypes&lt;/span&gt;&lt;/tt&gt; : &#36825;&#26159;&#19968;&#20010;&#29992;&#20110;&#24341;&#20837;&#25991;&#26723;&#31867;&#22411;&#30340;&#26694;&#26550;&#65292;&#27599;&#20010;&#23433;&#35013;&#30340;Django&#27169;&#22359;&#20316;&#20026;&#19968;&#31181;&#29420;&#31435;&#30340;&#25991;&#26723;&#31867;&#22411;&#12290; &#36825;&#20010;&#26694;&#26550;&#20027;&#35201;&#22312;Django&#20869;&#37096;&#34987;&#20854;&#20182;&#24212;&#29992;&#20351;&#29992;&#65292;&#23427;&#20027;&#35201;&#38754;&#21521;Django&#30340;&#39640;&#32423;&#24320;&#21457;&#32773;&#12290; &#21487;&#20197;&#36890;&#36807;&#38405;&#35835;&#28304;&#30721;&#26469;&#20102;&#35299;&#20851;&#20110;&#36825;&#20010;&#26694;&#26550;&#30340;&#26356;&#22810;&#20449;&#24687;&#65292;&#28304;&#30721;&#30340;&#20301;&#32622;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django/contrib/contenttypes/&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn12&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn12&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csrf&lt;/span&gt;&lt;/tt&gt; : &#36825;&#20010;&#27169;&#22359;&#29992;&#26469;&#38450;&#24481;&#36328;&#31449;&#35831;&#27714;&#20266;&#36896;(CSRF)&#12290;&#21442; &#35265;&#21518;&#38754;&#26631;&#39064;&#20026;&#8221;CSRF &#38450;&#24481;&#8221;&#30340;&#23567;&#33410;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn13&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;databrowse&lt;/span&gt;&lt;/tt&gt;&#65306;&#24110;&#21161;&#20320;&#27983;&#35272;&#25968;&#25454;&#30340;Django&#24212;&#29992;&#12290; &#26412;&#20070;&#27809;&#26377;&#20171;&#32461;&#36825;&#26041;&#38754;&#30340;&#30693;&#35782;&#65307;&#35814;&#24773;&#35831;&#21442;&#38405;Django&#23448;&#26041;&#25991;&#26723;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn14&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpages&lt;/span&gt;&lt;/tt&gt; : &#19968;&#20010;&#22312;&#25968;&#25454;&#24211;&#20013;&#31649;&#29702;&#21333;&#19968;HTML&#20869;&#23481;&#30340;&#27169;&#22359;&#12290; &#21442;&#35265;&#21518;&#38754;&#26631;&#39064;&#20026;&#8220;Flatpages&#8221;&#30340;&#23567;&#33410;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn15&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;formtools&lt;/span&gt;&lt;/tt&gt;&#65306;&#19968;&#20123;&#21015;&#22788;&#29702;&#34920;&#21333;&#36890;&#29992;&#27169;&#24335;&#30340;&#39640;&#32423;&#24211;&#12290; &#26412;&#20070;&#27809;&#26377;&#20171;&#32461;&#36825;&#26041;&#38754;&#30340;&#30693;&#35782;&#65307;&#35814;&#24773;&#35831;&#21442;&#38405;Django&#23448;&#26041;&#25991;&#26723;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn16&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gis&lt;/span&gt;&lt;/tt&gt;&#65306;&#20026;Django&#25552;&#20379;GIS&#65288;Geographic Information Systems&#65289;&#25903;&#25345;&#30340;&#25193;&#23637;&#12290; &#20030;&#20010;&#20363;&#23376;&#65292;&#23427;&#20801;&#35768;&#20320;&#30340;Django&#27169;&#22411;&#20445;&#23384;&#22320;&#29702;&#23398;&#25968;&#25454;&#24182;&#25191;&#34892;&#22320;&#29702;&#23398;&#26597;&#35810;&#12290; &#36825;&#20010;&#24211;&#27604;&#36739;&#22797;&#26434;&#65292;&#26412;&#20070;&#19981;&#35814;&#32454;&#20171;&#32461;&#12290; &#35831;&#21442;&#30475;&lt;a class=&quot;reference external&quot; href=&quot;http://geodjango.org/&quot;&gt;http://geodjango.org/&lt;/a&gt;&#19978;&#30340;&#25991;&#26723;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn17&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;humanize&lt;/span&gt;&lt;/tt&gt; : &#19968;&#31995;&#21015; Django &#27169;&#22359;&#36807;&#28388;&#22120;&#65292;&#29992;&#20110;&#22686;&#21152;&#25968;&#25454;&#30340;&#20154;&#24615;&#21270;&#12290;
&#21442;&#38405;&#31245;&#21518;&#30340;&#31456;&#33410;&#12298;&#20154;&#24615;&#21270;&#25968;&#25454;&#12299;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn18&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;localflavor&lt;/span&gt;&lt;/tt&gt;&#65306;&#38024;&#23545;&#19981;&#21516;&#22269;&#23478;&#21644;&#25991;&#21270;&#30340;&#28151;&#26434;&#20195;&#30721;&#27573;&#12290; &#20363;&#22914;&#65292;&#23427;&#21253;&#21547;&#20102;&#39564;&#35777;&#32654;&#22269;&#30340;&#37038;&#32534; &#20197;&#21450;&#29233;&#23572;&#20848;&#30340;&#36523;&#20221;&#35777;&#21495;&#30340;&#26041;&#27861;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn19&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;markup&lt;/span&gt;&lt;/tt&gt; : &#19968;&#31995;&#21015;&#30340; Django &#27169;&#26495;&#36807;&#28388;&#22120;&#65292;&#29992;&#20110;&#23454;&#29616;&#19968;&#20123;&#24120;&#29992;&#26631;&#35760;&#35821;&#35328;&#12290; &#21442;&#38405;&#21518;&#32493;&#31456;&#33410;&#12298;&#26631;&#35760;&#36807;&#28388;&#22120;&#12299;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn20&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;redirects&lt;/span&gt;&lt;/tt&gt; : &#29992;&#26469;&#31649;&#29702;&#37325;&#23450;&#21521;&#30340;&#26694;&#26550;&#12290; &#21442;&#30475;&#21518;&#38754;&#30340;&#8220;&#37325;&#23450;&#21521;&#8221;&#23567;&#33410;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn21&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sessions&lt;/span&gt;&lt;/tt&gt; : Django &#30340;&#20250;&#35805;&#26694;&#26550;&#12290; &#21442;&#35265;14&#31456;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn22&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemaps&lt;/span&gt;&lt;/tt&gt; : &#29992;&#26469;&#29983;&#25104;&#32593;&#31449;&#22320;&#22270;&#30340; XML &#25991;&#20214;&#30340;&#26694;&#26550;&#12290; &#21442;&#35265;13&#31456;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn23&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sites&lt;/span&gt;&lt;/tt&gt; : &#19968;&#20010;&#35753;&#20320;&#21487;&#20197;&#22312;&#21516;&#19968;&#20010;&#25968;&#25454;&#24211;&#19982; Django &#23433;&#35013;&#20013;&#31649;&#29702;&#22810;&#20010;&#32593;&#31449;&#30340;&#26694;&#26550;&#12290; &#21442;&#35265;&#19979;&#19968;&#33410;&#65306;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn24&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;syndication&lt;/span&gt;&lt;/tt&gt; : &#19968;&#20010;&#29992; RSS &#21644; Atom &#26469;&#29983;&#25104;&#32858;&#21512;&#35746;&#38405;&#28304;&#30340;&#30340;&#26694;&#26550;&#12290; &#21442;&#35265;13&#31456;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn25&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;webdesign&lt;/span&gt;&lt;/tt&gt;&#65306;&#23545;&#35774;&#35745;&#32773;&#38750;&#24120;&#26377;&#29992;&#30340;Django&#25193;&#23637;&#12290; &#21040;&#32534;&#20889;&#27492;&#25991;&#26102;&#65292;&#23427;&#21482;&#21253;&#21547;&#19968;&#20010;&#27169;&#26495;&#26631;&#31614;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;lorem&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#12290;&#35814;&#24773;&#21442;&#38405;Django&#25991;&#26723;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&#26412;&#31456;&#25509;&#19979;&#26469;&#23558;&#35814;&#32454;&#25551;&#36848;&#21069;&#38754;&#27809;&#26377;&#20171;&#32461;&#36807;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib&lt;/span&gt;&lt;/tt&gt; &#24320;&#21457;&#21253;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id1&quot;&gt;
&lt;span id=&quot;cn27&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&#22810;&#20010;&#31449;&#28857;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn28&quot;&gt;Django &#30340;&#22810;&#31449;&#28857;&#31995;&#32479;&#26159;&#19968;&#31181;&#36890;&#29992;&#26694;&#26550;&#65292;&#23427;&#35753;&#20320;&#21487;&#20197;&#22312;&#21516;&#19968;&#20010;&#25968;&#25454;&#24211;&#21644;&#21516;&#19968;&#20010;Django&#39033;&#30446;&#19979;&#25805;&#20316;&#22810;&#20010;&#32593;&#31449;&#12290; &#36825;&#26159;&#19968;&#20010;&#25277;&#35937;&#27010;&#24565;&#65292;&#29702;&#35299;&#36215;&#26469;&#21487;&#33021;&#26377;&#28857;&#22256;&#38590;&#65292;&#22240;&#27492;&#25105;&#20204;&#20174;&#20960;&#20010;&#35753;&#23427;&#33021;&#27966;&#19978;&#29992;&#22330;&#30340;&#23454;&#38469;&#24773;&#26223;&#20837;&#25163;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn29&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#24773;&#26223;1&#65306;&#22810;&#31449;&#28857;&#38388;&#22797;&#29992;&#25968;&#25454;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#27491;&#22914;&#25105;&#20204;&#22312;&#31532;&#19968;&#31456;&#37324;&#25152;&#35762;&#65292;Django &#26500;&#24314;&#30340;&#32593;&#31449; LJWorld.com &#21644; Lawrance.com &#26159;&#29992;&#30001;&#21516;&#19968;&#20010;&#26032;&#38395;&#32452;&#32455;&#25511;&#21046;&#30340;&#65306; &#32943;&#33832;&#26031;&#24030;&#21171;&#20262;&#26031;&#24066;&#30340; &lt;em&gt;&#21171;&#20262;&#26031;&#26085;&#25253;&#19990;&#30028;&lt;/em&gt; &#25253;&#32440;&#12290; LJWorld.com &#20027;&#35201;&#20570;&#26032;&#38395;&#65292;&#32780; Lawrence.com &#20851;&#27880;&#26412;&#22320;&#23089;&#20048;&#12290; &#28982;&#32780;&#26377;&#26102;&#65292;&#32534;&#36753;&#21487;&#33021;&#38656;&#35201;&#25226;&#19968;&#31687;&#25991;&#31456;&#21457;&#24067;&#21040; &lt;em&gt;&#20004;&#20010;&lt;/em&gt; &#32593;&#31449;&#19978;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#35299;&#20915;&#27492;&#38382;&#39064;&#30340;&#27515;&#33041;&#31563;&#26041;&#27861;&#21487;&#33021;&#26159;&#20351;&#29992;&#27599;&#20010;&#31449;&#28857;&#20998;&#21035;&#20351;&#29992;&#19981;&#21516;&#30340;&#25968;&#25454;&#24211;&#65292;&#28982;&#21518;&#35201;&#27714;&#31449;&#28857;&#32500;&#25252;&#32773;&#25226;&#21516;&#19968;&#31687;&#25991;&#31456;&#21457;&#24067;&#20004;&#27425;&#65306; &#19968;&#27425;&#20026; LJWorld.com&#65292;&#21478;&#19968;&#27425;&#20026;Lawrence.com&#12290; &#20294;&#36825;&#23545;&#31449;&#28857;&#31649;&#29702;&#21592;&#26469;&#35828;&#26159;&#20302;&#25928;&#29575;&#30340;&#65292;&#32780;&#19988;&#20026;&#21516;&#19968;&#31687;&#25991;&#31456;&#22312;&#25968;&#25454;&#24211;&#37324;&#20445;&#30041;&#22810;&#20010;&#21103;&#26412;&#20063;&#26174;&#24471;&#22810;&#20313;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#26356;&#22909;&#30340;&#35299;&#20915;&#26041;&#26696;&#65311; &#20004;&#20010;&#32593;&#31449;&#29992;&#30340;&#26159;&#21516;&#19968;&#20010;&#25991;&#31456;&#25968;&#25454;&#24211;&#65292;&#24182;&#23558;&#27599;&#19968;&#31687;&#25991;&#31456;&#19982;&#19968;&#20010;&#25110;&#22810;&#20010;&#31449;&#28857;&#29992;&#22810;&#23545;&#22810;&#20851;&#31995;&#20851;&#32852;&#36215;&#26469;&#12290; Django &#31449;&#28857;&#26694;&#26550;&#25552;&#20379;&#25968;&#25454;&#24211;&#34920;&#26469;&#35760;&#36733;&#21738;&#20123;&#25991;&#31456;&#21487;&#20197;&#34987;&#20851;&#32852;&#12290; &#23427;&#26159;&#19968;&#20010;&#25226;&#25968;&#25454;&#19982;&#19968;&#20010;&#25110;&#22810;&#20010;&#31449;&#28857;&#20851;&#32852;&#36215;&#26469;&#30340;&#38057;&#23376;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn33&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#24773;&#26223;2&#65306;&#25226;&#32593;&#31449;&#30340;&#21517;&#23383;/&#22495;&#21517;&#20445;&#23384;&#22312;&#19968;&#20010;&#22320;&#26041;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;LJWorld.com &#21644; Lawrence.com &#37117;&#26377;&#37038;&#20214;&#25552;&#37266;&#21151;&#33021;&#65292;&#20351;&#35835;&#32773;&#27880;&#20876;&#21518;&#21487;&#20197;&#22312;&#26032;&#38395;&#21457;&#29983;&#21518;&#31435;&#21363;&#25910;&#21040;&#36890;&#30693;&#12290; &#36825;&#26159;&#19968;&#31181;&#23436;&#32654;&#30340;&#30340;&#26426;&#21046;&#65306; &#26576;&#35835;&#32773;&#25552;&#20132;&#20102;&#27880;&#20876;&#34920;&#21333;&#65292;&#28982;&#21518;&#39532;&#19978;&#23601;&#21463;&#21040;&#19968;&#23553;&#20869;&#23481;&#26159;&#8220;&#24863;&#35874;&#24744;&#30340;&#27880;&#20876;&#8221;&#30340;&#37038;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#25226;&#36825;&#20010;&#27880;&#20876;&#36807;&#31243;&#30340;&#20195;&#30721;&#23454;&#29616;&#20004;&#36941;&#26174;&#28982;&#26159;&#20302;&#25928;&#12289;&#22810;&#20313;&#30340;&#65292;&#22240;&#27492;&#20004;&#20010;&#31449;&#28857;&#22312;&#21518;&#21488;&#20351;&#29992;&#30456;&#21516;&#30340;&#20195;&#30721;&#12290; &#20294;&#24863;&#35874;&#27880;&#20876;&#30340;&#36890;&#30693;&#22312;&#20004;&#20010;&#32593;&#31449;&#20013;&#38656;&#35201;&#19981;&#21516;&#12290; &#36890;&#36807;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#25105;&#20204;&#36890;&#36807;&#20351;&#29992;&#24403;&#21069;&#31449;&#28857;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt; (&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;LJWorld.com&apos;&lt;/span&gt;&lt;/tt&gt; )&#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;domain&lt;/span&gt;&lt;/tt&gt; (&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;www.ljworld.com&apos;&lt;/span&gt;&lt;/tt&gt; )&#21487;&#20197;&#25226;&#24863;&#35874;&#36890;&#30693;&#25277;&#25552;&#20986;&#26469;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn36&quot;&gt;Django &#30340;&#22810;&#31449;&#28857;&#26694;&#26550;&#20026;&#20320;&#25552;&#20379;&#20102;&#19968;&#20010;&#20301;&#32622;&#26469;&#23384;&#20648; Django &#39033;&#30446;&#20013;&#27599;&#20010;&#31449;&#28857;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;domain&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#24847;&#21619;&#30528;&#20320;&#21487;&#20197;&#29992;&#21516;&#26679;&#30340;&#26041;&#27861;&#26469;&#37325;&#29992;&#36825;&#20123;&#20540;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn37&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#22914;&#20309;&#20351;&#29992;&#22810;&#31449;&#28857;&#26694;&#26550;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#22810;&#31449;&#28857;&#26694;&#26550;&#19982;&#20854;&#35828;&#26159;&#19968;&#20010;&#26694;&#26550;&#65292;&#19981;&#22914;&#35828;&#26159;&#19968;&#31995;&#21015;&#32422;&#23450;&#12290; &#25152;&#26377;&#30340;&#19968;&#20999;&#37117;&#22522;&#20110;&#20004;&#20010;&#31616;&#21333;&#30340;&#27010;&#24565;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn39&quot;&gt;&#20301;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sites&lt;/span&gt;&lt;/tt&gt; &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#27169;&#22411;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;domain&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt; &#20004;&#20010;&#23383;&#27573;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn40&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn40&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#25351;&#23450;&#20102;&#19982;&#29305;&#23450;&#37197;&#32622;&#25991;&#20214;&#30456;&#20851;&#32852;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#20043;&#25968;&#25454;&#24211; ID&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#22914;&#20309;&#36816;&#29992;&#36825;&#20004;&#20010;&#27010;&#24565;&#30001;&#20320;&#20915;&#23450;&#65292;&#20294; Django &#26159;&#36890;&#36807;&#20960;&#20010;&#31616;&#21333;&#30340;&#32422;&#23450;&#33258;&#21160;&#20351;&#29992;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#23433;&#35013;&#22810;&#31449;&#28857;&#24212;&#29992;&#35201;&#25191;&#34892;&#20197;&#19979;&#20960;&#20010;&#27493;&#39588;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn43&quot;&gt;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.sites&apos;&lt;/span&gt;&lt;/tt&gt; &#21152;&#20837;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#20013;&#12290;&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn44&quot;&gt;&#36816;&#34892; &lt;cite&gt;manage.py syncdb&lt;/cite&gt; &#21629;&#20196;&#23558; &lt;cite&gt;django_site&lt;/cite&gt; &#34920;&#23433;&#35013;&#21040;&#25968;&#25454;&#24211;&#20013;&#12290; &#36825;&#26679;&#20063;&#20250;&#24314;&#31435;&#40664;&#35748;&#30340;&#31449;&#28857;&#23545;&#35937;&#65292;&#22495;&#21517;&#20026; example.com&#12290;&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn45&quot;&gt;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com&lt;/span&gt;&lt;/tt&gt;&#25913;&#25104;&#20320;&#33258;&#24049;&#30340;&#22495;&#21517;&#65292;&#28982;&#21518;&#36890;&#36807;Django admin&#31449;&#28857;&#25110;Python API&#26469;&#28155;&#21152;&#20854;&#20182;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#12290; &#20026;&#35813; Django &#39033;&#30446;&#25903;&#25745;&#30340;&#27599;&#20010;&#31449;&#65288;&#25110;&#22495;&#65289;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290;&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;4&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn46&quot;&gt;&#22312;&#27599;&#20010;&#35774;&#32622;&#25991;&#20214;&#20013;&#23450;&#20041;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#12290; &#35813;&#21464;&#37327;&#20540;&#24212;&#24403;&#26159;&#35813;&#35774;&#32622;&#25991;&#20214;&#25152;&#25903;&#25745;&#30340;&#31449;&#28857;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#30340;&#25968;&#25454;&#24211; ID&#12290;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn47&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#22810;&#31449;&#28857;&#26694;&#26550;&#30340;&#21151;&#33021;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#19979;&#38754;&#20960;&#33410;&#35762;&#36848;&#30340;&#26159;&#29992;&#22810;&#31449;&#28857;&#26694;&#26550;&#33021;&#22815;&#23436;&#25104;&#30340;&#20960;&#39033;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn49&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#22810;&#20010;&#31449;&#28857;&#30340;&#25968;&#25454;&#37325;&#29992;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#27491;&#22914;&#22312;&#24773;&#26223;&#19968;&#20013;&#25152;&#35299;&#37322;&#30340;&#65292;&#35201;&#22312;&#22810;&#20010;&#31449;&#28857;&#38388;&#37325;&#29992;&#25968;&#25454;,&#20165;&#38656;&#22312;&#27169;&#22411;&#20013;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#28155;&#21152;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#22810;&#23545;&#22810;&#23383;&#27573;&lt;/span&gt;&lt;/tt&gt; &#21363;&#21487;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn52&quot;&gt;from django.db import models
from django.contrib.sites.models import Site

class Article(models.Model):
    headline = models.CharField(max_length=200)
    # ...
    sites = models.ManyToManyField(Site)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#36825;&#26159;&#22312;&#25968;&#25454;&#24211;&#20013;&#20026;&#22810;&#20010;&#31449;&#28857;&#36827;&#34892;&#25991;&#31456;&#20851;&#32852;&#25805;&#20316;&#30340;&#22522;&#30784;&#27493;&#39588;&#12290;
&#22312;&#36866;&#24403;&#30340;&#20301;&#32622;&#20351;&#29992;&#35813;&#25216;&#26415;&#65292;&#20320;&#21487;&#20197;&#22312;&#22810;&#20010;&#31449;&#28857;&#20013;&#37325;&#22797;&#20351;&#29992;&#21516;&#19968;&#27573; Django &#35270;&#22270;&#20195;&#30721;&#12290; &#32487;&#32493; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Article&lt;/span&gt;&lt;/tt&gt; &#27169;&#22411;&#33539;&#20363;&#65292;&#19979;&#38754;&#26159;&#19968;&#20010;&#21487;&#33021;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;article_detail&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn55&quot;&gt;from django.conf import settings
from django.shortcuts import get_object_or_404
from mysite.articles.models import Article

def article_detail(request, article_id):
    a = get_object_or_404(Article, id=article_id, sites__id=settings.SITE_ID)
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#35813;&#35270;&#22270;&#26041;&#27861;&#26159;&#21487;&#37325;&#29992;&#30340;&#65292;&#22240;&#20026;&#23427;&#26681;&#25454; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#30340;&#20540;&#21160;&#24577;&#26816;&#26597; articles &#31449;&#28857;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#20363;&#22914;&#65292; LJWorld.coms &#35774;&#32622;&#25991;&#20214;&#20013;&#26377;&#26377;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;1&lt;/span&gt;&lt;/tt&gt; &#65292;&#32780; Lawrence.coms &#35774;&#32622;&#25991;&#20214;&#20013;&#26377;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;2&lt;/span&gt;&lt;/tt&gt; &#12290;&#22914;&#26524;&#35813;&#35270;&#22270;&#22312; LJWorld.coms &#22788;&#20110;&#28608;&#27963;&#29366;&#24577;&#26102;&#34987;&#35843;&#29992;&#65292;&#37027;&#20040;&#23427;&#23558;&#25226;&#26597;&#25214;&#33539;&#22260;&#23616;&#38480;&#20110;&#31449;&#28857;&#21015;&#34920;&#21253;&#25324; LJWorld.com &#22312;&#20869;&#30340;&#25991;&#31456;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn58&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&#23558;&#20869;&#23481;&#19982;&#21333;&#19968;&#31449;&#28857;&#30456;&#20851;&#32852;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#21516;&#26679;&#65292;&#20320;&#20063;&#21487;&#20197;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#22806;&#38190;&lt;/span&gt;&lt;/tt&gt; &#22312;&#22810;&#23545;&#19968;&#20851;&#31995;&#20013;&#23558;&#19968;&#20010;&#27169;&#22411;&#20851;&#32852;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#27169;&#22411;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#20030;&#20363;&#26469;&#35828;&#65292;&#22914;&#26524;&#26576;&#31687;&#25991;&#31456;&#20165;&#20165;&#33021;&#22815;&#20986;&#29616;&#22312;&#19968;&#20010;&#31449;&#28857;&#19978;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#19979;&#38754;&#36825;&#26679;&#30340;&#27169;&#22411;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn62&quot;&gt;from django.db import models
from django.contrib.sites.models import Site

class Article(models.Model):
    headline = models.CharField(max_length=200)
    # ...
    site = models.ForeignKey(Site)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#36825;&#19982;&#21069;&#19968;&#33410;&#20013;&#20171;&#32461;&#30340;&#19968;&#26679;&#26377;&#30410;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn64&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#20174;&#35270;&#22270;&#38057;&#25346;&#24403;&#21069;&#31449;&#28857;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#22312;&#24213;&#23618;&#65292;&#36890;&#36807;&#22312; Django &#35270;&#22270;&#20013;&#20351;&#29992;&#22810;&#31449;&#28857;&#26694;&#26550;&#65292;&#20320;&#21487;&#20197;&#35753;&#35270;&#22270;&#26681;&#25454;&#35843;&#29992;&#31449;&#28857;&#19981;&#21516;&#32780;&#23436;&#25104;&#19981;&#21516;&#30340;&#24037;&#20316;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn67&quot;&gt;from django.conf import settings

def my_view(request):
    if settings.SITE_ID == 3:
        # Do something.
    else:
        # Do something else.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#24403;&#28982;&#65292;&#20687;&#37027;&#26679;&#23545;&#31449;&#28857; ID &#36827;&#34892;&#30828;&#32534;&#30721;&#26159;&#27604;&#36739;&#38590;&#30475;&#30340;&#12290; &#30053;&#20026;&#31616;&#27905;&#30340;&#23436;&#25104;&#26041;&#24335;&#26159;&#26597;&#30475;&#24403;&#21069;&#30340;&#31449;&#28857;&#22495;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn70&quot;&gt;from django.conf import settings
from django.contrib.sites.models import Site

def my_view(request):
    current_site = Site.objects.get(id=settings.SITE_ID)
    if current_site.domain == &apos;foo.com&apos;:
        # Do something
    else:
        # Do something else.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#20174; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#20013;&#33719;&#21462; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;settings.SITE_ID&lt;/span&gt;&lt;/tt&gt; &#20540;&#30340;&#20570;&#27861;&#27604;&#36739;&#24120;&#35265;&#65292;&#22240;&#27492; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#27169;&#22411;&#31649;&#29702;&#22120; (&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site.objects&lt;/span&gt;&lt;/tt&gt; ) &#20855;&#22791;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_current()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#12290;
&#19979;&#38754;&#30340;&#20363;&#23376;&#19982;&#21069;&#19968;&#20010;&#26159;&#31561;&#25928;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn73&quot;&gt;from django.contrib.sites.models import Site

def my_view(request):
    current_site = Site.objects.get_current()
    if current_site.domain == &apos;foo.com&apos;:
        # Do something
    else:
        # Do something else.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#22312;&#36825;&#20010;&#26368;&#21518;&#30340;&#20363;&#23376;&#37324;&#65292;&#20320;&#19981;&#29992;&#23548;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.conf.settings&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn76&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#33719;&#21462;&#24403;&#21069;&#22495;&#29992;&#20110;&#21576;&#29616;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#27491;&#22914;&#24773;&#26223;&#20108;&#20013;&#25152;&#35299;&#37322;&#30340;&#37027;&#26679;&#65292;&#20381;&#25454;DRY&#21407;&#21017;(&#19981;&#20570;&#37325;&#22797;&#24037;&#20316;)&#65292;&#20320;&#21482;&#38656;&#22312;&#19968;&#20010;&#20301;&#32622;&#20648;&#23384;&#31449;&#21517;&#21644;&#22495;&#21517;&#65292;&#28982;&#21518;&#24341;&#29992;&#24403;&#21069; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;domain&lt;/span&gt;&lt;/tt&gt; &#12290;&#20363;&#22914;&#65306; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn79&quot;&gt;from django.contrib.sites.models import Site
from django.core.mail import send_mail

def register_for_newsletter(request):
    # Check form values, etc., and subscribe the user.
    # ...
    current_site = Site.objects.get_current()
    send_mail(&apos;Thanks for subscribing to %s alerts&apos; % current_site.name,
        &apos;Thanks for your subscription. We appreciate it.\n\n-The %s team.&apos; % current_site.name,
        &apos;editor@%s&apos; % current_site.domain,
        [user_email])
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#32487;&#32493;&#25105;&#20204;&#27491;&#22312;&#35752;&#35770;&#30340; LJWorld.com &#21644; Lawrence.com &#20363;&#23376;&#65292;&#22312;Lawrence.com &#35813;&#37038;&#20214;&#30340;&#26631;&#39064;&#34892;&#26159;&#8220;&#24863;&#35874;&#27880;&#20876; Lawrence.com &#25552;&#37266;&#20449;&#20214;&#8221;&#12290; &#22312; LJWorld.com &#65292;&#35813;&#37038;&#20214;&#26631;&#39064;&#34892;&#26159;&#8220;&#24863;&#35874;&#27880;&#20876; LJWorld.com &#25552;&#37266;&#20449;&#20214;&#8221;&#12290; &#36825;&#31181;&#31449;&#28857;&#20851;&#32852;&#34892;&#20026;&#26041;&#24335;&#23545;&#37038;&#20214;&#20449;&#24687;&#20027;&#20307;&#20063;&#21516;&#26679;&#36866;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#23436;&#25104;&#36825;&#39033;&#24037;&#20316;&#30340;&#19968;&#31181;&#26356;&#21152;&#28789;&#27963;&#65288;&#20294;&#26356;&#37325;&#37327;&#32423;&#65289;&#30340;&#26041;&#27861;&#26159;&#20351;&#29992; Django &#30340;&#27169;&#26495;&#31995;&#32479;&#12290; &#20551;&#23450; Lawrence.com &#21644; LJWorld.com &#21508;&#33258;&#25317;&#26377;&#19981;&#21516;&#30340;&#27169;&#26495;&#30446;&#24405;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_DIRS&lt;/span&gt;&lt;/tt&gt; &#65289;&#65292;&#20320;&#21487;&#23558;&#24037;&#20316;&#36731;&#26494;&#22320;&#36716;&#20132;&#32473;&#27169;&#26495;&#31995;&#32479;&#65292;&#22914;&#19979;&#25152;&#31034;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn83&quot;&gt;from django.core.mail import send_mail
from django.template import loader, Context

def register_for_newsletter(request):
    # Check form values, etc., and subscribe the user.
    # ...
    subject = loader.get_template(&apos;alerts/subject.txt&apos;).render(Context({}))
    message = loader.get_template(&apos;alerts/message.txt&apos;).render(Context({}))
    send_mail(subject, message, &apos;do-not-reply@example.com&apos;, [user_email])
    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#26412;&#20363;&#20013;&#65292;&#20320;&#19981;&#24471;&#19981;&#22312; LJWorld.com &#21644; Lawrence.com &#30340;&#27169;&#26495;&#30446;&#24405;&#20013;&#37117;&#21019;&#24314;&#19968;&#20221; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;subject.txt&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;message.txt&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#12290; &#27491;&#22914;&#20043;&#21069;&#25152;&#35828;&#65292;&#35813;&#26041;&#27861;&#24102;&#26469;&#20102;&#26356;&#22823;&#30340;&#28789;&#27963;&#24615;&#65292;&#20294;&#20063;&#24102;&#26469;&#20102;&#26356;&#22810;&#22797;&#26434;&#24615;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&#23613;&#21487;&#33021;&#22810;&#30340;&#21033;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#26159;&#20943;&#23569;&#19981;&#24517;&#35201;&#30340;&#22797;&#26434;&#12289;&#20887;&#20313;&#24037;&#20316;&#30340;&#22909;&#21150;&#27861;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn86&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#24403;&#21069;&#31449;&#28857;&#31649;&#29702;&#22120;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#31449;&#28857;&lt;/span&gt;&lt;/tt&gt; &#22312;&#20320;&#30340;&#24212;&#29992;&#20013;&#25198;&#28436;&#24456;&#37325;&#35201;&#30340;&#35282;&#33394;&#65292;&#35831;&#32771;&#34385;&#22312;&#20320;&#30340;&#27169;&#22411;&#20013;&#20351;&#29992;&#26041;&#20415;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentSiteManager&lt;/span&gt;&lt;/tt&gt; &#12290; &#36825;&#26159;&#19968;&#20010;&#27169;&#22411;&#31649;&#29702;&#22120;&#65288;&#35265;&#31532;&#21313;&#31456;&#65289;&#65292;&#23427;&#20250;&#33258;&#21160;&#36807;&#28388;&#20351;&#20854;&#21482;&#21253;&#21547;&#19982;&#24403;&#21069;&#31449;&#28857;&#30456;&#20851;&#32852;&#30340;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#36890;&#36807;&#26174;&#31034;&#22320;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentSiteManager&lt;/span&gt;&lt;/tt&gt; &#21152;&#20837;&#27169;&#22411;&#20013;&#20197;&#20351;&#29992;&#23427;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn90&quot;&gt;from django.db import models
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager

class Photo(models.Model):
    photo = models.FileField(upload_to=&apos;/home/photos&apos;)
    photographer_name = models.CharField(max_length=100)
    pub_date = models.DateField()
    site = models.ForeignKey(Site)
    objects = models.Manager()
    on_site = CurrentSiteManager()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#36890;&#36807;&#35813;&#27169;&#22411;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Photo.objects.all()&lt;/span&gt;&lt;/tt&gt; &#23558;&#36820;&#22238;&#25968;&#25454;&#24211;&#20013;&#25152;&#26377;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Photo&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Photo.on_site.all()&lt;/span&gt;&lt;/tt&gt; &#20165;&#26681;&#25454; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#36820;&#22238;&#19982;&#24403;&#21069;&#31449;&#28857;&#30456;&#20851;&#32852;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Photo&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#25442;&#35328;&#20043;&#65292;&#20197;&#19979;&#20004;&#26465;&#35821;&#21477;&#26159;&#31561;&#25928;&#30340;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn94&quot;&gt;Photo.objects.filter(site=settings.SITE_ID)
Photo.on_site.all()
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentSiteManager&lt;/span&gt;&lt;/tt&gt; &#26159;&#22914;&#20309;&#30693;&#36947; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Photo&lt;/span&gt;&lt;/tt&gt; &#30340;&#21738;&#20010;&#23383;&#27573;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#21602;&#65311;&#32570;&#30465;&#24773;&#20917;&#19979;&#65292;&#23427;&#20250;&#26597;&#25214;&#19968;&#20010;&#21483;&#20570; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;site&lt;/span&gt;&lt;/tt&gt; &#30340;&#23383;&#27573;&#12290;&#22914;&#26524;&#20320;&#30340;&#27169;&#22411;&#21253;&#21547;&#20102;&#21517;&#23383;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#19981;&#26159;&lt;/span&gt;&lt;/tt&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;site&lt;/span&gt;&lt;/tt&gt;&#30340;&lt;em&gt;&#22806;&#38190;&lt;/em&gt;&#25110;&#32773;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#22810;&#23545;&#22810;&lt;/span&gt;&lt;/tt&gt;&#20851;&#32852;&#65292;&#20320;&#38656;&#35201;&#25226;&#23427;&#20316;&#20026;&#21442;&#25968;&#20256;&#32473;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentSiteManager&lt;/span&gt;&lt;/tt&gt;&#20197;&#26174;&#31034;&#25351;&#26126;&#12290;&#19979;&#38754;&#30340;&#27169;&#22411;&#25317;&#26377;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;publish_on&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn97&quot;&gt;from django.db import models
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager

class Photo(models.Model):
    photo = models.FileField(upload_to=&apos;/home/photos&apos;)
    photographer_name = models.CharField(max_length=100)
    pub_date = models.DateField()
    publish_on = models.ForeignKey(Site)
    objects = models.Manager()
    on_site = CurrentSiteManager(&apos;publish_on&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#22914;&#26524;&#35797;&#22270;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentSiteManager&lt;/span&gt;&lt;/tt&gt; &#24182;&#20256;&#20837;&#19968;&#20010;&#19981;&#23384;&#22312;&#30340;&#23383;&#27573;&#21517;&#65292; Django &#23558;&#24341;&#21457;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ValueError&lt;/span&gt;&lt;/tt&gt; &#24322;&#24120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#21363;&#20415;&#26159;&#24050;&#32463;&#20351;&#29992;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentSiteManager&lt;/span&gt;&lt;/tt&gt; &#65292;&#20320;&#20063;&#35768;&#36824;&#24819;&#22312;&#27169;&#22411;&#20013;&#25317;&#26377;&#19968;&#20010;&#27491;&#24120;&#30340;&#65288;&#38750;&#31449;&#28857;&#30456;&#20851;&#65289;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#31649;&#29702;&#22120;&lt;/span&gt;&lt;/tt&gt; &#12290;&#27491;&#22914;&#22312;&#38468;&#24405; B &#20013;&#25152;&#35299;&#37322;&#30340;&#65292;&#22914;&#26524;&#20320;&#25163;&#21160;&#23450;&#20041;&#20102;&#19968;&#20010;&#31649;&#29702;&#22120;&#65292;&#37027;&#20040; Django &#19981;&#20250;&#20026;&#20320;&#21019;&#24314;&#20840;&#33258;&#21160;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;objects&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;models.Manager()&lt;/span&gt;&lt;/tt&gt; &#31649;&#29702;&#22120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&#21516;&#26679;&#65292;Django &#30340;&#29305;&#23450;&#37096;&#20998;&#65288;&#21363; Django &#36229;&#32423;&#31649;&#29702;&#31449;&#28857;&#21644;&#36890;&#29992;&#35270;&#22270;&#65289;&#20351;&#29992;&#22312;&#27169;&#22411;&#20013;&#23450;&#20041; &#30340;&lt;em&gt;&#31532;&#19968;&#20010;&lt;/em&gt;&#31649;&#29702;&#22120;&#65292;&#22240;&#27492;&#22914;&#26524;&#24076;&#26395;&#31649;&#29702;&#31449;&#28857;&#33021;&#22815;&#35775;&#38382;&#25152;&#26377;&#23545;&#35937;&#65288;&#32780;&#19981;&#26159;&#20165;&#20165;&#31449;&#28857;&#29305;&#26377;&#23545;&#35937;&#65289;&#65292;&#35831;&#20110;&#23450;&#20041; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CurrentSiteManager&lt;/span&gt;&lt;/tt&gt; &#20043;&#21069;&#22312;&#27169;&#22411;&#20013;&#25918;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;objects&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;models.Manager()&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn102&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn102&quot;&gt;Django&#22914;&#20309;&#20351;&#29992;&#22810;&#31449;&#28857;&#26694;&#26550;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#23613;&#31649;&#24182;&#19981;&#26159;&#24517;&#39035;&#30340;&#65292;&#25105;&#20204;&#36824;&#26159;&#24378;&#28872;&#24314;&#35758;&#20351;&#29992;&#22810;&#31449;&#28857;&#26694;&#26550;&#65292;&#22240;&#20026; Django &#22312;&#20960;&#20010;&#22320;&#26041;&#21033;&#29992;&#20102;&#23427;&#12290; &#21363;&#20351;&#21482;&#29992; Django &#26469;&#25903;&#25345;&#21333;&#20010;&#32593;&#31449;&#65292;&#20320;&#20063;&#24212;&#35813;&#33457;&#19968;&#28857;&#26102;&#38388;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;domain&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt; &#26469;&#21019;&#24314;&#31449;&#28857;&#23545;&#35937;&#65292;&#24182;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#25351;&#21521;&#23427;&#30340; ID &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&#20197;&#19979;&#35762;&#36848;&#30340;&#26159; Django &#22914;&#20309;&#20351;&#29992;&#22810;&#31449;&#28857;&#26694;&#26550;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn105&quot;&gt;&#22312;&#37325;&#23450;&#21521;&#26694;&#26550;&#20013;&#65288;&#35265;&#21518;&#38754;&#30340;&#37325;&#23450;&#21521;&#19968;&#33410;&#65289;&#65292;&#27599;&#19968;&#20010;&#37325;&#23450;&#21521;&#23545;&#35937;&#37117;&#19982;&#19968;&#20010;&#29305;&#23450;&#31449;&#28857;&#20851;&#32852;&#12290; &#24403; Django &#25628;&#32034;&#37325;&#23450;&#21521;&#30340;&#26102;&#20505;&#65292;&#23427;&#20250;&#32771;&#34385;&#24403;&#21069;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn106&quot;&gt;&#22312;&#27880;&#20876;&#26694;&#26550;&#20013;&#65292;&#27599;&#20010;&#27880;&#37322;&#37117;&#19982;&#29305;&#23450;&#31449;&#28857;&#30456;&#20851;&#12290; &#27599;&#20010;&#27880;&#37322;&#34987;&#26174;&#31034;&#26102;&#65292;&#20854; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;site&lt;/span&gt;&lt;/tt&gt; &#34987;&#35774;&#32622;&#20026;&#24403;&#21069;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#65292;&#32780;&#24403;&#36890;&#36807;&#36866;&#24403;&#30340;&#27169;&#26495;&#26631;&#31614;&#21015;&#20986;&#27880;&#37322;&#26102;&#65292;&#21482;&#26377;&#24403;&#21069;&#31449;&#28857;&#30340;&#27880;&#37322;&#23558;&#20250;&#26174;&#31034;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn107&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn107&quot;&gt;&#22312; flatpages &#26694;&#26550;&#20013; (&#21442;&#35265;&#21518;&#38754;&#30340; Flatpages &#19968;&#33410;&#65289;&#65292;&#27599;&#20010; flatpage &#37117;&#19982;&#29305;&#23450;&#30340;&#31449;&#28857;&#30456;&#20851;&#32852;&#12290; &#21019;&#24314; flatpage &#26102;&#65292;&#20320;&#37117;&#23558;&#25351;&#23450;&#23427;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;site&lt;/span&gt;&lt;/tt&gt; &#65292;&#32780; flatpage &#20013;&#38388;&#20214;&#22312;&#33719;&#21462; flatpage &#20197;&#26174;&#31034;&#23427;&#30340;&#36807;&#31243;&#20013;&#65292;&#23558;&#26597;&#30475;&#24403;&#21069;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn108&quot;&gt;&#22312; syndication &#26694;&#26550;&#20013;&#65288;&#21442;&#38405;&#31532; 13 &#31456;&#65289;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;title&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;description&lt;/span&gt;&lt;/tt&gt; &#30340;&#27169;&#26495;&#20250;&#33258;&#21160;&#35775;&#38382;&#21464;&#37327; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;site&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#65292;&#23427;&#20854;&#23454;&#26159;&#20195;&#34920;&#24403;&#21069;&#31449;&#28857;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290; &#32780;&#19988;&#65292;&#22914;&#26524;&#20320;&#19981;&#25351;&#23450;&#19968;&#20010;&#21512;&#26684;&#30340;domain&#30340;&#35805;&#65292;&#25552;&#20379;&#30446;&#24405;URL&#30340;&#38057;&#23376;&#23558;&#20250;&#20351;&#29992;&#24403;&#21069;&#8220;Site&#8221;&#23545;&#35937;&#30340;domain&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn109&quot;&gt;&#22312;&#26435;&#38480;&#26694;&#26550;&#20013;&#65288;&#21442;&#35265;&#21313;&#22235;&#31456;&#65289;&#65292;&#35270;&#22270;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.auth.views.login&lt;/span&gt;&lt;/tt&gt;&#25226;&#24403;&#21069;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Site&lt;/span&gt;&lt;/tt&gt;&#21517;&#23383;&#21644;&#23545;&#35937;&#20998;&#21035;&#20197;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;site_name&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;site&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt;&#30340;&#24418;&#24335;&#20256;&#32473;&#20102;&#27169;&#26495;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;flatpages&quot;&gt;
&lt;span id=&quot;cn110&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn110&quot;&gt;Flatpages(&#31616;&#21333;&#39029;&#38754;)&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&#23613;&#31649;&#36890;&#24120;&#24773;&#20917;&#19979;&#24635;&#26159;&#25645;&#24314;&#36816;&#34892;&#25968;&#25454;&#24211;&#39537;&#21160;&#30340; Web &#24212;&#29992;&#65292;&#26377;&#26102;&#20320;&#36824;&#26159;&#38656;&#35201;&#28155;&#21152;&#19968;&#20004;&#24352;&#19968;&#27425;&#24615;&#30340;&#38745;&#24577;&#39029;&#38754;&#65292;&#20363;&#22914;&#8220;&#20851;&#20110;&#8221;&#39029;&#38754;&#65292;&#25110;&#32773;&#8220;&#38544;&#31169;&#31574;&#30053;&#8221;&#39029;&#38754;&#31561;&#31561;&#12290; &#21487;&#20197;&#29992;&#20687; Apache &#36825;&#26679;&#30340;&#26631;&#20934;Web&#26381;&#21153;&#22120;&#26469;&#22788;&#29702;&#36825;&#20123;&#38745;&#24577;&#39029;&#38754;&#65292;&#20294;&#21364;&#20250;&#32473;&#24212;&#29992;&#24102;&#26469;&#19968;&#20123;&#39069;&#22806;&#30340;&#22797;&#26434;&#24615;&#65292;&#22240;&#20026;&#20320;&#24517;&#39035;&#25805;&#24515;&#24590;&#20040;&#37197;&#32622; Apache&#65292;&#36824;&#35201;&#35774;&#32622;&#26435;&#38480;&#35753;&#25972;&#20010;&#22242;&#38431;&#21487;&#20197;&#20462;&#25913;&#32534;&#36753;&#36825;&#20123;&#25991;&#20214;&#65292;&#32780;&#19988;&#20320;&#36824;&#19981;&#33021;&#20351;&#29992; Django &#27169;&#26495;&#31995;&#32479;&#26469;&#32479;&#19968;&#36825;&#20123;&#39029;&#38754;&#30340;&#39118;&#26684;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&#36825;&#20010;&#38382;&#39064;&#30340;&#35299;&#20915;&#26041;&#26696;&#26159;&#20351;&#29992;&#20301;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.flatpages&lt;/span&gt;&lt;/tt&gt; &#24320;&#21457;&#21253;&#20013;&#30340; Django &#31616;&#21333;&#39029;&#38754;&#65288;flatpages&#65289;&#24212;&#29992;&#31243;&#24207;&#12290;&#35813;&#24212;&#29992;&#35753;&#20320;&#33021;&#22815;&#36890;&#36807; Django &#31649;&#29702;&#31449;&#28857;&#26469;&#31649;&#29702;&#36825;&#20123;&#19968;&#27425;&#24615;&#30340;&#39029;&#38754;&#65292;&#36824;&#21487;&#20197;&#35753;&#20320;&#20351;&#29992; Django &#27169;&#26495;&#31995;&#32479;&#25351;&#23450;&#23427;&#20204;&#20351;&#29992;&#21738;&#20010;&#27169;&#26495;&#12290; &#23427;&#22312;&#21518;&#21488;&#20351;&#29992;Django&#27169;&#22411;&#65292;&#36825;&#24847;&#21619;&#30528;&#23427;&#25226;&#39029;&#38754;&#39033;&#21035;&#30340;&#25968;&#25454;&#19968;&#26679;&#20445;&#23384;&#22312;&#25968;&#25454;&#24211;&#20013;&#65292;&#20063;&#23601;&#26159;&#35828;&#20320;&#21487;&#20197;&#20351;&#29992;&#26631;&#20934;Django&#25968;&#25454;&#24211;API&#26469;&#23384;&#21462;&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#31616;&#21333;&#39029;&#38754;&#20197;&#23427;&#20204;&#30340; URL &#21644;&#31449;&#28857;&#20026;&#38190;&#20540;&#12290; &#24403;&#21019;&#24314;&#31616;&#21333;&#39029;&#38754;&#26102;&#65292;&#20320;&#25351;&#23450;&#23427;&#19982;&#21738;&#20010;URL&#20197;&#21450;&#21644;&#21738;&#20010;&#31449;&#28857;&#30456;&#20851;&#32852; &#12290; &#65288;&#26377;&#20851;&#31449;&#28857;&#30340;&#26356;&#22810;&#20449;&#24687;&#65292;&#35831;&#26597;&#38405;&#8221;&#22810;&#31449;&#28857;&#8220;&#19968;&#33410;&#12290;&#65289;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn114&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#20351;&#29992;&#31616;&#21333;&#39029;&#38754;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#23433;&#35013;&#31616;&#21333;&#39029;&#38754;&#24212;&#29992;&#31243;&#24207;&#24517;&#39035;&#25353;&#29031;&#19979;&#38754;&#30340;&#27493;&#39588;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn116&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn116&quot;&gt;&#28155;&#21152; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.flatpages&apos;&lt;/span&gt;&lt;/tt&gt; &#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#12290;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.flatpages&lt;/span&gt;&lt;/tt&gt;&#20381;&#36182;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sites&lt;/span&gt;&lt;/tt&gt;&#65292;&#25152;&#20197;&#30830;&#20445;&#23427;&#20204;&#37117;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt;&#37324;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn117&quot;&gt;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.flatpages.middleware.FlatpageFallbackMiddleware&apos;&lt;/span&gt;&lt;/tt&gt; &#28155;&#21152;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn118&quot;&gt;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#22312;&#25968;&#25454;&#24211;&#20013;&#21019;&#24314;&#24517;&#38656;&#30340;&#20004;&#20010;&#34920;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#31616;&#21333;&#39029;&#38754;&#24212;&#29992;&#31243;&#24207;&#22312;&#25968;&#25454;&#24211;&#20013;&#21019;&#24314;&#20004;&#20010;&#34920;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django_flatpage&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django_flatpage_sites&lt;/span&gt;&lt;/tt&gt; &#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django_flatpage&lt;/span&gt;&lt;/tt&gt; &#21482;&#26159;&#23558; URL &#26144;&#23556;&#21040;&#26631;&#39064;&#21644;&#19968;&#27573;&#25991;&#26412;&#20869;&#23481;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django_flatpage_sites&lt;/span&gt;&lt;/tt&gt; &#26159;&#19968;&#20010;&#22810;&#23545;&#22810;&#34920;&#65292;&#29992;&#20110;&#20851;&#32852;&#26576;&#20010;&#31616;&#21333;&#39029;&#38754;&#20197;&#21450;&#19968;&#20010;&#25110;&#22810;&#20010;&#31449;&#28857;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn120&quot;&gt;&#35813;&#24212;&#29992;&#25414;&#32465;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FlatPage&lt;/span&gt;&lt;/tt&gt; &#27169;&#22411;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django/contrib/flatpages/models.py&lt;/span&gt;&lt;/tt&gt; &#36827;&#34892;&#23450;&#20041;&#65292;&#22914;&#19979;&#25152;&#31034;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn122&quot;&gt;from django.db import models
from django.contrib.sites.models import Site

class FlatPage(models.Model):
    url = models.CharField(max_length=100, db_index=True)
    title = models.CharField(max_length=200)
    content = models.TextField(blank=True)
    enable_comments = models.BooleanField()
    template_name = models.CharField(max_length=70, blank=True)
    registration_required = models.BooleanField()
    sites = models.ManyToManyField(Site)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&#35753;&#25105;&#20204;&#36880;&#39033;&#30475;&#30475;&#36825;&#20123;&#23383;&#27573;&#30340;&#21547;&#20041;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn124&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;url&lt;/span&gt;&lt;/tt&gt; : &#35813;&#31616;&#21333;&#39029;&#38754;&#25152;&#22788;&#30340; URL&#65292;&#19981;&#21253;&#25324;&#22495;&#21517;&#65292;&#20294;&#26159;&#21253;&#21547;&#21069;&#23548;&#26012;&#26464; (&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/about/contact/&lt;/span&gt;&lt;/tt&gt; )&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn125&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;title&lt;/span&gt;&lt;/tt&gt; : &#31616;&#21333;&#39029;&#38754;&#30340;&#26631;&#39064;&#12290; &#26694;&#26550;&#19981;&#23545;&#23427;&#20316;&#20219;&#20309;&#29305;&#27530;&#22788;&#29702;&#12290;
&#30001;&#20320;&#36890;&#36807;&#27169;&#26495;&#26469;&#26174;&#31034;&#23427;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn126&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn126&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;content&lt;/span&gt;&lt;/tt&gt; : &#31616;&#21333;&#39029;&#38754;&#30340;&#20869;&#23481; (&#21363; HTML &#39029;&#38754;)&#12290; &#26694;&#26550;&#19981;&#23545;&#23427;&#20316;&#20219;&#20309;&#29305;&#27530;&#22788;&#29702;&#12290; &#30001;&#20320;&#36127;&#36131;&#20351;&#29992;&#27169;&#26495;&#26469;&#26174;&#31034;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn127&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;enable_comments&lt;/span&gt;&lt;/tt&gt; : &#26159;&#21542;&#20801;&#35768;&#35813;&#31616;&#21333;&#39029;&#38754;&#20351;&#29992;&#35780;&#35770;&#12290; &#26694;&#26550;&#19981;&#23545;&#23427;&#20316;&#20219;&#20309;&#29305;&#27530;&#22788;&#29702;&#12290; &#20320;&#21487;&#22312;&#27169;&#26495;&#20013;&#26816;&#26597;&#35813;&#20540;&#24182;&#26681;&#25454;&#38656;&#35201;&#26174;&#31034;&#35780;&#35770;&#31383;&#20307;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn128&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_name&lt;/span&gt;&lt;/tt&gt; : &#29992;&#26469;&#35299;&#26512;&#35813;&#31616;&#21333;&#39029;&#38754;&#30340;&#27169;&#26495;&#21517;&#31216;&#12290; &#36825;&#26159;&#19968;&#20010;&#21487;&#36873;&#39033;&#65307;&#22914;&#26524;&#26410;&#25351;&#23450;&#27169;&#26495;&#25110;&#35813;&#27169;&#26495;&#19981;&#23384;&#22312;&#65292;&#31995;&#32479;&#20250;&#36864;&#32780;&#20351;&#29992;&#40664;&#35748;&#27169;&#26495; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpages/default.html&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn129&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;registration_required&lt;/span&gt;&lt;/tt&gt; : &#26159;&#21542;&#27880;&#20876;&#29992;&#25143;&#25165;&#33021;&#26597;&#30475;&#27492;&#31616;&#21333;&#39029;&#38754;&#12290;
&#35813;&#35774;&#32622;&#39033;&#38598;&#25104;&#20102; Djangos &#39564;&#35777;/&#29992;&#25143;&#26694;&#26550;&#65292;&#35813;&#26694;&#26550;&#20110;&#31532;&#21313;&#22235;&#31456;&#35814;&#36848;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn130&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sites&lt;/span&gt;&lt;/tt&gt; : &#35813;&#31616;&#21333;&#39029;&#38754;&#25918;&#32622;&#30340;&#31449;&#28857;&#12290; &#35813;&#39033;&#35774;&#32622;&#38598;&#25104;&#20102; Django &#22810;&#31449;&#28857;&#26694;&#26550;&#65292;&#35813;&#26694;&#26550;&#22312;&#26412;&#31456;&#30340;&#8220;&#22810;&#31449;&#28857;&#8221;&#19968;&#33410;&#20013;&#26377;&#25152;&#38416;&#36848;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#20320;&#21487;&#20197;&#36890;&#36807; Django &#36229;&#32423;&#31649;&#29702;&#30028;&#38754;&#25110;&#32773; Django &#25968;&#25454;&#24211; API &#26469;&#21019;&#24314;&#31616;&#21333;&#39029;&#38754;&#12290;
&#35201;&#20102;&#35299;&#26356;&#22810;&#20869;&#23481;&#65292;&#35831;&#26597;&#38405;&#8220;&#28155;&#21152;&#12289;&#20462;&#25913;&#21644;&#21024;&#38500;&#31616;&#21333;&#39029;&#38754;&#8221;&#19968;&#33410;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&#19968;&#26086;&#31616;&#21333;&#39029;&#38754;&#21019;&#24314;&#23436;&#25104;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FlatpageFallbackMiddleware&lt;/span&gt;&lt;/tt&gt; &#23558;&#23436;&#25104;&#65288;&#21097;&#19979;&#65289;&#25152;&#26377;&#30340;&#24037;&#20316;&#12290; &#27599;&#24403; Django &#24341;&#21457; 404 &#38169;&#35823;&#65292;&#20316;&#20026;&#26368;&#21518;&#30340;&#21150;&#27861;&#65292;&#35813;&#20013;&#38388;&#20214;&#23558;&#26681;&#25454;&#25152;&#35831;&#27714;&#30340; URL &#26816;&#26597;&#31616;&#21333;&#39029;&#38754;&#25968;&#25454;&#24211;&#12290; &#30830;&#20999;&#22320;&#35828;&#65292;&#23427;&#23558;&#20351;&#29992;&#25152;&#25351;&#23450;&#30340; URL&#20197;&#21450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#23545;&#24212;&#30340;&#31449;&#28857; ID &#26597;&#25214;&#19968;&#20010;&#31616;&#21333;&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#22914;&#26524;&#25214;&#21040;&#19968;&#20010;&#21305;&#37197;&#39033;&#65292;&#23427;&#23558;&#36733;&#20837;&#35813;&#31616;&#21333;&#39029;&#38754;&#30340;&#27169;&#26495;&#65288;&#22914;&#26524;&#27809;&#26377;&#25351;&#23450;&#30340;&#35805;&#65292;&#23558;&#20351;&#29992;&#40664;&#35748;&#27169;&#26495; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpages/default.html&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290; &#21516;&#26102;&#65292;&#23427;&#25226;&#19968;&#20010;&#31616;&#21333;&#30340;&#19978;&#19979;&#25991;&#21464;&#37327;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpage&lt;/span&gt;&lt;/tt&gt;&#65288;&#19968;&#20010;&#31616;&#21333;&#39029;&#38754;&#23545;&#35937;&#65289;&#20256;&#36882;&#32473;&#27169;&#26495;&#12290; &#27169;&#26495;&#35299;&#26512;&#36807;&#31243;&#20013;&#65292;&#23427;&#23454;&#38469;&#29992;&#30340;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn134&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FlatpageFallbackMiddleware&lt;/span&gt;&lt;/tt&gt; &#27809;&#26377;&#25214;&#21040;&#21305;&#37197;&#39033;&#65292;&#35813;&#35831;&#27714;&#32487;&#32493;&#22914;&#24120;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn136&quot;&gt;&#35813;&#20013;&#38388;&#20214;&#20165;&#22312;&#21457;&#29983; 404 &#65288;&#39029;&#38754;&#26410;&#25214;&#21040;&#65289;&#38169;&#35823;&#26102;&#34987;&#28608;&#27963;&#65292;&#32780;&#19981;&#20250;&#22312; 500 &#65288;&#26381;&#21153;&#22120;&#38169;&#35823;&#65289;&#25110;&#20854;&#20182;&#38169;&#35823;&#21709;&#24212;&#26102;&#34987;&#28608;&#27963;&#12290; &#36824;&#35201;&#27880;&#24847;&#30340;&#26159;&#24517;&#39035;&#32771;&#34385; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#30340;&#39034;&#24207;&#38382;&#39064;&#12290;
&#36890;&#24120;&#65292;&#20320;&#21487;&#20197;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FlatpageFallbackMiddleware&lt;/span&gt;&lt;/tt&gt; &#25918;&#22312;&#21015;&#34920;&#26368;&#21518;&#65292;&#22240;&#20026;&#23427;&#26159;&#26368;&#21518;&#30340;&#21150;&#27861;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn137&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn137&quot;&gt;&#28155;&#21152;&#12289;&#20462;&#25913;&#21644;&#21024;&#38500;&#31616;&#21333;&#39029;&#38754;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#21487;&#20197;&#29992;&#20004;&#31181;&#26041;&#24335;&#22686;&#21152;&#12289;&#21464;&#26356;&#25110;&#21024;&#38500;&#31616;&#21333;&#39029;&#38754;&#65306;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn139&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&#36890;&#36807;&#36229;&#32423;&#31649;&#29702;&#30028;&#38754;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn140&quot;&gt;&#22914;&#26524;&#24050;&#32463;&#28608;&#27963;&#20102;&#33258;&#21160;&#30340; Django &#36229;&#32423;&#31649;&#29702;&#30028;&#38754;&#65292;&#20320;&#23558;&#20250;&#22312;&#36229;&#32423;&#31649;&#29702;&#39029;&#38754;&#30340;&#39318;&#39029;&#30475;&#21040;&#26377;&#20010; Flatpages &#21306;&#22495;&#12290; &#20320;&#21487;&#20197;&#20687;&#32534;&#36753;&#31995;&#32479;&#20013;&#20854;&#23427;&#23545;&#35937;&#37027;&#26679;&#32534;&#36753;&#31616;&#21333;&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;python-api&quot;&gt;
&lt;span id=&quot;cn141&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn141&quot;&gt;&#36890;&#36807; Python API&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#21069;&#38754;&#24050;&#32463;&#25552;&#21040;&#65292;&#31616;&#21333;&#39029;&#38754;&#34920;&#29616;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django/contrib/flatpages/models.py&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#26631;&#20934; Django &#27169;&#22411;&#12290;&#36825;&#26679;&#65292;&#20320;&#23601;&#21487;&#20197;&#20351;&#29992;Django&#25968;&#25454;&#24211;API&#26469;&#23384;&#21462;&#31616;&#21333;&#39029;&#38754;&#23545;&#35937;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn144&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.contrib.flatpages.models import FlatPage
&amp;gt;&amp;gt;&amp;gt; from django.contrib.sites.models import Site
&amp;gt;&amp;gt;&amp;gt; fp = FlatPage.objects.create(
...     url=&apos;/about/&apos;,
...     title=&apos;About&apos;,
...     content=&apos;&amp;lt;p&amp;gt;About this site...&amp;lt;/p&amp;gt;&apos;,
...     enable_comments=False,
...     template_name=&apos;&apos;,
...     registration_required=False,
... )
&amp;gt;&amp;gt;&amp;gt; fp.sites.add(Site.objects.get(id=1))
&amp;gt;&amp;gt;&amp;gt; FlatPage.objects.get(url=&apos;/about/&apos;)
&amp;lt;FlatPage: /about/ -- About&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id15&quot;&gt;
&lt;span id=&quot;cn145&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn145&quot;&gt;&#20351;&#29992;&#31616;&#21333;&#39029;&#38754;&#27169;&#26495;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn146&quot;&gt;&#32570;&#30465;&#24773;&#20917;&#19979;&#65292;&#31995;&#32479;&#20351;&#29992;&#27169;&#26495; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpages/default.html&lt;/span&gt;&lt;/tt&gt; &#26469;&#35299;&#26512;&#31616;&#21333;&#39029;&#38754;&#65292;&#20294;&#20320;&#20063;&#21487;&#20197;&#36890;&#36807;&#35774;&#23450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;FlatPage&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;template_name&lt;/span&gt;&lt;/tt&gt; &#23383;&#27573;&#26469;&#26356;&#25913;&#29305;&#23450;&#31616;&#21333;&#39029;&#38754;&#30340;&#27169;&#26495;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn147&quot;&gt;&#20320;&#24517;&#39035;&#33258;&#24049;&#21019;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpages/default.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#12290; &#21482;&#38656;&#35201;&#22312;&#27169;&#26495;&#30446;&#24405;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpages&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#65292;&#24182;&#25226; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;default.html&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#32622;&#20110;&#20854;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn148&quot;&gt;&#31616;&#21333;&#39029;&#38754;&#27169;&#26495;&#21482;&#25509;&#21463;&#26377;&#19968;&#20010;&#19978;&#19979;&#25991;&#21464;&#37327;&#8212;&#8212; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpage&lt;/span&gt;&lt;/tt&gt; &#65292;&#20063;&#23601;&#26159;&#35813;&#31616;&#21333;&#39029;&#38754;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&#20197;&#19979;&#26159;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpages/default.html&lt;/span&gt;&lt;/tt&gt; &#27169;&#26495;&#33539;&#20363;:&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn151&quot;&gt;&amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;
    &quot;http://www.w3.org/TR/REC-html40/loose.dtd&quot;&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;title&amp;gt;{{ flatpage.title }}&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
{{ flatpage.content|safe }}
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn152&quot;&gt;&#27880;&#24847;&#25105;&#20204;&#20351;&#29992;&#20102;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;safe&lt;/span&gt;&lt;/tt&gt;&#27169;&#26495;&#36807;&#28388;&#22120;&#26469;&#20801;&#35768;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpage.content&lt;/span&gt;&lt;/tt&gt;&#24341;&#20837;&#21407;&#22987;HTML&#32780;&#19981;&#24517;&#36716;&#20041;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id16&quot;&gt;
&lt;span id=&quot;cn153&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn153&quot;&gt;&#37325;&#23450;&#21521;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&#36890;&#36807;&#23558;&#37325;&#23450;&#21521;&#23384;&#20648;&#22312;&#25968;&#25454;&#24211;&#20013;&#24182;&#23558;&#20854;&#35270;&#20026; Django &#27169;&#22411;&#23545;&#35937;&#65292;Django &#37325;&#23450;&#21521;&#26694;&#26550;&#35753;&#20320;&#33021;&#22815;&#36731;&#26494;&#22320;&#31649;&#29702;&#23427;&#20204;&#12290; &#27604;&#22914;&#35828;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;&#37325;&#23450;&#21521;&#26694;&#26550;&#21578;&#35785;Django&#65292;&#25226;&#20219;&#20309;&#25351;&#21521; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/music/&lt;/span&gt;&lt;/tt&gt; &#30340;&#35831;&#27714;&#37325;&#23450;&#21521;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/sections/arts/music/&lt;/span&gt;&lt;/tt&gt; &#12290;&#24403;&#20320;&#38656;&#35201;&#22312;&#31449;&#28857;&#20013;&#31227;&#21160;&#19968;&#20123;&#19996;&#35199;&#26102;&#65292;&#36825;&#39033;&#21151;&#33021;&#23601;&#27966;&#19978;&#29992;&#22330;&#20102;&#8212;&#8212;&#32593;&#31449;&#24320;&#21457;&#32773;&#24212;&#35813;&#31351;&#23613;&#19968;&#20999;&#21150;&#27861;&#36991;&#20813;&#20986;&#29616;&#22351;&#38142;&#25509;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id17&quot;&gt;
&lt;span id=&quot;cn155&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&#20351;&#29992;&#37325;&#23450;&#21521;&#26694;&#26550;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn156&quot;&gt;&#23433;&#35013;&#37325;&#23450;&#21521;&#24212;&#29992;&#31243;&#24207;&#24517;&#39035;&#36981;&#24490;&#20197;&#19979;&#27493;&#39588;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn157&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn157&quot;&gt;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.redirects&apos;&lt;/span&gt;&lt;/tt&gt; &#28155;&#21152;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn158&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn158&quot;&gt;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.redirects.middleware.RedirectFallbackMiddleware&apos;&lt;/span&gt;&lt;/tt&gt; &#28155;&#21152;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#12290;&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn159&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn159&quot;&gt;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt; &#21629;&#20196;&#23558;&#25152;&#38656;&#30340;&#34920;&#28155;&#21152;&#21040;&#25968;&#25454;&#24211;&#20013;&#12290;&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn160&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;syncdb&lt;/span&gt;&lt;/tt&gt; &#22312;&#25968;&#25454;&#24211;&#20013;&#21019;&#24314;&#20102;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django_redirect&lt;/span&gt;&lt;/tt&gt; &#34920;&#12290; &#36825;&#26159;&#19968;&#20010;&#31616;&#21333;&#30340;&#26597;&#35810;&#34920;&#65292;&#21482;&#26377;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;site_id&lt;/span&gt;&lt;/tt&gt;&#12289;old_path&#21644;new_path&#19977;&#20010;&#23383;&#27573;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn161&quot;&gt;&#20320;&#21487;&#20197;&#36890;&#36807; Django &#36229;&#32423;&#31649;&#29702;&#30028;&#38754;&#25110;&#32773; Django &#25968;&#25454;&#24211; API &#26469;&#21019;&#24314;&#37325;&#23450;&#21521;&#12290;
&#35201;&#20102;&#35299;&#26356;&#22810;&#20449;&#24687;&#65292;&#35831;&#21442;&#38405;&#8220;&#22686;&#21152;&#12289;&#21464;&#26356;&#21644;&#21024;&#38500;&#37325;&#23450;&#21521;&#8221;&#19968;&#33410;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#19968;&#26086;&#21019;&#24314;&#20102;&#37325;&#23450;&#21521;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RedirectFallbackMiddleware&lt;/span&gt;&lt;/tt&gt; &#31867;&#23558;&#23436;&#25104;&#25152;&#26377;&#30340;&#24037;&#20316;&#12290;
&#27599;&#24403; Django &#24212;&#29992;&#24341;&#21457;&#19968;&#20010; 404 &#38169;&#35823;&#65292;&#20316;&#20026;&#32456;&#26497;&#25163;&#27573;&#65292;&#35813;&#20013;&#38388;&#20214;&#23558;&#20026;&#25152;&#35831;&#27714;&#30340; URL &#22312;&#37325;&#23450;&#21521;&#25968;&#25454;&#24211;&#20013;&#36827;&#34892;&#26597;&#25214;&#12290; &#30830;&#20999;&#22320;&#35828;&#65292;&#23427;&#23558;&#20351;&#29992;&#32473;&#23450;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;old_path&lt;/span&gt;&lt;/tt&gt; &#20197;&#21450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#23545;&#24212;&#30340;&#31449;&#28857; ID &#26597;&#25214;&#37325;&#23450;&#21521;&#35774;&#32622;&#12290; &#65288;&#26597;&#38405;&#21069;&#38754;&#30340;&#8220;&#22810;&#31449;&#28857;&#8221;&#19968;&#33410;&#21487;&#20102;&#35299;&#20851;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SITE_ID&lt;/span&gt;&lt;/tt&gt; &#21644;&#22810;&#31449;&#28857;&#26694;&#26550;&#30340;&#26356;&#22810;&#32454;&#33410;&#65289; &#28982;&#21518;&#65292;&#23427;&#23558;&#25191;&#34892;&#20197;&#19979;&#20004;&#20010;&#27493;&#39588;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn163&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn163&quot;&gt;&#22914;&#26524;&#25214;&#21040;&#20102;&#21305;&#37197;&#39033;&#65292;&#24182;&#19988; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;new_path&lt;/span&gt;&lt;/tt&gt; &#38750;&#31354;&#65292;&#23427;&#23558;&#37325;&#23450;&#21521;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;new_path&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn164&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn164&quot;&gt;&#22914;&#26524;&#25214;&#21040;&#20102;&#21305;&#37197;&#39033;&#65292;&#20294; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;new_path&lt;/span&gt;&lt;/tt&gt; &#20026;&#31354;&#65292;&#23427;&#23558;&#21457;&#36865;&#19968;&#20010; 410 (Gone) HTTP &#22836;&#20449;&#24687;&#20197;&#21450;&#19968;&#20010;&#31354;&#65288;&#26080;&#20869;&#23481;&#65289;&#21709;&#24212;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn165&quot;&gt;&#22914;&#26524;&#26410;&#25214;&#21040;&#21305;&#37197;&#39033;&#65292;&#35813;&#35831;&#27714;&#23558;&#22914;&#24120;&#22788;&#29702;&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn166&quot;&gt;&#35813;&#20013;&#38388;&#20214;&#20165;&#20026; 404 &#38169;&#35823;&#28608;&#27963;&#65292;&#32780;&#19981;&#20250;&#20026; 500 &#38169;&#35823;&#25110;&#20854;&#20182;&#20219;&#20309;&#29366;&#24577;&#30721;&#30340;&#21709;&#24212;&#25152;&#28608;&#27963;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn167&quot;&gt;&#27880;&#24847;&#24517;&#39035;&#32771;&#34385; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#30340;&#39034;&#24207;&#12290; &#36890;&#24120;&#65292;&#20320;&#21487;&#20197;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RedirectFallbackMiddleware&lt;/span&gt;&lt;/tt&gt; &#25918;&#32622;&#22312;&#21015;&#34920;&#30340;&#26368;&#21518;&#65292;&#22240;&#20026;&#23427;&#26159;&#19968;&#31181;&#32456;&#26497;&#25163;&#27573;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&#27880;&#24847;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn169&quot;&gt;&#22914;&#26524;&#21516;&#26102;&#20351;&#29992;&#37325;&#23450;&#21521;&#21644;&#31616;&#21333;&#39029;&#38754;&#22238;&#36864;&#20013;&#38388;&#20214;&#65292; &#24517;&#39035;&#32771;&#34385;&#20808;&#26816;&#26597;&#20854;&#20013;&#30340;&#21738;&#19968;&#20010;&#65288;&#37325;&#23450;&#21521;&#25110;&#31616;&#21333;&#39029;&#38754;&#65289;&#12290; &#25105;&#20204;&#24314;&#35758;&#23558;&#31616;&#21333;&#39029;&#38754;&#25918;&#22312;&#37325;&#23450;&#21521;&#20043;&#21069;&#65288;&#22240;&#27492;&#23558;&#31616;&#21333;&#39029;&#38754;&#20013;&#38388;&#20214;&#25918;&#32622;&#22312;&#37325;&#23450;&#21521;&#20013;&#38388;&#20214;&#20043;&#21069;&#65289;&#65292;&#20294;&#20320;&#21487;&#33021;&#26377;&#19981;&#21516;&#24819;&#27861;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id18&quot;&gt;
&lt;span id=&quot;cn170&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn170&quot;&gt;&#22686;&#21152;&#12289;&#21464;&#26356;&#21644;&#21024;&#38500;&#37325;&#23450;&#21521;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn171&quot;&gt;&#20320;&#21487;&#20197;&#20004;&#31181;&#26041;&#24335;&#22686;&#21152;&#12289;&#21464;&#26356;&#21644;&#21024;&#38500;&#37325;&#23450;&#21521;&#65306;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id19&quot;&gt;
&lt;span id=&quot;cn172&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn172&quot;&gt;&#36890;&#36807;&#31649;&#29702;&#30028;&#38754;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn173&quot;&gt;&#22914;&#26524;&#24050;&#32463;&#28608;&#27963;&#20102;&#20840;&#33258;&#21160;&#30340; Django &#36229;&#32423;&#31649;&#29702;&#30028;&#38754;&#65292;&#20320;&#24212;&#35813;&#33021;&#22815;&#22312;&#36229;&#32423;&#31649;&#29702;&#39318;&#39029;&#30475;&#21040;&#37325;&#23450;&#21521;&#21306;&#22495;&#12290; &#21487;&#20197;&#20687;&#32534;&#36753;&#31995;&#32479;&#20013;&#20854;&#23427;&#23545;&#35937;&#19968;&#26679;&#32534;&#36753;&#37325;&#23450;&#21521;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id20&quot;&gt;
&lt;span id=&quot;cn174&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&#21516;&#36807;Python API&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn175&quot;&gt;&#37325;&#23450;&#21521;&#34920;&#29616;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django/contrib/redirects/models.py&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#19968;&#20010;&#26631;&#20934; Django &#27169;&#22411;&#12290;&#22240;&#27492;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;Django&#25968;&#25454;&#24211;API&#26469;&#23384;&#21462;&#37325;&#23450;&#21521;&#23545;&#35937;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn177&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from django.contrib.redirects.models import Redirect
&amp;gt;&amp;gt;&amp;gt; from django.contrib.sites.models import Site
&amp;gt;&amp;gt;&amp;gt; red = Redirect.objects.create(
...     site=Site.objects.get(id=1),
...     old_path=&apos;/music/&apos;,
...     new_path=&apos;/sections/arts/music/&apos;,
... )
&amp;gt;&amp;gt;&amp;gt; Redirect.objects.get(old_path=&apos;/music/&apos;)
&amp;lt;Redirect: /music/ ---&amp;gt; /sections/arts/music/&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;csrf&quot;&gt;
&lt;span id=&quot;cn178&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn178&quot;&gt;CSRF &#38450;&#25252;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn179&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.csrf&lt;/span&gt;&lt;/tt&gt; &#24320;&#21457;&#21253;&#33021;&#22815;&#38450;&#27490;&#36973;&#21463;&#36328;&#31449;&#35831;&#27714;&#20266;&#36896;&#25915;&#20987; (CSRF).&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;CSRF, &#21448;&#21483;&#20250;&#35805;&#36339;&#36716;&#65292;&#26159;&#19968;&#31181;&#32593;&#31449;&#23433;&#20840;&#25915;&#20987;&#25216;&#26415;&#12290; &#24403;&#26576;&#20010;&#24694;&#24847;&#32593;&#31449;&#22312;&#29992;&#25143;&#26410;&#23519;&#35273;&#30340;&#24773;&#20917;&#19979;&#23558;&#20854;&#20174;&#19968;&#20010;&#24050;&#32463;&#36890;&#36807;&#36523;&#20221;&#39564;&#35777;&#30340;&#31449;&#28857;&#35825;&#39575;&#33267;&#19968;&#20010;&#26032;&#30340; URL &#26102;&#65292;&#36825;&#31181;&#25915;&#20987;&#23601;&#21457;&#29983;&#20102;&#65292;&#22240;&#27492;&#23427;&#21487;&#20197;&#21033;&#29992;&#29992;&#25143;&#24050;&#32463;&#36890;&#36807;&#36523;&#20221;&#39564;&#35777;&#30340;&#29366;&#24577;&#12290; &#20045;&#19968;&#30475;&#65292;&#35201;&#29702;&#35299;&#36825;&#31181;&#25915;&#20987;&#25216;&#26415;&#27604;&#36739;&#22256;&#38590;&#65292;&#22240;&#27492;&#25105;&#20204;&#22312;&#26412;&#33410;&#23558;&#20351;&#29992;&#20004;&#20010;&#20363;&#23376;&#26469;&#35828;&#26126;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id21&quot;&gt;
&lt;span id=&quot;cn181&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn181&quot;&gt;&#19968;&#20010;&#31616;&#21333;&#30340; CSRF &#20363;&#23376;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn182&quot;&gt;&#20551;&#23450;&#20320;&#24050;&#32463;&#30331;&#24405;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com&lt;/span&gt;&lt;/tt&gt; &#30340;&#32593;&#39029;&#37038;&#20214;&#36134;&#21495;&#12290;&#35813;&#32593;&#31449;&#26377;&#19968;&#20010;&#25351;&#21521;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/logout&lt;/span&gt;&lt;/tt&gt;&#30340;&#27880;&#38144;&#25353;&#38062;&#12290;&#23601;&#26159;&#35828;&#65292;&#27880;&#38144;&#20854;&#23454;&#23601;&#26159;&#35775;&#38382;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/logout&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn183&quot;&gt;&#36890;&#36807;&#22312;&#65288;&#24694;&#24847;&#65289;&#32593;&#39029;&#19978;&#29992;&#38544;&#34255;&#19968;&#20010;&#25351;&#21521; URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/logout&lt;/span&gt;&lt;/tt&gt; &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;iframe&amp;gt;&lt;/span&gt;&lt;/tt&gt; ,&#24694;&#24847;&#32593;&#31449;&#21487;&#20197;&#24378;&#36843;&#20320;&#35775;&#38382;&#35813; URL &#12290;&#22240;&#27492;&#65292;&#22914;&#26524;&#20320;&#30331;&#24405; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com&lt;/span&gt;&lt;/tt&gt; &#30340;&#32593;&#39029;&#37038;&#20214;&#36134;&#21495;&#20043;&#21518;&#65292;&#35775;&#38382;&#20102;&#24102;&#26377;&#25351;&#21521; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/logout&lt;/span&gt;&lt;/tt&gt; &#20043; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;iframe&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#30340;&#24694;&#24847;&#31449;&#28857;&#65292;&#35775;&#38382;&#35813;&#24694;&#24847;&#39029;&#38754;&#30340;&#21160;&#20316;&#23558;&#20351;&#20320;&#30331;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com&lt;/span&gt;&lt;/tt&gt; &#12290; Thus, if you&#8217;re logged in to the
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com&lt;/span&gt;&lt;/tt&gt; webmail account and visit the malicious page that has an &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;iframe&amp;gt;&lt;/span&gt;&lt;/tt&gt; to
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/logout&lt;/span&gt;&lt;/tt&gt; , the act of visiting the malicious page will log you out from
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn184&quot;&gt;&#24456;&#26126;&#26174;&#65292;&#30331;&#20986;&#19968;&#20010;&#37038;&#20214;&#32593;&#31449;&#20063;&#19981;&#26159;&#20160;&#20040;&#20005;&#37325;&#30340;&#23433;&#20840;&#38382;&#39064;&#12290;&#20294;&#26159;&#21516;&#26679;&#30340;&#25915;&#20987;&#21487;&#33021;&#38024;&#23545;&#20219;&#20309;&#30456;&#20449;&#29992;&#25143;&#30340;&#31449;&#28857;&#65292;&#27604;&#22914;&#22312;&#32447;&#38134;&#34892;&#21644;&#30005;&#23376;&#21830;&#21153;&#32593;&#31449;&#12290;&#36825;&#26679;&#30340;&#35805;&#21487;&#33021;&#22312;&#29992;&#25143;&#19981;&#30693;&#24773;&#30340;&#24773;&#20917;&#19979;&#23601;&#19979;&#35746;&#21333;&#20184;&#27454;&#20102;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id22&quot;&gt;
&lt;span id=&quot;cn185&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#31245;&#24494;&#22797;&#26434;&#19968;&#28857;&#30340;CSRF&#20363;&#23376;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#22312;&#19978;&#19968;&#20010;&#20363;&#23376;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com&lt;/span&gt;&lt;/tt&gt; &#24212;&#35813;&#36127;&#37096;&#20998;&#36131;&#20219;&#65292;&#22240;&#20026;&#23427;&#20801;&#35768;&#36890;&#36807; HTTP &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#36827;&#34892;&#29366;&#24577;&#21464;&#26356;&#65288;&#21363;&#30331;&#20837;&#21644;&#30331;&#20986;&#65289;&#12290; &#22914;&#26524;&#23545;&#26381;&#21153;&#22120;&#30340;&#29366;&#24577;&#21464;&#26356;&#35201;&#27714;&#20351;&#29992; HTTP &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#65292;&#24773;&#20917;&#23601;&#22909;&#24471;&#22810;&#20102;&#12290;
&#20294;&#26159;&#65292;&#21363;&#20415;&#26159;&#24378;&#21046;&#35201;&#27714;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#36827;&#34892;&#29366;&#24577;&#21464;&#26356;&#25805;&#20316;&#20063;&#26131;&#21463;&#21040; CSRF &#25915;&#20987;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn187&quot;&gt;&#20551;&#35774; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com&lt;/span&gt;&lt;/tt&gt; &#23545;&#30331;&#20986;&#21151;&#33021;&#36827;&#34892;&#20102;&#21319;&#32423;&#65292;&#30331;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;form&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#25353;&#38062;&#26159;&#36890;&#36807;&#19968;&#20010;&#25351;&#21521; URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/logout&lt;/span&gt;&lt;/tt&gt; &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#21160;&#20316;&#23436;&#25104;&#65292;&#21516;&#26102;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;form&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#20013;&#21152;&#20837;&#20102;&#20197;&#19979;&#38544;&#34255;&#30340;&#23383;&#27573;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn189&quot;&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;confirm&quot; value=&quot;true&quot;&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn190&quot;&gt;&#36825;&#23601;&#30830;&#20445;&#20102;&#29992;&#31616;&#21333;&#30340;&#25351;&#21521;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/logout&lt;/span&gt;&lt;/tt&gt;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#19981;&#20250;&#35753;&#29992;&#25143;&#30331;&#20986;&#65307;&#35201;&#35753;&#29992;&#25143;&#30331;&#20986;&#65292;&#29992;&#25143;&#24517;&#39035;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#21521; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/logout&lt;/span&gt;&lt;/tt&gt; &#21457;&#36865;&#35831;&#27714;  &#24182;&#19988;&#21457;&#36865;&#19968;&#20010;&#20540;&#20026;&#8217;true&#8217;&#30340;POST&#21464;&#37327;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;confirm&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn191&quot;&gt;&#23613;&#31649;&#22686;&#21152;&#20102;&#39069;&#22806;&#30340;&#23433;&#20840;&#26426;&#21046;&#65292;&#36825;&#31181;&#35774;&#35745;&#20173;&#28982;&#20250;&#36973;&#21040; CSRF &#30340;&#25915;&#20987;&#8212;&#8212;&#24694;&#24847;&#39029;&#38754;&#20165;&#38656;&#19968;&#28857;&#28857;&#25913;&#36827;&#32780;&#24050;&#12290; &#25915;&#20987;&#32773;&#21487;&#20197;&#38024;&#23545;&#20320;&#30340;&#31449;&#28857;&#35774;&#35745;&#25972;&#20010;&#34920;&#21333;&#65292;&#24182;&#23558;&#20854;&#34255;&#36523;&#20110;&#19968;&#20010;&#19981;&#21487;&#35265;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;iframe&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#20013;&#65292;&#28982;&#21518;&#20351;&#29992; Javascript &#33258;&#21160;&#25552;&#20132;&#35813;&#34920;&#21333;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id23&quot;&gt;
&lt;span id=&quot;cn192&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn192&quot;&gt;&#38450;&#27490; CSRF&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&#37027;&#20040;&#65292;&#26159;&#21542;&#21487;&#20197;&#35753;&#31449;&#28857;&#20813;&#21463;&#36825;&#31181;&#25915;&#20987;&#21602;&#65311; &#31532;&#19968;&#27493;&#65292;&#39318;&#20808;&#30830;&#20445;&#25152;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#27809;&#26377;&#21103;&#20316;&#29992;&#12290; &#36825;&#26679;&#20197;&#26469;&#65292;&#22914;&#26524;&#26576;&#20010;&#24694;&#24847;&#31449;&#28857;&#23558;&#20320;&#30340;&#39029;&#38754;&#21253;&#21547;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;iframe&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#65292;&#23427;&#23558;&#19981;&#20250;&#20135;&#29983;&#36127;&#38754;&#25928;&#26524;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn194&quot;&gt;&#35813;&#25216;&#26415;&#27809;&#26377;&#32771;&#34385; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#35831;&#27714;&#12290; &#31532;&#20108;&#27493;&#23601;&#26159;&#32473;&#25152;&#26377; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#30340;form&#26631;&#31614;&#19968;&#20010;&#38544;&#34255;&#23383;&#27573;&#65292;&#23427;&#30340;&#20540;&#26159;&#20445;&#23494;&#30340;&#24182;&#26681;&#25454;&#29992;&#25143;&#36827;&#31243;&#30340; ID &#29983;&#25104;&#12290; &#36825;&#26679;&#65292;&#20174;&#26381;&#21153;&#22120;&#31471;&#35775;&#38382;&#34920;&#21333;&#26102;&#65292;&#21487;&#20197;&#26816;&#26597;&#35813;&#20445;&#23494;&#30340;&#23383;&#27573;&#12290;&#19981;&#21563;&#21512;&#26102;&#21487;&#20197;&#24341;&#21457;&#19968;&#20010;&#38169;&#35823;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn195&quot;&gt;&#36825;&#27491;&#26159; Django CSRF &#38450;&#25252;&#23618;&#23436;&#25104;&#30340;&#24037;&#20316;&#65292;&#27491;&#22914;&#19979;&#38754;&#30340;&#23567;&#33410;&#25152;&#20171;&#32461;&#30340;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id24&quot;&gt;
&lt;span id=&quot;cn196&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn196&quot;&gt;&#20351;&#29992;CSRF&#20013;&#38388;&#20214;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.csrf&lt;/span&gt;&lt;/tt&gt; &#24320;&#21457;&#21253;&#21482;&#26377;&#19968;&#20010;&#27169;&#22359;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;middleware.py&lt;/span&gt;&lt;/tt&gt; &#12290;&#35813;&#27169;&#22359;&#21253;&#21547;&#20102;&#19968;&#20010; Django &#20013;&#38388;&#20214;&#31867;&#8212;&#8212; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CsrfMiddleware&lt;/span&gt;&lt;/tt&gt; &#65292;&#35813;&#31867;&#23454;&#29616;&#20102; CSRF &#38450;&#25252;&#21151;&#33021;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&#22312;&#35774;&#32622;&#25991;&#20214;&#20013;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.csrf.middleware.CsrfMiddleware&apos;&lt;/span&gt;&lt;/tt&gt; &#28155;&#21152;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#21487;&#28608;&#27963; CSRF &#38450;&#25252;&#12290; &#35813;&#20013;&#38388;&#20214;&#24517;&#39035;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SessionMiddleware&lt;/span&gt;&lt;/tt&gt; &lt;em&gt;&#20043;&#21518;&lt;/em&gt; &#25191;&#34892;&#65292;&#22240;&#27492;&#22312;&#21015;&#34920;&#20013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CsrfMiddleware&lt;/span&gt;&lt;/tt&gt; &#24517;&#39035;&#20986;&#29616;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SessionMiddleware&lt;/span&gt;&lt;/tt&gt;
&lt;em&gt;&#20043;&#21069;&lt;/em&gt; &#65288;&#22240;&#20026;&#21709;&#24212;&#20013;&#38388;&#20214;&#26159;&#33258;&#21518;&#21521;&#21069;&#25191;&#34892;&#30340;&#65289;&#12290;
&#21516;&#26102;&#65292;&#23427;&#20063;&#24517;&#39035;&#22312;&#21709;&#24212;&#34987;&#21387;&#32553;&#25110;&#35299;&#21387;&#20043;&#21069;&#23545;&#21709;&#24212;&#32467;&#26524;&#36827;&#34892;&#22788;&#29702;&#65292;&#22240;&#27492; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CsrfMiddleware&lt;/span&gt;&lt;/tt&gt; &#24517;&#39035;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GZipMiddleware&lt;/span&gt;&lt;/tt&gt; &#20043;&#21518;&#25191;&#34892;&#12290;&#19968;&#26086;&#23558;&#23427;&#28155;&#21152;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt;&#35774;&#32622;&#20013;&#65292;&#20320;&#23601;&#23436;&#25104;&#20102;&#24037;&#20316;&#12290; &#21442;&#35265;&#31532;&#21313;&#20116;&#31456;&#30340;&#8220;MIDDLEWARE_CLASSES&#39034;&#24207;&#8221;&#23567;&#33410;&#20197;&#20102;&#35299;&#26356;&#22810;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&#22914;&#26524;&#24863;&#20852;&#36259;&#30340;&#35805;&#65292;&#19979;&#38754;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CsrfMiddleware&lt;/span&gt;&lt;/tt&gt; &#30340;&#24037;&#20316;&#27169;&#24335;&#12290; &#23427;&#23436;&#25104;&#20197;&#19979;&#20004;&#39033;&#24037;&#20316;&#65306;&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn200&quot;&gt;&#23427;&#20462;&#25913;&#24403;&#21069;&#22788;&#29702;&#30340;&#35831;&#27714;&#65292;&#21521;&#25152;&#26377;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#34920;&#21333;&#22686;&#28155;&#19968;&#20010;&#38544;&#34255;&#30340;&#34920;&#21333;&#23383;&#27573;&#65292;&#20351;&#29992;&#21517;&#31216;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csrfmiddlewaretoken&lt;/span&gt;&lt;/tt&gt; &#65292;&#20540;&#20026;&#24403;&#21069;&#20250;&#35805; ID &#21152;&#19978;&#19968;&#20010;&#23494;&#38053;&#30340;&#25955;&#21015;&#20540;&#12290; &#22914;&#26524;&#26410;&#35774;&#32622;&#20250;&#35805; ID &#65292;&#35813;&#20013;&#38388;&#20214;&#23558; &lt;em&gt;&#19981;&#20250;&lt;/em&gt; &#20462;&#25913;&#21709;&#24212;&#32467;&#26524;&#65292;&#22240;&#27492;&#23545;&#20110;&#26410;&#20351;&#29992;&#20250;&#35805;&#30340;&#35831;&#27714;&#26469;&#35828;&#24615;&#33021;&#25439;&#22833;&#26159;&#21487;&#20197;&#24573;&#30053;&#30340;&#12290;&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn201&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn201&quot;&gt;&#23545;&#20110;&#25152;&#26377;&#21547;&#20250;&#35805; cookie &#38598;&#21512;&#30340;&#20256;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#35831;&#27714;&#65292;&#23427;&#23558;&#26816;&#26597;&#26159;&#21542;&#23384;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csrfmiddlewaretoken&lt;/span&gt;&lt;/tt&gt; &#21450;&#20854;&#26159;&#21542;&#27491;&#30830;&#12290; &#22914;&#26524;&#19981;&#26159;&#30340;&#35805;&#65292;&#29992;&#25143;&#23558;&#20250;&#25910;&#21040;&#19968;&#20010; 403 &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HTTP&lt;/span&gt;&lt;/tt&gt; &#38169;&#35823;&#12290; 403 &#38169;&#35823;&#39029;&#38754;&#30340;&#20869;&#23481;&#26159;&#26816;&#27979;&#21040;&#20102;&#36328;&#22495;&#35831;&#27714;&#20266;&#35013;&#12290; &#32456;&#27490;&#35831;&#27714;&#12290;&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn202&quot;&gt;&#35813;&#27493;&#39588;&#30830;&#20445;&#21482;&#26377;&#28304;&#33258;&#20320;&#30340;&#31449;&#28857;&#30340;&#34920;&#21333;&#25165;&#33021;&#23558;&#25968;&#25454; POST &#22238;&#26469;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn203&quot;&gt;&#35813;&#20013;&#38388;&#20214;&#29305;&#24847;&#21482;&#38024;&#23545; HTTP &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#35831;&#27714;&#65288;&#20197;&#21450;&#23545;&#24212;&#30340; POST &#34920;&#21333;&#65289;&#12290; &#22914;&#25105;&#20204;&#25152;&#35299;&#37322;&#30340;&#65292;&#27704;&#36828;&#19981;&#24212;&#35813;&#22240;&#20026;&#20351;&#29992;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; &#35831;&#27714;&#32780;&#20135;&#29983;&#36127;&#38754;&#25928;&#24212;&#65292;&#20320;&#24517;&#39035;&#33258;&#24049;&#26469;&#30830;&#20445;&#36825;&#19968;&#28857;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn204&quot;&gt;&#26410;&#20351;&#29992;&#20250;&#35805; cookie &#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#35831;&#27714;&#26080;&#27861;&#21463;&#21040;&#20445;&#25252;&#65292;&#20294;&#23427;&#20204;&#20063;&#19981; &lt;em&gt;&#38656;&#35201;&lt;/em&gt; &#21463;&#21040;&#20445;&#25252;&#65292;&#22240;&#20026;&#24694;&#24847;&#32593;&#31449;&#21487;&#29992;&#20219;&#24847;&#26041;&#27861;&#26469;&#21046;&#36896;&#36825;&#31181;&#35831;&#27714;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn205&quot;&gt;&#20026;&#20102;&#36991;&#20813;&#36716;&#25442;&#38750; HTML &#35831;&#27714;&#65292;&#20013;&#38388;&#20214;&#22312;&#32534;&#36753;&#21709;&#24212;&#32467;&#26524;&#20043;&#21069;&#23545;&#23427;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Content-Type&lt;/span&gt;&lt;/tt&gt; &#22836;&#26631;&#36827;&#34892;&#26816;&#26597;&#12290; &#21482;&#26377;&#26631;&#35760;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;text/html&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;application/xml+xhtml&lt;/span&gt;&lt;/tt&gt; &#30340;&#39029;&#38754;&#25165;&#20250;&#34987;&#20462;&#25913;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id25&quot;&gt;
&lt;span id=&quot;cn206&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn206&quot;&gt;CSRF&#20013;&#38388;&#20214;&#30340;&#23616;&#38480;&#24615;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn207&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CsrfMiddleware&lt;/span&gt;&lt;/tt&gt; &#30340;&#36816;&#34892;&#38656;&#35201; Django &#30340;&#20250;&#35805;&#26694;&#26550;&#12290; &#65288;&#21442;&#38405;&#31532; 14 &#31456;&#20102;&#35299;&#26356;&#22810;&#20851;&#20110;&#20250;&#35805;&#30340;&#20869;&#23481;&#12290;&#65289;&#22914;&#26524;&#20320;&#20351;&#29992;&#20102;&#33258;&#23450;&#20041;&#20250;&#35805;&#25110;&#32773;&#36523;&#20221;&#39564;&#35777;&#26694;&#26550;&#25163;&#21160;&#31649;&#29702;&#20250;&#35805; cookies&#65292;&#35813;&#20013;&#38388;&#20214;&#23558;&#24110;&#19981;&#19978;&#20320;&#30340;&#24537;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn208&quot;&gt;&#22914;&#26524;&#20320;&#30340;&#24212;&#29992;&#31243;&#24207;&#20197;&#26576;&#31181;&#38750;&#24120;&#35268;&#30340;&#26041;&#27861;&#21019;&#24314; HTML &#39029;&#38754;&#65288;&#20363;&#22914;&#65306;&#22312; Javascript &#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;document.write&lt;/span&gt;&lt;/tt&gt;&#35821;&#21477;&#20013;&#21457;&#36865; HTML &#29255;&#27573;&#65289;&#65292;&#20320;&#21487;&#33021;&#20250;&#32469;&#24320;&#20102;&#21521;&#34920;&#21333;&#28155;&#21152;&#38544;&#34255;&#23383;&#27573;&#30340;&#36807;&#28388;&#22120;&#12290; &#22312;&#27492;&#24773;&#20917;&#19979;&#65292;&#34920;&#21333;&#25552;&#20132;&#27704;&#36828;&#26080;&#27861;&#25104;&#21151;&#12290;
&#65288;&#36825;&#26159;&#22240;&#20026;&#22312;&#39029;&#38754;&#21457;&#36865;&#21040;&#23458;&#25143;&#31471;&#20043;&#21069;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CsrfMiddleware&lt;/span&gt;&lt;/tt&gt;&#20351;&#29992;&#27491;&#21017;&#34920;&#36798;&#24335;&#26469;&#28155;&#21152;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csrfmiddlewaretoken&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#21040;&#20320;&#30340;HTML&#20013;&#65292;&#32780;&#27491;&#21017;&#34920;&#36798;&#24335;&#19981;&#33021;&#22788;&#29702;&#19981;&#35268;&#33539;&#30340;HTML&#12290;&#65289;&#22914;&#26524;&#20320;&#24576;&#30097;&#20986;&#29616;&#20102;&#36825;&#26679;&#30340;&#38382;&#39064;&#12290;&#20351;&#29992;&#20320;&#27983;&#35272;&#22120;&#30340;&#26597;&#30475;&#28304;&#20195;&#30721;&#21151;&#33021;&#20197;&#30830;&#23450;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csrfmiddlewaretoken&lt;/span&gt;&lt;/tt&gt;&#26159;&#21542;&#25554;&#20837;&#21040;&#20102;&#34920;&#21333;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&#24819;&#20102;&#35299;&#26356;&#22810;&#20851;&#20110; CSRF &#30340;&#20449;&#24687;&#21644;&#20363;&#23376;&#30340;&#35805;&#65292;&#21487;&#20197;&#35775;&#38382; &lt;a class=&quot;reference external&quot; href=&quot;http://en.wikipedia.org/wiki/CSRF&quot;&gt;http://en.wikipedia.org/wiki/CSRF&lt;/a&gt; &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id26&quot;&gt;
&lt;span id=&quot;cn210&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&#20154;&#24615;&#21270;&#25968;&#25454;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn211&quot;&gt;&#21253;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.humanize&lt;/span&gt;&lt;/tt&gt;&#21253;&#21547;&#20102;&#19968;&#20123;&#26159;&#25968;&#25454;&#26356;&#20154;&#24615;&#21270;&#30340;&#27169;&#26495;&#36807;&#28388;&#22120;&#12290; &#35201;&#28608;&#27963;&#36825;&#20123;&#36807;&#28388;&#22120;&#65292;&#35831;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.humanize&apos;&lt;/span&gt;&lt;/tt&gt;&#21152;&#20837;&#21040;&#20320;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt;&#20013;&#12290;&#23436;&#25104;&#20043;&#21518;&#65292;&#21521;&#27169;&#29256;&#20102;&#21152;&#20837;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;humanize&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#23601;&#21487;&#20197;&#20351;&#29992;&#19979;&#38754;&#30340;&#36807;&#28388;&#22120;&#20102;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;apnumber&quot;&gt;
&lt;span id=&quot;cn212&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn212&quot;&gt;apnumber&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn213&quot;&gt;&#23545;&#20110; 1 &#21040; 9 &#30340;&#25968;&#23383;&#65292;&#35813;&#36807;&#28388;&#22120;&#36820;&#22238;&#20102;&#25968;&#23383;&#30340;&#25340;&#20889;&#24418;&#24335;&#12290; &#21542;&#21017;&#65292;&#23427;&#23558;&#36820;&#22238;&#25968;&#23383;&#12290; &#36825;&#36981;&#24490;&#30340;&#26159;&#32654;&#32852;&#31038;&#39118;&#26684;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn214&quot;&gt;&#20030;&#20363;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn215&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn215&quot;&gt;1 &#21464;&#25104; one &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn216&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn216&quot;&gt;2 &#21464;&#25104; two &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn217&quot;&gt;10 &#21464;&#25104; 10 &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn218&quot;&gt;&#20320;&#21487;&#20197;&#20256;&#20837;&#19968;&#20010;&#25972;&#25968;&#25110;&#32773;&#34920;&#31034;&#25972;&#25968;&#30340;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;intcomma&quot;&gt;
&lt;span id=&quot;cn219&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn219&quot;&gt;intcomma&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn220&quot;&gt;&#35813;&#36807;&#28388;&#22120;&#23558;&#25972;&#25968;&#36716;&#25442;&#20026;&#27599;&#19977;&#20010;&#25968;&#23383;&#29992;&#19968;&#20010;&#36887;&#21495;&#20998;&#38548;&#30340;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn221&quot;&gt;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn222&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn222&quot;&gt;4500 &#21464;&#25104; 4,500 &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn223&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn223&quot;&gt;45000 &#21464;&#25104; 45,000 &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn224&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn224&quot;&gt;450000 &#21464;&#25104; 450,000 &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn225&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn225&quot;&gt;4500000 &#21464;&#25104; 4,500,000 &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn226&quot;&gt;&#21487;&#20197;&#20256;&#20837;&#25972;&#25968;&#25110;&#32773;&#34920;&#31034;&#25972;&#25968;&#30340;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;intword&quot;&gt;
&lt;span id=&quot;cn227&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn227&quot;&gt;intword&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn228&quot;&gt;&#35813;&#36807;&#28388;&#22120;&#23558;&#19968;&#20010;&#24456;&#22823;&#30340;&#25972;&#25968;&#36716;&#25442;&#25104;&#21451;&#22909;&#30340;&#25991;&#26412;&#34920;&#31034;&#26041;&#24335;&#12290; &#23427;&#23545;&#20110;&#36229;&#36807;&#19968;&#30334;&#19975;&#30340;&#25968;&#23383;&#26368;&#22909;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn229&quot;&gt;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn230&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn230&quot;&gt;1000000 &#21464;&#25104; 1.0 million &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn231&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn231&quot;&gt;1200000 &#21464;&#25104; 1.2 million &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn232&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn232&quot;&gt;1200000000 &#21464;&#25104; 1.2 billion &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn233&quot;&gt;&#26368;&#22823;&#25903;&#25345;&#19981;&#36229;&#36807;&#19968;&#21315;&#30340;&#20116;&#27425;&#26041;&#65288;1,000,000,000,000,000&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn234&quot;&gt;&#21487;&#20197;&#20256;&#20837;&#25972;&#25968;&#25110;&#32773;&#34920;&#31034;&#25972;&#25968;&#30340;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;ordinal&quot;&gt;
&lt;span id=&quot;cn235&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn235&quot;&gt;ordinal&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn236&quot;&gt;&#35813;&#36807;&#28388;&#22120;&#23558;&#25972;&#25968;&#36716;&#25442;&#20026;&#24207;&#25968;&#35789;&#30340;&#23383;&#31526;&#20018;&#24418;&#24335;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn237&quot;&gt;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn238&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn238&quot;&gt;1 &#21464;&#25104; 1st &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn239&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn239&quot;&gt;2 &#21464;&#25104; 2nd &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn240&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn240&quot;&gt;3 &#21464;&#25104; 3rd &#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn241&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn241&quot;&gt;254&#21464;&#25104;254th&#12290;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn242&quot;&gt;&#21487;&#20197;&#20256;&#20837;&#25972;&#25968;&#25110;&#32773;&#34920;&#31034;&#25972;&#25968;&#30340;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id27&quot;&gt;
&lt;span id=&quot;cn243&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn243&quot;&gt;&#26631;&#35760;&#36807;&#28388;&#22120;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn244&quot;&gt;&#21253;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.markup&lt;/span&gt;&lt;/tt&gt;&#21253;&#21547;&#20102;&#19968;&#20123;&#21015;Django&#27169;&#26495;&#36807;&#28388;&#22120;&#65292;&#27599;&#19968;&#20010;&#37117;&#23454;&#29616;&#20102;&#19968;&#20013;&#36890;&#29992;&#30340;&#26631;&#35760;&#35821;&#35328;&#12290;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn245&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn245&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;textile&lt;/span&gt;&lt;/tt&gt; : &#23454;&#29616;&#20102; Textile (&lt;a class=&quot;reference external&quot; href=&quot;http://en.wikipedia.org/wiki/Textile_%28markup_language%29&quot;&gt;http://en.wikipedia.org/wiki/Textile_%28markup_language%29&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn246&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn246&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;markdown&lt;/span&gt;&lt;/tt&gt; : &#23454;&#29616;&#20102; Markdown (&lt;a class=&quot;reference external&quot; href=&quot;http://en.wikipedia.org/wiki/Markdown&quot;&gt;http://en.wikipedia.org/wiki/Markdown&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn247&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn247&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;restructuredtext&lt;/span&gt;&lt;/tt&gt; : &#23454;&#29616;&#20102; ReStructured Text (&lt;a class=&quot;reference external&quot; href=&quot;http://en.wikipedia.org/wiki/ReStructuredText&quot;&gt;http://en.wikipedia.org/wiki/ReStructuredText&lt;/a&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn248&quot;&gt;&#27599;&#31181;&#24773;&#24418;&#19979;&#65292;&#36807;&#28388;&#22120;&#37117;&#26399;&#26395;&#23383;&#31526;&#20018;&#24418;&#24335;&#30340;&#26684;&#24335;&#21270;&#26631;&#35760;&#65292;&#24182;&#36820;&#22238;&#34920;&#31034;&#26631;&#35760;&#25991;&#26412;&#30340;&#23383;&#31526;&#20018;&#12290; &#20363;&#22914;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;textile&lt;/span&gt;&lt;/tt&gt;&#36807;&#28388;&#22120;&#21543;Textile&#26684;&#24335;&#30340;&#25991;&#26412;&#36716;&#25442;&#20026;HTML&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn250&quot;&gt;{% load markup %}
{{ object.content|textile }}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn251&quot;&gt;&#35201;&#28608;&#27963;&#36825;&#20123;&#36807;&#28388;&#22120;&#65292;&#20165;&#38656;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.contrib.markup&apos;&lt;/span&gt;&lt;/tt&gt; &#28155;&#21152;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#12290;
&#19968;&#26086;&#23436;&#25104;&#20102;&#35813;&#39033;&#24037;&#20316;&#65292;&#22312;&#27169;&#26495;&#20013;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;markup&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#23601;&#33021;&#20351;&#29992;&#36825;&#20123;&#36807;&#28388;&#22120;&#12290; &#35201;&#24819;&#25484;&#25569;&#26356;&#22810;&#20449;&#24687;&#30340;&#35805;&#65292;&#21487;&#38405;&#35835; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django/contrib/markup/templatetags/markup.py.&lt;/span&gt;&lt;/tt&gt; &#20869;&#30340;&#28304;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id28&quot;&gt;
&lt;span id=&quot;cn252&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn252&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn253&quot;&gt;&#36825;&#20123;&#32487;&#25215;&#26694;&#26550;&#65288;CSRF&#12289;&#36523;&#20221;&#39564;&#35777;&#31995;&#32479;&#31561;&#31561;&#65289;&#36890;&#36807;&#25552;&#20379; &lt;em&gt;&#20013;&#38388;&#20214;&lt;/em&gt; &#26469;&#23454;&#29616;&#20854;&#22855;&#22937;&#30340;&#21151;&#33021;&#12290;&#20013;&#38388;&#20214;&#26159;&#22312;&#35831;&#27714;&#20043;&#21069;/&#21518;&#25191;&#34892;&#30340;&#21487;&#20197;&#20462;&#25913;&#35831;&#27714;&#21644;&#21709;&#24212;&#30340;&#20195;&#30721;&#65292;&#23427;&#25193;&#23637;&#20102;&#26694;&#26550;&#12290; &#22312;&#19979;&#19968;&#31456;&#65292;&#25105;&#20204;&#23558;&#20171;&#32461;Django&#30340;&#20013;&#38388;&#20214;&#24182;&#35299;&#37322;&#24590;&#26679;&#20889;&#20986;&#33258;&#24049;&#30340;&#20013;&#38388;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn254&quot;&gt;&#21463;&lt;a class=&quot;reference external&quot; href=&quot;/license/&quot;&gt;GNU Free Document License&lt;/a&gt;&#32422;&#26463;&#12290; &#35880;&#22857;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter17</id>
        <title type="html">chapter17</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter17"/>
        <published>2015-02-26T20:44:57+08:00</published>
        <updated>2015-02-26T20:44:57+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#21313;&#19971;&#31456;&#65306; &#20013;&#38388;&#20214;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;&#22312;&#26377;&#20123;&#22330;&#21512;&#65292;&#38656;&#35201;&#23545;Django&#22788;&#29702;&#30340;&#27599;&#20010;request&#37117;&#25191;&#34892;&#26576;&#27573;&#20195;&#30721;&#12290; &#36825;&#31867;&#20195;&#30721;&#21487;&#33021;&#26159;&#22312;view&#22788;&#29702;&#20043;&#21069;&#20462;&#25913;&#20256;&#20837;&#30340;request&#65292;&#25110;&#32773;&#35760;&#24405;&#26085;&#24535;&#20449;&#24687;&#20197;&#20415;&#20110;&#35843;&#35797;&#65292;&#31561;&#31561;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#36825;&#31867;&#21151;&#33021;&#21487;&#20197;&#29992;Django&#30340;&#20013;&#38388;&#20214;&#26694;&#26550;&#26469;&#23454;&#29616;&#65292;&#35813;&#26694;&#26550;&#30001;&#20999;&#20837;&#21040;Django&#30340;request/response&#22788;&#29702;&#36807;&#31243;&#20013;&#30340;&#38057;&#23376;&#38598;&#21512;&#32452;&#25104;&#12290; &#36825;&#20010;&#36731;&#37327;&#32423;&#20302;&#23618;&#27425;&#30340;plug-in&#31995;&#32479;&#65292;&#33021;&#29992;&#20110;&#20840;&#38754;&#30340;&#20462;&#25913;Django&#30340;&#36755;&#20837;&#21644;&#36755;&#20986;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#27599;&#20010;&#20013;&#38388;&#20214;&#32452;&#20214;&#37117;&#29992;&#20110;&#26576;&#20010;&#29305;&#23450;&#30340;&#21151;&#33021;&#12290; &#22914;&#26524;&#20320;&#26159;&#39034;&#30528;&#36825;&#26412;&#20070;&#35835;&#19979;&#26469;&#30340;&#35805;&#65292;&#20320;&#24212;&#35813;&#24050;&#32463;&#22810;&#27425;&#35265;&#21040;&#8220;&#20013;&#38388;&#20214;&#8221;&#20102;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn4&quot;&gt;&#31532;12&#31456;&#20013;&#25152;&#26377;&#30340;session&#21644;user&#24037;&#20855;&#37117;&#31821;&#30001;&#19968;&#23567;&#31751;&#20013;&#38388;&#20214;&#23454;&#29616;(&#20363;&#22914;&#65292;&#30001;&#20013;&#38388;&#20214;&#35774;&#23450;view&#20013;&#21487;&#35265;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.session&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.user&lt;/span&gt;&lt;/tt&gt; )&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn5&quot;&gt;&#31532;13&#31456;&#35752;&#35770;&#30340;&#31449;&#28857;&#33539;&#22260;cache&#23454;&#38469;&#19978;&#20063;&#26159;&#30001;&#19968;&#20010;&#20013;&#38388;&#20214;&#23454;&#29616;&#65292;&#19968;&#26086;&#35813;&#20013;&#38388;&#20214;&#21457;&#29616;&#19982;view&#30456;&#24212;&#30340;response&#24050;&#22312;&#32531;&#23384;&#20013;&#65292;&#23601;&#19981;&#20877;&#35843;&#29992;&#23545;&#24212;&#30340;view&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn6&quot;&gt;&#31532;14&#31456;&#25152;&#20171;&#32461;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;flatpages&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;redirects&lt;/span&gt;&lt;/tt&gt; , &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;csrf&lt;/span&gt;&lt;/tt&gt; &#31561;&#24212;&#29992;&#20063;&#37117;&#26159;&#36890;&#36807;&#20013;&#38388;&#20214;&#32452;&#20214;&#26469;&#23436;&#25104;&#20854;&#39764;&#27861;&#33324;&#30340;&#21151;&#33021;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#36825;&#19968;&#31456;&#23558;&#28145;&#20837;&#21040;&#20013;&#38388;&#20214;&#21450;&#20854;&#24037;&#20316;&#26426;&#21046;&#20013;&#65292;&#24182;&#38416;&#36848;&#22914;&#20309;&#33258;&#34892;&#32534;&#20889;&#20013;&#38388;&#20214;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn8&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#20160;&#20040;&#26159;&#20013;&#38388;&#20214;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#25105;&#20204;&#20174;&#19968;&#20010;&#31616;&#21333;&#30340;&#20363;&#23376;&#24320;&#22987;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#39640;&#27969;&#37327;&#30340;&#31449;&#28857;&#36890;&#24120;&#38656;&#35201;&#23558;Django&#37096;&#32626;&#22312;&#36127;&#36733;&#24179;&#34913;proxy(&#21442;&#35265;&#31532;20&#31456;)&#20043;&#21518;&#12290; &#36825;&#31181;&#26041;&#24335;&#23558;&#24102;&#26469;&#19968;&#20123;&#22797;&#26434;&#24615;&#65292;&#20854;&#19968;&#23601;&#26159;&#27599;&#20010;request&#20013;&#30340;&#36828;&#31243;IP&#22320;&#22336;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META[&quot;REMOTE_IP&quot;]&lt;/span&gt;&lt;/tt&gt;)&#23558;&#25351;&#21521;&#35813;&#36127;&#36733;&#24179;&#34913;proxy&#65292;&#32780;&#19981;&#26159;&#21457;&#36215;&#36825;&#20010;request&#30340;&#23454;&#38469;IP&#12290; &#36127;&#36733;&#24179;&#34913;proxy&#22788;&#29702;&#36825;&#20010;&#38382;&#39064;&#30340;&#26041;&#27861;&#22312;&#29305;&#27530;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;X-Forwarded-For&lt;/span&gt;&lt;/tt&gt; &#20013;&#35774;&#32622;&#23454;&#38469;&#21457;&#36215;&#35831;&#27714;&#30340;IP&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#22240;&#27492;&#65292;&#38656;&#35201;&#19968;&#20010;&#23567;&#23567;&#30340;&#20013;&#38388;&#20214;&#26469;&#30830;&#20445;&#36816;&#34892;&#22312;proxy&#20043;&#21518;&#30340;&#31449;&#28857;&#20063;&#33021;&#22815;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META[&quot;REMOTE_ADDR&quot;]&lt;/span&gt;&lt;/tt&gt; &#20013;&#24471;&#21040;&#27491;&#30830;&#30340;IP&#22320;&#22336;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn13&quot;&gt;class SetRemoteAddrFromForwardedFor(object):
    def process_request(self, request):
        try:
            real_ip = request.META[&apos;HTTP_X_FORWARDED_FOR&apos;]
        except KeyError:
            pass
        else:
            # HTTP_X_FORWARDED_FOR can be a comma-separated list of IPs.
            # Take just the first one.
            real_ip = real_ip.split(&quot;,&quot;)[0]
            request.META[&apos;REMOTE_ADDR&apos;] = real_ip
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;(Note: Although the HTTP header is called &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;X-Forwarded-For&lt;/span&gt;&lt;/tt&gt; , Django makes it
available as &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META[&apos;HTTP_X_FORWARDED_FOR&apos;]&lt;/span&gt;&lt;/tt&gt; . With the exception of
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;content-length&lt;/span&gt;&lt;/tt&gt; and &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;content-type&lt;/span&gt;&lt;/tt&gt; , any HTTP headers in the request are
converted to &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META&lt;/span&gt;&lt;/tt&gt; keys by converting all characters to uppercase,
replacing any hyphens with underscores and adding an &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HTTP_&lt;/span&gt;&lt;/tt&gt; prefix to the
name.)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#19968;&#26086;&#23433;&#35013;&#20102;&#35813;&#20013;&#38388;&#20214;(&#21442;&#35265;&#19979;&#19968;&#33410;)&#65292;&#27599;&#20010;request&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;X-Forwarded-For&lt;/span&gt;&lt;/tt&gt; &#20540;&#37117;&#20250;&#34987;&#33258;&#21160;&#25554;&#20837;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META[&apos;REMOTE_ADDR&apos;]&lt;/span&gt;&lt;/tt&gt; &#20013;&#12290;&#36825;&#26679;&#65292;Django&#24212;&#29992;&#23601;&#19981;&#38656;&#35201;&#20851;&#24515;&#33258;&#24049;&#26159;&#21542;&#20301;&#20110;&#36127;&#36733;&#24179;&#34913;proxy&#20043;&#21518;&#65307;&#31616;&#21333;&#35835;&#21462; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META[&apos;REMOTE_ADDR&apos;]&lt;/span&gt;&lt;/tt&gt; &#30340;&#26041;&#24335;&#22312;&#26159;&#21542;&#26377;proxy&#30340;&#24773;&#24418;&#19979;&#37117;&#23558;&#27491;&#24120;&#24037;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#23454;&#38469;&#19978;&#65292;&#20026;&#38024;&#23545;&#36825;&#20010;&#38750;&#24120;&#24120;&#35265;&#30340;&#24773;&#24418;&#65292;Django&#24050;&#23558;&#35813;&#20013;&#38388;&#20214;&#20869;&#32622;&#12290; &#23427;&#20301;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.http&lt;/span&gt;&lt;/tt&gt; &#20013;, &#19979;&#19968;&#33410;&#23558;&#32473;&#20986;&#36825;&#20010;&#20013;&#38388;&#20214;&#30456;&#20851;&#30340;&#26356;&#22810;&#32454;&#33410;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn17&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#23433;&#35013;&#20013;&#38388;&#20214;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#22914;&#26524;&#25353;&#39034;&#24207;&#38405;&#35835;&#26412;&#20070;&#65292;&#24212;&#24403;&#24050;&#32463;&#30475;&#21040;&#28041;&#21450;&#21040;&#20013;&#38388;&#20214;&#23433;&#35013;&#30340;&#22810;&#20010;&#31034;&#20363;,&#22240;&#20026;&#21069;&#38754;&#31456;&#33410;&#30340;&#35768;&#22810;&#20363;&#23376;&#37117;&#38656;&#35201;&#26576;&#20123;&#29305;&#23450;&#30340;&#20013;&#38388;&#20214;&#12290; &#20986;&#20110;&#23436;&#25972;&#24615;&#32771;&#34385;&#65292;&#19979;&#38754;&#20171;&#32461;&#22914;&#20309;&#23433;&#35013;&#20013;&#38388;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#35201;&#21551;&#29992;&#19968;&#20010;&#20013;&#38388;&#20214;&#65292;&#21482;&#38656;&#23558;&#20854;&#28155;&#21152;&#21040;&#37197;&#32622;&#27169;&#22359;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#20803;&#32452;&#20013;&#12290; &#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#20013;&#65292;&#20013;&#38388;&#20214;&#32452;&#20214;&#29992;&#23383;&#31526;&#20018;&#34920;&#31034;&#65306; &#25351;&#21521;&#20013;&#38388;&#20214;&#31867;&#21517;&#30340;&#23436;&#25972;Python&#36335;&#24452;&#12290; &#20363;&#22914;&#65292;&#19979;&#38754;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startproject&lt;/span&gt;&lt;/tt&gt; &#21019;&#24314;&#30340;&#32570;&#30465; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; :&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn21&quot;&gt;MIDDLEWARE_CLASSES = (
    &apos;django.middleware.common.CommonMiddleware&apos;,
    &apos;django.contrib.sessions.middleware.SessionMiddleware&apos;,
    &apos;django.contrib.auth.middleware.AuthenticationMiddleware&apos;,
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;Django&#39033;&#30446;&#30340;&#23433;&#35013;&#24182;&#19981;&#24378;&#21046;&#35201;&#27714;&#20219;&#20309;&#20013;&#38388;&#20214;&#65292;&#22914;&#26524;&#20320;&#24895;&#24847;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#21487;&#20197;&#20026;&#31354;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#36825;&#37324;&#20013;&#38388;&#20214;&#20986;&#29616;&#30340;&#39034;&#24207;&#38750;&#24120;&#37325;&#35201;&#12290; &#22312;request&#21644;view&#30340;&#22788;&#29702;&#38454;&#27573;&#65292;Django&#25353;&#29031; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#20013;&#20986;&#29616;&#30340;&#39034;&#24207;&#26469;&#24212;&#29992;&#20013;&#38388;&#20214;&#65292;&#32780;&#22312;response&#21644;&#24322;&#24120;&#22788;&#29702;&#38454;&#27573;&#65292;Django&#21017;&#25353;&#36870;&#24207;&#26469;&#35843;&#29992;&#23427;&#20204;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;Django&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#35270;&#20026;view&#20989;&#25968;&#22806;&#23618;&#30340;&#39034;&#24207;&#21253;&#35013;&#23376;&#65306; &#22312;request&#38454;&#27573;&#25353;&#39034;&#24207;&#20174;&#19978;&#21040;&#19979;&#31359;&#36807;&#65292;&#32780;&#22312;response&#21017;&#21453;&#36807;&#26469;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn24&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#20013;&#38388;&#20214;&#26041;&#27861;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#29616;&#22312;&#65292;&#25105;&#20204;&#24050;&#32463;&#30693;&#36947;&#20160;&#20040;&#26159;&#20013;&#38388;&#20214;&#21644;&#24590;&#20040;&#23433;&#35013;&#23427;&#65292;&#19979;&#38754;&#23558;&#20171;&#32461;&#20013;&#38388;&#20214;&#31867;&#20013;&#21487;&#20197;&#23450;&#20041;&#30340;&#25152;&#26377;&#26041;&#27861;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;initializer-init-self-init-self&quot;&gt;
&lt;span id=&quot;cn26&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn26&quot;&gt;Initializer: __init__(self) __init__(self)&#12300;&#21021;&#22987;&#21270;&#65341;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&#22312;&#20013;&#38388;&#20214;&#31867;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__init__()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#29992;&#20110;&#25191;&#34892;&#31995;&#32479;&#33539;&#22260;&#30340;&#35774;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&#20986;&#20110;&#24615;&#33021;&#30340;&#32771;&#34385;&#65292;&#27599;&#20010;&#24050;&#21551;&#29992;&#30340;&#20013;&#38388;&#20214;&#22312;&#27599;&#20010;&#26381;&#21153;&#22120;&#36827;&#31243;&#20013;&#21482;&#21021;&#22987;&#21270; &lt;em&gt;&#19968;&lt;/em&gt; &#27425;&#12290; &#20063;&#23601;&#26159;&#35828;  &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__init__()&lt;/span&gt;&lt;/tt&gt; &#20165;&#22312;&#26381;&#21153;&#36827;&#31243;&#21551;&#21160;&#30340;&#26102;&#20505;&#35843;&#29992;&#65292;&#32780;&#22312;&#38024;&#23545;&#21333;&#20010;request&#22788;&#29702;&#26102;&#24182;&#19981;&#25191;&#34892;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#23545;&#19968;&#20010;middleware&#32780;&#35328;&#65292;&#23450;&#20041; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__init__()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#30340;&#36890;&#24120;&#21407;&#22240;&#26159;&#26816;&#26597;&#33258;&#36523;&#30340;&#24517;&#35201;&#24615;&#12290; &#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__init__()&lt;/span&gt;&lt;/tt&gt; &#25243;&#20986;&#24322;&#24120; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.core.exceptions.MiddlewareNotUsed&lt;/span&gt;&lt;/tt&gt; ,&#21017;Django&#23558;&#20174;middleware&#26632;&#20013;&#31227;&#20986;&#35813;middleware&#12290; &#21487;&#20197;&#29992;&#36825;&#20010;&#26426;&#21046;&#26469;&#26816;&#26597;middleware&#20381;&#36182;&#30340;&#36719;&#20214;&#26159;&#21542;&#23384;&#22312;&#12289;&#26381;&#21153;&#26159;&#21542;&#36816;&#34892;&#20110;&#35843;&#35797;&#27169;&#24335;&#12289;&#20197;&#21450;&#20219;&#20309;&#20854;&#23427;&#29615;&#22659;&#22240;&#32032;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#22312;&#20013;&#38388;&#20214;&#20013;&#23450;&#20041; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;__init__()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#26102;&#65292;&#38500;&#20102;&#26631;&#20934;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;self&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#20043;&#22806;&#65292;&#19981;&#24212;&#23450;&#20041;&#20219;&#20309;&#20854;&#23427;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;request-process-request-self-request-process-request-self-request&quot;&gt;
&lt;span id=&quot;cn31&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn31&quot;&gt;Request&#39044;&#22788;&#29702;&#20989;&#25968;: process_request(self, request) process_request(self, request)&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#36825;&#20010;&#26041;&#27861;&#30340;&#35843;&#29992;&#26102;&#26426;&#22312;Django&#25509;&#25910;&#21040;request&#20043;&#21518;&#65292;&#20294;&#20173;&#26410;&#35299;&#26512;URL&#20197;&#30830;&#23450;&#24212;&#24403;&#36816;&#34892;&#30340;view&#20043;&#21069;&#12290; Django&#21521;&#23427;&#20256;&#20837;&#30456;&#24212;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#20197;&#20415;&#22312;&#26041;&#27861;&#20013;&#20462;&#25913;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;process_request()&lt;/span&gt;&lt;/tt&gt; &#24212;&#24403;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;.&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn34&quot;&gt;&#22914;&#26524;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; , Django&#23558;&#32487;&#32493;&#22788;&#29702;&#36825;&#20010;request,&#25191;&#34892;&#21518;&#32493;&#30340;&#20013;&#38388;&#20214;&#65292; &#28982;&#21518;&#35843;&#29992;&#30456;&#24212;&#30340;view.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn35&quot;&gt;&#22914;&#26524;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;, Django &#23558;&#19981;&#20877;&#25191;&#34892; &lt;em&gt;&#20219;&#20309;&lt;/em&gt; &#20854;&#23427;&#30340;&#20013;&#38388;&#20214;(&#32780;&#26080;&#35270;&#20854;&#31181;&#31867;)&#20197;&#21450;&#30456;&#24212;&#30340;view&#12290; Django&#23558;&#31435;&#21363;&#36820;&#22238;&#35813; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;view-process-view-self-request-view-args-kwargs-process-view-self-request-view-args-kwargs&quot;&gt;
&lt;span id=&quot;cn36&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn36&quot;&gt;View&#39044;&#22788;&#29702;&#20989;&#25968;: process_view(self, request, view, args, kwargs) process_view(self, request, view, args, kwargs)&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#36825;&#20010;&#26041;&#27861;&#30340;&#35843;&#29992;&#26102;&#26426;&#22312;Django&#25191;&#34892;&#23436;request&#39044;&#22788;&#29702;&#20989;&#25968;&#24182;&#30830;&#23450;&#24453;&#25191;&#34892;&#30340;view&#20043;&#21518;&#65292;&#20294;&#22312;view&#20989;&#25968;&#23454;&#38469;&#25191;&#34892;&#20043;&#21069;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#34920;15-1&#21015;&#20986;&#20102;&#20256;&#20837;&#21040;&#36825;&#20010;View&#39044;&#22788;&#29702;&#20989;&#25968;&#30340;&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;table class=&quot;cn docutils&quot; id=&quot;cn39&quot;&gt;
&lt;caption&gt;&#34920; 15-1.  &#20256;&#20837;process_view()&#30340;&#21442;&#25968;&lt;/caption&gt;
&lt;colgroup&gt;
&lt;col width=&quot;14%&quot;&gt;
&lt;col width=&quot;86%&quot;&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&#21442;&#25968;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;&#35828;&#26126;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;The &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; object.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;view&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;The Python function that Django will call to handle this request.
This is the actual function object itself, not the name of the
function as a string.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;args&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;dl class=&quot;first last docutils&quot;&gt;
&lt;dt&gt;&#23558;&#20256;&#20837;view&#30340;&#20301;&#32622;&#21442;&#25968;&#21015;&#34920;&#65292;&#20294;&#19981;&#21253;&#25324;&lt;/dt&gt;
&lt;dd&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;(&#23427;&#36890;&#24120;&#26159;&#20256; &#20837;view&#30340;&#31532;&#19968;&#20010;&#21442;&#25968;)&lt;/dd&gt;
&lt;/dl&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;kwargs&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&#23558;&#20256;&#20837;view&#30340;&#20851;&#38190;&#23383;&#21442;&#25968;&#23383;&#20856;.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn40&quot;&gt;Just like &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;process_request()&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;process_view()&lt;/span&gt;&lt;/tt&gt; should return either
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; or an &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; object.&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn41&quot;&gt;If it returns &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; , Django will continue processing this request,
executing any other middleware and then the appropriate view.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn42&quot;&gt;If it returns an &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; object, Django won&#8217;t bother calling &lt;em&gt;any&lt;/em&gt;
other middleware (of any type) or the appropriate view. Django will
immediately return that &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;response-process-response-self-request-response-process-response-self-request-response&quot;&gt;
&lt;span id=&quot;cn43&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn43&quot;&gt;Response&#21518;&#22788;&#29702;&#20989;&#25968;: process_response(self, request, response) process_response(self, request, response)&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#36825;&#20010;&#26041;&#27861;&#30340;&#35843;&#29992;&#26102;&#26426;&#22312;Django&#25191;&#34892;view&#20989;&#25968;&#24182;&#29983;&#25104;response&#20043;&#21518;&#12290; Here, the processor can modify the content of a response. One
obvious use case is content compression, such as gzipping of the request&#8217;s
HTML.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#36825;&#20010;&#26041;&#27861;&#30340;&#21442;&#25968;&#30456;&#24403;&#30452;&#35266;: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; &#26159;request&#23545;&#35937;&#65292;&#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;response&lt;/span&gt;&lt;/tt&gt; &#21017;&#26159;&#20174;view&#20013;&#36820;&#22238;&#30340;response&#23545;&#35937;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; is the request
object, and &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;response&lt;/span&gt;&lt;/tt&gt; is the response object returned from the view.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#19981;&#21516;&#21487;&#33021;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; &#30340;request&#21644;view&#39044;&#22788;&#29702;&#20989;&#25968;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;process_response()&lt;/span&gt;&lt;/tt&gt; &lt;em&gt;&#24517;&#39035;&lt;/em&gt; &#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;. &#36825;&#20010;response&#23545;&#35937;&#21487;&#20197;&#26159;&#20256;&#20837;&#20989;&#25968;&#30340;&#37027;&#19968;&#20010;&#21407;&#22987;&#23545;&#35937;(&#36890;&#24120;&#24050;&#34987;&#20462;&#25913;)&#65292;&#20063;&#21487;&#20197;&#26159;&#20840;&#26032;&#29983;&#25104;&#30340;&#12290; That response
could be the original one passed into the function (possibly modified) or a
brand-new one.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;exception-process-exception-self-request-exception-process-exception-self-request-exception&quot;&gt;
&lt;span id=&quot;cn47&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn47&quot;&gt;Exception&#21518;&#22788;&#29702;&#20989;&#25968;: process_exception(self, request, exception) process_exception(self, request, exception)&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#36825;&#20010;&#26041;&#27861;&#21482;&#26377;&#22312;request&#22788;&#29702;&#36807;&#31243;&#20013;&#20986;&#20102;&#38382;&#39064;&#24182;&#19988;view&#20989;&#25968;&#25243;&#20986;&#20102;&#19968;&#20010;&#26410;&#25429;&#33719;&#30340;&#24322;&#24120;&#26102;&#25165;&#20250;&#34987;&#35843;&#29992;&#12290; &#36825;&#20010;&#38057;&#23376;&#21487;&#20197;&#29992;&#26469;&#21457;&#36865;&#38169;&#35823;&#36890;&#30693;&#65292;&#23558;&#29616;&#22330;&#30456;&#20851;&#20449;&#24687;&#36755;&#20986;&#21040;&#26085;&#24535;&#25991;&#20214;, &#25110;&#32773;&#29978;&#33267;&#23581;&#35797;&#20174;&#38169;&#35823;&#20013;&#33258;&#21160;&#24674;&#22797;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#36825;&#20010;&#20989;&#25968;&#30340;&#21442;&#25968;&#38500;&#20102;&#19968;&#36143;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#20043;&#22806;&#65292;&#36824;&#21253;&#25324;view&#20989;&#25968;&#25243;&#20986;&#30340;&#23454;&#38469;&#30340;&#24322;&#24120;&#23545;&#35937; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;exception&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;process_exception()&lt;/span&gt;&lt;/tt&gt; &#24212;&#24403;&#36820;&#22238; None &#25110; HttpResponse &#23545;&#35937;.&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn51&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn51&quot;&gt;&#22914;&#26524;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; , Django&#23558;&#29992;&#26694;&#26550;&#20869;&#32622;&#30340;&#24322;&#24120;&#22788;&#29702;&#26426;&#21046;&#32487;&#32493;&#22788;&#29702;&#30456;&#24212;request&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn52&quot;&gt;&#22914;&#26524;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpResponse&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;, Django &#23558;&#20351;&#29992;&#35813;response&#23545;&#35937;&#65292;&#32780;&#30701;&#36335;&#26694;&#26550;&#20869;&#32622;&#30340;&#24322;&#24120;&#22788;&#29702;&#26426;&#21046;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#22791;&#27880;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn54&quot;&gt;Django&#33258;&#24102;&#20102;&#30456;&#24403;&#25968;&#37327;&#30340;&#20013;&#38388;&#20214;&#31867;(&#23558;&#22312;&#38543;&#21518;&#31456;&#33410;&#20171;&#32461;)&#65292;&#23427;&#20204;&#37117;&#26159;&#30456;&#24403;&#22909;&#30340;&#33539;&#20363;&#12290; &#38405;&#35835;&#36825;&#20123;&#20195;&#30721;&#23558;&#20351;&#20320;&#23545;&#20013;&#38388;&#20214;&#30340;&#24378;&#22823;&#26377;&#19968;&#20010;&#24456;&#22909;&#30340;&#35748;&#35782;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#22312;Djangos wiki&#19978;&#20063;&#21487;&#20197;&#25214;&#21040;&#22823;&#37327;&#30340;&#31038;&#21306;&#36129;&#29486;&#30340;&#20013;&#38388;&#20214;&#33539;&#20363;: &lt;a class=&quot;reference external&quot; href=&quot;http://code.djangoproject.com/wiki/ContributedMiddleware&quot;&gt;http://code.djangoproject.com/wiki/ContributedMiddleware&lt;/a&gt;
&lt;a class=&quot;reference external&quot; href=&quot;http://code.djangoproject.com/wiki/ContributedMiddleware&quot;&gt;http://code.djangoproject.com/wiki/ContributedMiddleware&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn56&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#20869;&#32622;&#30340;&#20013;&#38388;&#20214;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;Django&#33258;&#24102;&#33509;&#24178;&#20869;&#32622;&#20013;&#38388;&#20214;&#20197;&#22788;&#29702;&#24120;&#35265;&#38382;&#39064;&#65292;&#23558;&#20174;&#19979;&#19968;&#33410;&#24320;&#22987;&#35752;&#35770;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn58&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&#35748;&#35777;&#25903;&#25345;&#20013;&#38388;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#20013;&#38388;&#20214;&#31867;: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.auth.middleware.AuthenticationMiddleware&lt;/span&gt;&lt;/tt&gt; . &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.auth.middleware.AuthenticationMiddleware&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#36825;&#20010;&#20013;&#38388;&#20214;&#28608;&#27963;&#35748;&#35777;&#25903;&#25345;&#21151;&#33021;. &#23427;&#22312;&#27599;&#20010;&#20256;&#20837;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#20013;&#28155;&#21152;&#20195;&#34920;&#24403;&#21069;&#30331;&#24405;&#29992;&#25143;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.user&lt;/span&gt;&lt;/tt&gt; &#23646;&#24615;&#12290; It adds the &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.user&lt;/span&gt;&lt;/tt&gt;
attribute, representing the currently logged-in user, to every incoming
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt; object.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&#23436;&#25972;&#30340;&#32454;&#33410;&#35831;&#21442;&#35265;&#31532;12&#31456;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn62&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#36890;&#29992;&#20013;&#38388;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;Middleware class: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.common.CommonMiddleware&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#36825;&#20010;&#20013;&#38388;&#20214;&#20026;&#23436;&#32654;&#20027;&#20041;&#32773;&#25552;&#20379;&#20102;&#19968;&#20123;&#20415;&#21033;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&lt;em&gt;&#31105;&#27490; ``DISALLOWED_USER_AGENTS`` &#21015;&#34920;&#20013;&#25152;&#35774;&#32622;&#30340;user agent&#35775;&#38382;&lt;/em&gt; &#65306;&#19968;&#26086;&#25552;&#20379;&#65292;&#36825;&#19968;&#21015;&#34920;&#24212;&#24403;&#30001;&#24050;&#32534;&#35793;&#30340;&#27491;&#21017;&#34920;&#36798;&#24335;&#23545;&#35937;&#32452;&#25104;&#65292;&#36825;&#20123;&#23545;&#35937;&#29992;&#20110;&#21305;&#37197;&#20256;&#20837;&#30340;request&#35831;&#27714;&#22836;&#20013;&#30340;user-agent&#22495;&#12290; &#19979;&#38754;&#36825;&#20010;&#20363;&#23376;&#26469;&#33258;&#26576;&#20010;&#37197;&#32622;&#25991;&#20214;&#29255;&#27573;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn67&quot;&gt;import re

DISALLOWED_USER_AGENTS = (
    re.compile(r&apos;^OmniExplorer_Bot&apos;),
    re.compile(r&apos;^Googlebot&apos;)
)
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#35831;&#27880;&#24847; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;re&lt;/span&gt;&lt;/tt&gt; ,&#22240;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DISALLOWED_USER_AGENTS&lt;/span&gt;&lt;/tt&gt; &#35201;&#27714;&#20854;&#20540;&#20026;&#24050;&#32534;&#35793;&#30340;&#27491;&#21017;&#34920;&#36798;&#24335;(&#20063;&#23601;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;re.compile()&lt;/span&gt;&lt;/tt&gt; &#30340;&#36820;&#22238;&#20540;)&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&lt;em&gt;&#20381;&#25454; ``APPEND_SLASH`` &#21644; ``PREPEND_WWW`` &#30340;&#35774;&#32622;&#25191;&#34892;URL&#37325;&#20889;&lt;/em&gt; &#65306;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;APPEND_SLASH&lt;/span&gt;&lt;/tt&gt; &#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; , &#37027;&#20123;&#23614;&#37096;&#27809;&#26377;&#26012;&#26464;&#30340;URL&#23558;&#34987;&#37325;&#23450;&#21521;&#21040;&#28155;&#21152;&#20102;&#26012;&#26464;&#30340;&#30456;&#24212;URL&#65292;&#38500;&#38750;path&#30340;&#26368;&#26411;&#32452;&#25104;&#37096;&#20998;&#21253;&#21547;&#28857;&#21495;&#12290; &#22240;&#27492;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo.com/bar&lt;/span&gt;&lt;/tt&gt; &#20250;&#34987;&#37325;&#23450;&#21521;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo.com/bar/&lt;/span&gt;&lt;/tt&gt; , &#20294;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;foo.com/bar/file.txt&lt;/span&gt;&lt;/tt&gt; &#23558;&#20197;&#19981;&#21464;&#24418;&#24335;&#36890;&#36807;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PREPEND_WWW&lt;/span&gt;&lt;/tt&gt; &#20026; True , &#37027;&#20123;&#32570;&#23569;&#20808;&#23548;www.&#30340;URLs&#23558;&#20250;&#34987;&#37325;&#23450;&#21521;&#21040;&#21547;&#26377;&#20808;&#23548;www.&#30340;&#30456;&#24212;URL&#19978;&#12290; will be
redirected to the same URL with a leading www..&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#36825;&#20004;&#20010;&#36873;&#39033;&#37117;&#26159;&#20026;&#20102;&#35268;&#33539;&#21270;URL&#12290; &#20854;&#21518;&#30340;&#21746;&#23398;&#26159;&#27599;&#20010;URL&#37117;&#24212;&#19988;&#21482;&#24212;&#24403;&#23384;&#22312;&#20110;&#19968;&#22788;&#12290; &#25216;&#26415;&#19978;&#26469;&#35828;&#65292;URL &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/bar&lt;/span&gt;&lt;/tt&gt; &#19982; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;example.com/bar/&lt;/span&gt;&lt;/tt&gt; &#21450; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;www.example.com/bar/&lt;/span&gt;&lt;/tt&gt; &#37117;&#20114;&#19981;&#30456;&#21516;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&lt;em&gt;&#20381;&#25454; ``USE_ETAGS`` &#30340;&#35774;&#32622;&#22788;&#29702;Etag&lt;/em&gt; : &lt;em&gt;ETags&lt;/em&gt; &#26159;HTTP&#32423;&#21035;&#19978;&#25353;&#26465;&#20214;&#32531;&#23384;&#39029;&#38754;&#30340;&#20248;&#21270;&#26426;&#21046;&#12290; &#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;USE_ETAGS&lt;/span&gt;&lt;/tt&gt; &#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#65292;Django&#38024;&#23545;&#27599;&#20010;&#35831;&#27714;&#20197;MD5&#31639;&#27861;&#22788;&#29702;&#39029;&#38754;&#20869;&#23481;&#65292;&#20174;&#32780;&#24471;&#21040;Etag, &#22312;&#27492;&#22522;&#30784;&#19978;&#65292;Django&#23558;&#22312;&#36866;&#24403;&#24773;&#24418;&#19979;&#22788;&#29702;&#24182;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Not&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Modified&lt;/span&gt;&lt;/tt&gt; &#22238;&#24212;(&#35793;&#27880;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&#35831;&#27880;&#24847;&#65292;&#36824;&#26377;&#19968;&#20010;&#26465;&#20214;&#21270;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; &#20013;&#38388;&#20214;, &#22788;&#29702;Etags&#24182;&#24178;&#24471;&#26356;&#22810;&#65292;&#19979;&#38754;&#39532;&#19978;&#23601;&#20250;&#25552;&#21450;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn74&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#21387;&#32553;&#20013;&#38388;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#20013;&#38388;&#20214;&#31867; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.gzip.GZipMiddleware&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#36825;&#20010;&#20013;&#38388;&#20214;&#33258;&#21160;&#20026;&#33021;&#22788;&#29702;gzip&#21387;&#32553;(&#21253;&#25324;&#25152;&#26377;&#30340;&#29616;&#20195;&#27983;&#35272;&#22120;)&#30340;&#27983;&#35272;&#22120;&#33258;&#21160;&#21387;&#32553;&#36820;&#22238;]&#20869;&#23481;&#12290; &#36825;&#23558;&#26497;&#22823;&#22320;&#20943;&#23569;Web&#26381;&#21153;&#22120;&#25152;&#32791;&#29992;&#30340;&#24102;&#23485;&#12290; &#20195;&#20215;&#26159;&#21387;&#32553;&#39029;&#38754;&#38656;&#35201;&#19968;&#20123;&#39069;&#22806;&#30340;&#22788;&#29702;&#26102;&#38388;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&#30456;&#23545;&#20110;&#24102;&#23485;&#65292;&#20154;&#20204;&#19968;&#33324;&#26356;&#38738;&#30544;&#20110;&#36895;&#24230;&#65292;&#20294;&#26159;&#22914;&#26524;&#20320;&#30340;&#24773;&#24418;&#27491;&#22909;&#30456;&#21453;&#65292;&#23613;&#21487;&#21551;&#29992;&#36825;&#20010;&#20013;&#38388;&#20214;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;get&quot;&gt;
&lt;span id=&quot;cn78&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#26465;&#20214;&#21270;&#30340;GET&#20013;&#38388;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn79&quot;&gt;Middleware class: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.http.ConditionalGetMiddleware&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;&#36825;&#20010;&#20013;&#38388;&#20214;&#23545;&#26465;&#20214;&#21270; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; &#25805;&#20316;&#25552;&#20379;&#25903;&#25345;&#12290; &#22914;&#26524;response&#22836;&#20013;&#21253;&#25324; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Last-Modified&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ETag&lt;/span&gt;&lt;/tt&gt; &#22495;&#65292;&#24182;&#19988;request&#22836;&#20013;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;If-None-Match&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;If-Modified-Since&lt;/span&gt;&lt;/tt&gt; &#22495;&#65292;&#19988;&#20004;&#32773;&#19968;&#33268;&#65292;&#21017;&#35813;response&#23558;&#34987;response 304(Not modified)&#21462;&#20195;&#12290; &#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ETag&lt;/span&gt;&lt;/tt&gt; &#30340;&#25903;&#25345;&#20381;&#36182;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;USE_ETAGS&lt;/span&gt;&lt;/tt&gt; &#37197;&#32622;&#21450;&#20107;&#20808;&#22312;response&#22836;&#20013;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ETag&lt;/span&gt;&lt;/tt&gt; &#22495;&#12290;&#31245;&#21069;&#25152;&#35752;&#35770;&#30340;&#36890;&#29992;&#20013;&#38388;&#20214;&#21487;&#29992;&#20110;&#35774;&#32622;response&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ETag&lt;/span&gt;&lt;/tt&gt; &#22495;&#12290; As
discussed above, the &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ETag&lt;/span&gt;&lt;/tt&gt; header is set by the Common middleware.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#27492;&#22806;&#65292;&#23427;&#20063;&#23558;&#21024;&#38500;&#22788;&#29702; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HEAD&lt;/span&gt;&lt;/tt&gt; request&#26102;&#25152;&#29983;&#25104;&#30340;response&#20013;&#30340;&#20219;&#20309;&#20869;&#23481;&#65292;&#24182;&#22312;&#25152;&#26377;request&#30340;response&#22836;&#20013;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Date&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Content-Length&lt;/span&gt;&lt;/tt&gt; &#22495;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;x-forwarded-for&quot;&gt;
&lt;span id=&quot;cn82&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&#21453;&#21521;&#20195;&#29702;&#25903;&#25345; (X-Forwarded-For&#20013;&#38388;&#20214;)&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;Middleware class: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.http.SetRemoteAddrFromForwardedFor&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#36825;&#26159;&#25105;&#20204;&#22312; &#20160;&#20040;&#26159;&#20013;&#38388;&#20214; &#36825;&#19968;&#33410;&#20013;&#25152;&#20030;&#30340;&#20363;&#23376;&#12290; &#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META[&apos;HTTP_X_FORWARDED_FOR&apos;]&lt;/span&gt;&lt;/tt&gt; &#23384;&#22312;&#30340;&#21069;&#25552;&#19979;&#65292;&#23427;&#26681;&#25454;&#20854;&#20540;&#26469;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META[&apos;REMOTE_ADDR&apos;]&lt;/span&gt;&lt;/tt&gt; &#12290;&#22312;&#31449;&#28857;&#20301;&#20110;&#26576;&#20010;&#21453;&#21521;&#20195;&#29702;&#20043;&#21518;&#30340;&#12289;&#27599;&#20010;request&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;REMOTE_ADDR&lt;/span&gt;&lt;/tt&gt; &#37117;&#34987;&#25351;&#21521; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;127.0.0.1&lt;/span&gt;&lt;/tt&gt; &#30340;&#24773;&#24418;&#19979;&#65292;&#36825;&#19968;&#21151;&#33021;&#23558;&#38750;&#24120;&#26377;&#29992;&#12290; It
sets &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META[&apos;REMOTE_ADDR&apos;]&lt;/span&gt;&lt;/tt&gt; based on
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.META[&apos;HTTP_X_FORWARDED_FOR&apos;]&lt;/span&gt;&lt;/tt&gt; , if the latter is set. This is useful
if you&#8217;re sitting behind a reverse proxy that causes each request&#8217;s
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;REMOTE_ADDR&lt;/span&gt;&lt;/tt&gt; to be set to &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;127.0.0.1&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&#32418;&#33394;&#35686;&#21578;&#65281;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#36825;&#20010;middleware&#24182; &lt;em&gt;&#19981;&lt;/em&gt; &#39564;&#35777; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HTTP_X_FORWARDED_FOR&lt;/span&gt;&lt;/tt&gt; &#30340;&#21512;&#27861;&#24615;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#22914;&#26524;&#31449;&#28857;&#24182;&#19981;&#20301;&#20110;&#33258;&#21160;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HTTP_X_FORWARDED_FOR&lt;/span&gt;&lt;/tt&gt; &#30340;&#21453;&#21521;&#20195;&#29702;&#20043;&#21518;&#65292;&#35831;&#19981;&#35201;&#20351;&#29992;&#36825;&#20010;&#20013;&#38388;&#20214;&#12290; &#21542;&#21017;&#65292;&#22240;&#20026;&#20219;&#20309;&#20154;&#37117;&#33021;&#22815;&#20266;&#36896; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HTTP_X_FORWARDED_FOR&lt;/span&gt;&lt;/tt&gt; &#20540;&#65292;&#32780; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;REMOTE_ADDR&lt;/span&gt;&lt;/tt&gt; &#21448;&#26159;&#20381;&#25454; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HTTP_X_FORWARDED_FOR&lt;/span&gt;&lt;/tt&gt; &#26469;&#35774;&#32622;&#65292;&#36825;&#23601;&#24847;&#21619;&#30528;&#20219;&#20309;&#20154;&#37117;&#33021;&#22815;&#20266;&#36896;IP&#22320;&#22336;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#21482;&#26377;&#24403;&#33021;&#22815;&#32477;&#23545;&#20449;&#20219; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HTTP_X_FORWARDED_FOR&lt;/span&gt;&lt;/tt&gt; &#20540;&#24471;&#26102;&#20505;&#25165;&#33021;&#22815;&#20351;&#29992;&#36825;&#20010;&#20013;&#38388;&#20214;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn89&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#20250;&#35805;&#25903;&#25345;&#20013;&#38388;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn90&quot;&gt;Middleware class: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.sessions.middleware.SessionMiddleware&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#36825;&#20010;&#20013;&#38388;&#20214;&#28608;&#27963;&#20250;&#35805;&#25903;&#25345;&#21151;&#33021;. &#32454;&#33410;&#35831;&#21442;&#35265;&#31532;12&#31456;&#12290; See Chapter 14 for details.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn92&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#31449;&#28857;&#32531;&#23384;&#20013;&#38388;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;Middleware classes: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.cache.UpdateCacheMiddleware&lt;/span&gt;&lt;/tt&gt; and
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.cache.FetchFromCacheMiddleware&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&#36825;&#20123;&#20013;&#38388;&#20214;&#20114;&#30456;&#37197;&#21512;&#20197;&#32531;&#23384;&#27599;&#20010;&#22522;&#20110;Django&#30340;&#39029;&#38754;&#12290; &#24050;&#22312;&#31532;13&#31456;&#20013;&#35814;&#32454;&#35752;&#35770;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn95&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#20107;&#21153;&#22788;&#29702;&#20013;&#38388;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;Middleware class: &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.middleware.transaction.TransactionMiddleware&lt;/span&gt;&lt;/tt&gt; .&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#36825;&#20010;&#20013;&#38388;&#20214;&#23558;&#25968;&#25454;&#24211;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;COMMIT&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ROLLBACK&lt;/span&gt;&lt;/tt&gt; &#32465;&#23450;&#21040;request/response&#22788;&#29702;&#38454;&#27573;&#12290; &#22914;&#26524;view&#20989;&#25968;&#25104;&#21151;&#25191;&#34892;&#65292;&#21017;&#21457;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;COMMIT&lt;/span&gt;&lt;/tt&gt; &#25351;&#20196;&#12290; &#22914;&#26524;view&#20989;&#25968;&#25243;&#20986;&#24322;&#24120;&#65292;&#21017;&#21457;&#20986; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ROLLBACK&lt;/span&gt;&lt;/tt&gt; &#25351;&#20196;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&#36825;&#20010;&#20013;&#38388;&#20214;&#22312;&#26632;&#20013;&#30340;&#39034;&#24207;&#38750;&#24120;&#37325;&#35201;&#12290; &#20854;&#22806;&#23618;&#30340;&#20013;&#38388;&#20214;&#27169;&#22359;&#36816;&#34892;&#22312;Django&#32570;&#30465;&#30340; &#20445;&#23384;-&#25552;&#20132; &#34892;&#20026;&#27169;&#24335;&#19979;&#12290;
&#32780;&#20854;&#20869;&#23618;&#20013;&#38388;&#20214;(&#22312;&#26632;&#20013;&#30340;&#20854;&#21518;&#20301;&#32622;&#20986;&#29616;)&#23558;&#32622;&#20110;&#19982;view&#20989;&#25968;&#19968;&#33268;&#30340;&#20107;&#21153;&#26426;&#21046;&#30340;&#25511;&#21046;&#19979;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#20851;&#20110;&#25968;&#25454;&#24211;&#20107;&#21153;&#22788;&#29702;&#30340;&#26356;&#22810;&#20449;&#24687;&#65292;&#35831;&#21442;&#35265;&#38468;&#24405;C&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn100&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;Web&#24320;&#21457;&#32773;&#21644;&#25968;&#25454;&#24211;&#27169;&#24335;&#35774;&#35745;&#20154;&#21592;&#24182;&#19981;&#24635;&#26159;&#20139;&#26377;&#30333;&#25163;&#36215;&#23478;&#25171;&#36896;&#39033;&#30446;&#30340;&#22882;&#20360;&#26426;&#20250;&#12290; In the &lt;a class=&quot;reference external&quot; href=&quot;./chapter18&quot;&gt;&#19979;&#19968;&#31456;&lt;/a&gt;, we&#8217;ll cover how to integrate
with legacy systems, such as database schemas you&#8217;ve inherited from the 1980s.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter18</id>
        <title type="html">chapter18</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter18"/>
        <published>2015-02-26T20:43:10+08:00</published>
        <updated>2015-02-26T20:43:10+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#21313;&#20843;&#31456;&#65306; &#38598;&#25104;&#24050;&#26377;&#30340;&#25968;&#25454;&#24211;&#21644;&#24212;&#29992;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;Django&#26368;&#36866;&#21512;&#20110;&#25152;&#35859;&#30340;green-field&#24320;&#21457;&#65292;&#21363;&#20174;&#22836;&#24320;&#22987;&#30340;&#19968;&#20010;&#39033;&#30446;&#65292;&#27491;&#22914;&#20320;&#22312;&#19968;&#22359;&#36824;&#38271;&#30528;&#38738;&#33609;&#30340;&#26410;&#24320;&#22438;&#30340;&#22303;&#22320;&#19978;&#20174;&#38646;&#24320;&#22987;&#24314;&#36896;&#19968;&#26635;&#24314;&#31569;&#19968;&#33324;&#12290; &#28982;&#32780;&#65292;&#23613;&#31649;Django&#20559;&#29233;&#20174;&#22836;&#24320;&#22987;&#30340;&#39033;&#30446;&#65292;&#23558;&#36825;&#20010;&#26694;&#26550;&#21644;&#20197;&#21069;&#36951;&#30041;&#30340;&#25968;&#25454;&#24211;&#21644;&#24212;&#29992;&#30456;&#25972;&#21512;&#20173;&#28982;&#26159;&#21487;&#33021;&#30340;&#12290; &#26412;&#31456;&#23601;&#23558;&#20171;&#32461;&#19968;&#20123;&#25972;&#21512;&#30340;&#25216;&#24039;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn2&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#19982;&#36951;&#30041;&#25968;&#25454;&#24211;&#25972;&#21512;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;Django&#30340;&#25968;&#25454;&#24211;&#23618;&#20174;Python&#20195;&#30721;&#29983;&#25104;SQL schemas&#8212;&#20294;&#26159;&#23545;&#20110;&#36951;&#30041;&#25968;&#25454;&#24211;&#65292;&#20320;&#24050;&#32463;&#25317;&#26377;SQL schemas. &#36825;&#31181;&#24773;&#20917;,&#20320;&#38656;&#35201;&#20026;&#24050;&#32463;&#23384;&#22312;&#30340;&#25968;&#25454;&#34920;&#21019;&#24314;model. &#20026;&#27492;,Django&#33258;&#24102;&#20102;&#19968;&#20010;&#21487;&#20197;&#36890;&#36807;&#35835;&#21462;&#24744;&#30340;&#25968;&#25454;&#34920;&#32467;&#26500;&#26469;&#29983;&#25104;model&#30340;&#24037;&#20855;. &#35813;&#36741;&#21161;&#24037;&#20855;&#31216;&#20026;inspectdb,&#20320;&#21487;&#20197;&#36890;&#36807;&#25191;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;inspectdb&lt;/span&gt;&lt;/tt&gt;&#26469;&#35843;&#29992;&#23427;.&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;inspectdb&quot;&gt;
&lt;span id=&quot;cn4&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn4&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;inspectdb&lt;/span&gt;&lt;/tt&gt;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;inspectdb&lt;/span&gt;&lt;/tt&gt;&#24037;&#20855;&#33258;&#30465;&#20320;&#37197;&#32622;&#25991;&#20214;&#25351;&#21521;&#30340;&#25968;&#25454;&#24211;&#65292;&#38024;&#23545;&#27599;&#19968;&#20010;&#34920;&#29983;&#25104;&#19968;&#20010;Django&#27169;&#22411;&#65292;&#28982;&#21518;&#23558;&#36825;&#20123;Python&#27169;&#22411;&#30340;&#20195;&#30721;&#26174;&#31034;&#22312;&#31995;&#32479;&#30340;&#26631;&#20934;&#36755;&#20986;&#37324;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&#19979;&#38754;&#26159;&#19968;&#20010;&#20174;&#22836;&#24320;&#22987;&#30340;&#38024;&#23545;&#19968;&#20010;&#20856;&#22411;&#30340;&#36951;&#30041;&#25968;&#25454;&#24211;&#30340;&#25972;&#21512;&#36807;&#31243;&#12290; &#20004;&#20010;&#21069;&#25552;&#26465;&#20214;&#26159;&#23433;&#35013;&#20102;Django&#21644;&#19968;&#20010;&#20256;&#32479;&#25968;&#25454;&#24211;&#12290;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#36890;&#36807;&#36816;&#34892;django-admin.py startproject mysite (&#36825;&#37324; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite&lt;/span&gt;&lt;/tt&gt; &#26159;&#20320;&#30340;&#39033;&#30446;&#30340;&#21517;&#23383;)&#24314;&#31435;&#19968;&#20010;Django&#39033;&#30446;&#12290; &#22909;&#30340;&#65292;&#37027;&#25105;&#20204;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#23601;&#29992;&#36825;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite&lt;/span&gt;&lt;/tt&gt; &#20316;&#20026;&#39033;&#30446;&#30340;&#21517;&#23383;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#32534;&#36753;&#39033;&#30446;&#20013;&#30340;&#37197;&#32622;&#25991;&#20214;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite/settings.py&lt;/span&gt;&lt;/tt&gt; ,&#21578;&#35785;Django&#20320;&#30340;&#25968;&#25454;&#24211;&#36830;&#25509;&#21442;&#25968;&#21644;&#25968;&#25454;&#24211;&#21517;&#12290; &#20855;&#20307;&#30340;&#35828;&#65292;&#35201;&#25552;&#20379; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_NAME&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_ENGINE&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_USER&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_PASSWORD&lt;/span&gt;&lt;/tt&gt; , &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_HOST&lt;/span&gt;&lt;/tt&gt; , &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_PORT&lt;/span&gt;&lt;/tt&gt; &#36825;&#20123;&#37197;&#32622;&#20449;&#24687;.&#12290; (&#35831;&#27880;&#24847;&#20854;&#20013;&#30340;&#19968;&#20123;&#35774;&#32622;&#26159;&#21487;&#36873;&#30340;&#12290; &#26356;&#22810;&#20449;&#24687;&#21442;&#35265;&#31532;5&#31456;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#36890;&#36807;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;mysite/manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;startapp&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;myapp&lt;/span&gt;&lt;/tt&gt; (&#36825;&#37324; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;myapp&lt;/span&gt;&lt;/tt&gt; &#26159;&#20320;&#30340;&#24212;&#29992;&#30340;&#21517;&#23383;)&#21019;&#24314;&#19968;&#20010;Django&#24212;&#29992;&#12290; &#36825;&#37324;&#25105;&#20204;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;myapp&lt;/span&gt;&lt;/tt&gt; &#20570;&#20026;&#24212;&#29992;&#21517;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#36816;&#34892;&#21629;&#20196; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;mysite/manage.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;inspectdb&lt;/span&gt;&lt;/tt&gt;&#12290;&#36825;&#23558;&#26816;&#26597;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;DATABASE_NAME&lt;/span&gt;&lt;/tt&gt; &#25968;&#25454;&#24211;&#20013;&#25152;&#26377;&#30340;&#34920;&#24182;&#25171;&#21360;&#20986;&#20026;&#27599;&#24352;&#34920;&#29983;&#25104;&#30340;&#27169;&#22411;&#31867;&#12290; &#30475;&#19968;&#30475;&#36755;&#20986;&#32467;&#26524;&#20197;&#20102;&#35299;inspectdb&#33021;&#20570;&#20123;&#20160;&#20040;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#23558;&#26631;&#20934;shell&#30340;&#36755;&#20986;&#37325;&#23450;&#21521;&#65292;&#20445;&#23384;&#36755;&#20986;&#21040;&#20320;&#30340;&#24212;&#29992;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;models.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#37324;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn13&quot;&gt;python mysite/manage.py inspectdb &amp;gt; mysite/myapp/models.py
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&#32534;&#36753; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mysite/myapp/models.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#20197;&#28165;&#29702;&#29983;&#25104;&#30340; models &#24182;&#19988;&#20570;&#19968;&#20123;&#24517;&#35201;&#30340;&#33258;&#23450;&#20041;&#12290; &#38024;&#23545;&#36825;&#20010;&#65292;&#19979;&#19968;&#20010;&#33410;&#26377;&#20123;&#22909;&#30340;&#24314;&#35758;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;models&quot;&gt;
&lt;span id=&quot;cn15&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#28165;&#29702;&#29983;&#25104;&#30340;Models&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#22914;&#20320;&#21487;&#33021;&#20250;&#39044;&#26009;&#21040;&#30340;&#65292;&#25968;&#25454;&#24211;&#33258;&#30465;&#19981;&#26159;&#23436;&#32654;&#30340;&#65292;&#20320;&#38656;&#35201;&#23545;&#20135;&#29983;&#30340;&#27169;&#22411;&#20195;&#30721;&#20570;&#20123;&#35768;&#28165;&#29702;&#12290; &#36825;&#37324;&#25552;&#37266;&#19968;&#28857;&#20851;&#20110;&#22788;&#29702;&#29983;&#25104; models &#30340;&#35201;&#28857;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#25968;&#25454;&#24211;&#30340;&#27599;&#19968;&#20010;&#34920;&#37117;&#20250;&#34987;&#36716;&#21270;&#20026;&#19968;&#20010;model&#31867; (&#20063;&#23601;&#26159;&#35828;&#65292;&#25968;&#25454;&#24211;&#30340;&#34920;&#21644;model &#31867;&#20043;&#38388;&#26159;&#19968;&#23545;&#19968;&#30340;&#26144;&#23556;)&#12290; &#36825;&#24847;&#21619;&#30528;&#20320;&#38656;&#35201;&#20026;&#22810;&#23545;&#22810;&#36830;&#25509;&#30340;&#34920;&#65292;&#37325;&#26500;&#20854;models &#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ManyToManyField&lt;/span&gt;&lt;/tt&gt; &#30340;&#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#25152;&#29983;&#25104;&#30340;&#27599;&#19968;&#20010;model&#20013;&#30340;&#27599;&#20010;&#23383;&#27573;&#37117;&#25317;&#26377;&#33258;&#24049;&#30340;&#23646;&#24615;&#65292;&#21253;&#25324;id&#20027;&#38190;&#23383;&#27573;&#12290; &#20294;&#26159;&#65292;&#35831;&#27880;&#24847;&#65292;&#22914;&#26524;&#26576;&#20010;model&#27809;&#26377;&#20027;&#38190;&#30340;&#35805;&#65292;&#37027;&#20040;Django&#20250;&#33258;&#21160;&#20026;&#20854;&#22686;&#21152;&#19968;&#20010;id&#20027;&#38190;&#23383;&#27573;&#12290; &#36825;&#26679;&#19968;&#26469;&#65292;&#20320;&#20063;&#35768;&#24076;&#26395;&#31227;&#38500;&#36825;&#26679;&#30340;&#20195;&#30721;&#34892;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn20&quot;&gt;id = models.IntegerField(primary_key=True)
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn21&quot;&gt;&#36825;&#26679;&#20570;&#24182;&#19981;&#26159;&#20165;&#20165;&#22240;&#20026;&#36825;&#20123;&#34892;&#26159;&#20887;&#20313;&#30340;&#65292;&#32780;&#19988;&#22914;&#26524;&#24403;&#20320;&#30340;&#24212;&#29992;&#38656;&#35201;&#21521;&#36825;&#20123;&#34920;&#20013;&#22686;&#21152;&#26032;&#35760;&#24405;&#26102;&#65292;&#36825;&#20123;&#34892;&#20250;&#23548;&#33268;&#26576;&#20123;&#38382;&#39064;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&#27599;&#19968;&#20010;&#23383;&#27573;&#31867;&#22411;&#65292;&#22914;CharField&#12289;DateField&#65292; &#26159;&#36890;&#36807;&#26597;&#25214;&#25968;&#25454;&#24211;&#21015;&#31867;&#22411;&#22914;VARCHAR,DATE&#26469;&#30830;&#23450;&#30340;&#12290;&#22914;&#26524;inspectdb&#26080;&#27861;&#25226;&#26576;&#20010;&#25968;&#25454;&#24211;&#23383;&#27573;&#26144;&#23556;&#21040;model&#23383;&#27573;&#19978;&#65292;&#23427;&#20250;&#20351;&#29992;TextField&#23383;&#27573;&#36827;&#34892;&#20195;&#26367;&#65292;&#24182;&#19988;&#20250;&#22312;&#25152;&#29983;&#25104;model&#23383;&#27573;&#21518;&#38754;&#21152;&#20837;Python&#27880;&#37322;&#8220;&#35813;&#23383;&#27573;&#31867;&#22411;&#26159;&#29468;&#30340;&#8221;&#12290; &#23545;&#36825;&#35201;&#24403;&#24515;&#65292;&#22914;&#26524;&#24517;&#35201;&#30340;&#35805;&#65292;&#26356;&#25913;&#23383;&#27573;&#31867;&#22411;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#22914;&#26524;&#20320;&#30340;&#25968;&#25454;&#24211;&#20013;&#30340;&#26576;&#20010;&#23383;&#27573;&#22312;Django&#20013;&#25214;&#19981;&#21040;&#21512;&#36866;&#30340;&#23545;&#24212;&#29289;&#65292;&#20320;&#21487;&#20197;&#25918;&#24515;&#30340;&#30053;&#36807;&#23427;&#12290; Django&#27169;&#22411;&#23618;&#19981;&#35201;&#27714;&#24517;&#39035;&#23548;&#20837;&#20320;&#25968;&#25454;&#24211;&#34920;&#20013;&#30340;&#27599;&#20010;&#21015;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#22914;&#26524;&#25968;&#25454;&#24211;&#20013;&#26576;&#20010;&#21015;&#30340;&#21517;&#23383;&#26159;Python&#30340;&#20445;&#30041;&#23383;&#65288;&#27604;&#22914;pass&#12289;class&#25110;&#32773;for&#31561;&#65289;&#65292;inspectdb&#20250;&#22312;&#27599;&#20010;&#23646;&#24615;&#21517;&#21518;&#38468;&#21152;&#19978;_field&#65292;&#24182;&#23558;db_column&#23646;&#24615;&#35774;&#32622;&#20026;&#30495;&#23454;&#30340;&#23383;&#27573;&#21517;&#65288;&#20063;&#23601;&#26159;pass,class&#25110;&#32773;for&#31561;&#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#20363;&#22914;&#65292;&#26576;&#24352;&#34920;&#20013;&#21253;&#21547;&#19968;&#20010;INT&#31867;&#22411;&#30340;&#21015;&#65292;&#20854;&#21015;&#21517;&#20026;for&#65292;&#37027;&#20040;&#25152;&#29983;&#25104;&#30340;model&#23558;&#20250;&#21253;&#21547;&#22914;&#19979;&#25152;&#31034;&#30340;&#19968;&#20010;&#23383;&#27573;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn27&quot;&gt;for_field = models.IntegerField(db_column=&apos;for&apos;)
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;inspectdb&lt;/span&gt;&lt;/tt&gt; &#20250;&#22312;&#35813;&#23383;&#27573;&#21518;&#21152;&#27880; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#8216;&#23383;&#27573;&#37325;&#21629;&#21517;&#65292;&#22240;&#20026;&#23427;&#26159;&#19968;&#20010;Python&#20445;&#30041;&#23383;&#8217;&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#22914;&#26524;&#25968;&#25454;&#24211;&#20013;&#26576;&#24352;&#34920;&#24341;&#29992;&#20102;&#20854;&#20182;&#34920;&#65288;&#27491;&#22914;&#22823;&#22810;&#25968;&#25968;&#25454;&#24211;&#31995;&#32479;&#25152;&#20570;&#30340;&#37027;&#26679;&#65289;&#65292;&#20320;&#38656;&#35201;&#36866;&#24403;&#30340;&#20462;&#25913;&#25152;&#29983;&#25104;model&#30340;&#39034;&#24207;&#65292;&#20197;&#20351;&#24471;&#36825;&#31181;&#24341;&#29992;&#33021;&#22815;&#27491;&#30830;&#26144;&#23556;&#12290; &#20363;&#22914;&#65292;model Book&#25317;&#26377;&#19968;&#20010;&#38024;&#23545;&#20110;model Author&#30340;&#22806;&#38190;&#65292;&#37027;&#20040;&#21518;&#32773;&#24212;&#35813;&#20808;&#20110;&#21069;&#32773;&#34987;&#23450;&#20041;&#12290;&#22914;&#26524;&#20320;&#24819;&#21019;&#24314;&#19968;&#20010;&#25351;&#21521;&#23578;&#26410;&#23450;&#20041;&#30340;model&#30340;&#20851;&#31995;&#65292;&#37027;&#20040;&#21487;&#20197;&#20351;&#29992;&#21253;&#21547;model&#21517;&#30340;&#23383;&#31526;&#20018;&#65292;&#32780;&#19981;&#26159;model&#23545;&#35937;&#26412;&#36523;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;&#23545;&#20110;PostgreSQL,MySQL&#21644;SQLite&#25968;&#25454;&#24211;&#31995;&#32479;&#65292;inspectdb&#33021;&#22815;&#33258;&#21160;&#26816;&#27979;&#20986;&#20027;&#38190;&#20851;&#31995;&#12290; &#20063;&#23601;&#26159;&#35828;&#65292;&#23427;&#20250;&#22312;&#21512;&#36866;&#30340;&#20301;&#32622;&#25554;&#20837;primary_key=True&#12290; &#32780;&#23545;&#20110;&#20854;&#20182;&#25968;&#25454;&#24211;&#31995;&#32479;&#65292;&#20320;&#24517;&#39035;&#20026;&#27599;&#19968;&#20010;model&#20013;&#33267;&#23569;&#19968;&#20010;&#23383;&#27573;&#25554;&#20837;&#36825;&#26679;&#30340;&#35821;&#21477;&#65292;&#22240;&#20026;Django&#30340;model&#35201;&#27714;&#24517;&#39035;&#25317;&#26377;&#19968;&#20010;primary_key=True&#30340;&#23383;&#27573;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#22806;&#38190;&#26816;&#27979;&#20165;&#23545;PostgreSQL&#65292;&#36824;&#26377;MySQL&#34920;&#20013;&#30340;&#26576;&#20123;&#29305;&#23450;&#31867;&#22411;&#29983;&#25928;&#12290; &#33267;&#20110;&#20854;&#20182;&#25968;&#25454;&#24211;&#65292;&#22806;&#38190;&#23383;&#27573;&#23558;&#22312;&#20551;&#23450;&#20854;&#20026;INT&#21015;&#30340;&#24773;&#20917;&#19979;&#34987;&#33258;&#21160;&#29983;&#25104;&#20026;IntegerField&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn32&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#19982;&#35748;&#35777;&#31995;&#32479;&#30340;&#25972;&#21512;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn33&quot;&gt;&#23558;Django&#19982;&#20854;&#20182;&#29616;&#26377;&#35748;&#35777;&#31995;&#32479;&#30340;&#29992;&#25143;&#21517;&#21644;&#23494;&#30721;&#25110;&#32773;&#35748;&#35777;&#26041;&#27861;&#36827;&#34892;&#25972;&#21512;&#26159;&#21487;&#20197;&#21150;&#21040;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;&#20363;&#22914;&#65292;&#20320;&#25152;&#22312;&#30340;&#20844;&#21496;&#20063;&#35768;&#24050;&#32463;&#23433;&#35013;&#20102;LDAP&#65292;&#24182;&#19988;&#20026;&#27599;&#19968;&#20010;&#21592;&#24037;&#37117;&#23384;&#20648;&#20102;&#30456;&#24212;&#30340;&#29992;&#25143;&#21517;&#21644;&#23494;&#30721;&#12290; &#22914;&#26524;&#29992;&#25143;&#22312;LDAP&#21644;&#22522;&#20110;Django&#30340;&#24212;&#29992;&#19978;&#25317;&#26377;&#29420;&#31435;&#30340;&#36134;&#21495;&#65292;&#37027;&#20040;&#36825;&#26102;&#26080;&#35770;&#23545;&#20110;&#32593;&#32476;&#31649;&#29702;&#21592;&#36824;&#26159;&#29992;&#25143;&#33258;&#24049;&#26469;&#35828;&#65292;&#37117;&#26159;&#19968;&#20214;&#24456;&#20196;&#20154;&#22836;&#30171;&#30340;&#20107;&#20799;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#20026;&#20102;&#35299;&#20915;&#36825;&#26679;&#30340;&#38382;&#39064;&#65292;Django&#35748;&#35777;&#31995;&#32479;&#33021;&#35753;&#24744;&#20197;&#25554;&#20214;&#26041;&#24335;&#19982;&#20854;&#20182;&#35748;&#35777;&#36164;&#28304;&#36827;&#34892;&#20132;&#20114;&#12290; &#24744;&#21487;&#20197;&#35206;&#30422;Diango&#40664;&#35748;&#30340;&#22522;&#20110;&#25968;&#25454;&#24211;&#30340;&#27169;&#24335;&#65292;&#24744;&#36824;&#21487;&#20197;&#20351;&#29992;&#40664;&#35748;&#30340;&#31995;&#32479;&#19982;&#20854;&#20182;&#31995;&#32479;&#36827;&#34892;&#20132;&#20114;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn36&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn36&quot;&gt;&#25351;&#23450;&#35748;&#35777;&#21518;&#21488;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#22312;&#21518;&#21488;&#65292;Django&#32500;&#25252;&#20102;&#19968;&#20010;&#29992;&#20110;&#26816;&#26597;&#35748;&#35777;&#30340;&#21518;&#21488;&#21015;&#34920;&#12290; &#24403;&#26576;&#20010;&#20154;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.contrib.auth.authenticate()&lt;/span&gt;&lt;/tt&gt; (&#22914;14&#31456;&#20013;&#25152;&#36848;)&#26102;&#65292;Django&#20250;&#23581;&#35797;&#23545;&#20854;&#35748;&#35777;&#21518;&#21488;&#36827;&#34892;&#36941;&#21382;&#35748;&#35777;&#12290; &#22914;&#26524;&#31532;&#19968;&#20010;&#35748;&#35777;&#26041;&#27861;&#22833;&#36133;&#65292;Django&#20250;&#23581;&#35797;&#35748;&#35777;&#31532;&#20108;&#20010;&#65292;&#20197;&#27492;&#31867;&#25512;&#65292;&#19968;&#30452;&#21040;&#23581;&#35797;&#23436;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#35748;&#35777;&#21518;&#21488;&#21015;&#34920;&#22312;AUTHENTICATION_BACKENDS&#35774;&#32622;&#20013;&#36827;&#34892;&#25351;&#23450;&#12290; &#23427;&#24212;&#35813;&#26159;&#25351;&#21521;&#30693;&#36947;&#22914;&#20309;&#35748;&#35777;&#30340;Python&#31867;&#30340;Python&#36335;&#24452;&#30340;&#21517;&#23383;&#25968;&#32452;&#12290; &#36825;&#20123;&#31867;&#21487;&#20197;&#22312;&#20320;Python&#36335;&#24452;&#30340;&#20219;&#20309;&#20301;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&#40664;&#35748;&#24773;&#20917;&#19979;&#65292;AUTHENTICATION_BACKENDS&#34987;&#35774;&#32622;&#20026;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn41&quot;&gt;(&apos;django.contrib.auth.backends.ModelBackend&apos;,)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#37027;&#23601;&#26159;&#26816;&#27979;Django&#29992;&#25143;&#25968;&#25454;&#24211;&#30340;&#22522;&#26412;&#35748;&#35777;&#27169;&#24335;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn43&quot;&gt;AUTHENTICATION_BACKENDS&#30340;&#39034;&#24207;&#24456;&#37325;&#35201;&#65292;&#22914;&#26524;&#29992;&#25143;&#21517;&#21644;&#23494;&#30721;&#22312;&#22810;&#20010;&#21518;&#21488;&#20013;&#37117;&#26159;&#26377;&#25928;&#30340;&#65292;&#37027;&#20040;Django&#23558;&#20250;&#22312;&#31532;&#19968;&#20010;&#27491;&#30830;&#21305;&#37197;&#21518;&#20572;&#27490;&#36827;&#19968;&#27493;&#30340;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn44&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#32534;&#20889;&#35748;&#35777;&#21518;&#21488;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#19968;&#20010;&#35748;&#35777;&#21518;&#21488;&#20854;&#23454;&#23601;&#26159;&#19968;&#20010;&#23454;&#29616;&#20102;&#22914;&#19979;&#20004;&#20010;&#26041;&#27861;&#30340;&#31867;&#65306;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_user(id)&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authenticate(**credentials)&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#26041;&#27861; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;get_user&lt;/span&gt;&lt;/tt&gt; &#38656;&#35201;&#19968;&#20010;&#21442;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;id&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;id&lt;/span&gt;&lt;/tt&gt; &#21487;&#20197;&#26159;&#29992;&#25143;&#21517;&#65292;&#25968;&#25454;&#24211;ID&#25110;&#32773;&#20854;&#20182;&#20219;&#20309;&#25968;&#20540;&#65292;&#35813;&#26041;&#27861;&#20250;&#36820;&#22238;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#26041;&#27861; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authenticate&lt;/span&gt;&lt;/tt&gt; &#20351;&#29992;&#35777;&#20070;&#20316;&#20026;&#20851;&#38190;&#21442;&#25968;&#12290; &#22823;&#22810;&#25968;&#24773;&#20917;&#19979;&#65292;&#35813;&#26041;&#27861;&#30475;&#36215;&#26469;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn49&quot;&gt;class MyBackend(object):
    def authenticate(self, username=None, password=None):
        # Check the username/password and return a User.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn50&quot;&gt;&#20294;&#26159;&#26377;&#26102;&#20505;&#23427;&#20063;&#21487;&#20197;&#35748;&#35777;&#26576;&#20010;&#30701;&#35821;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn52&quot;&gt;class MyBackend(object):
    def authenticate(self, token=None):
        # Check the token and return a User.
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#27599;&#19968;&#20010;&#26041;&#27861;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authenticate&lt;/span&gt;&lt;/tt&gt; &#37117;&#24212;&#35813;&#26816;&#27979;&#23427;&#25152;&#33719;&#21462;&#30340;&#35777;&#20070;&#65292;&#24182;&#19988;&#24403;&#35777;&#20070;&#26377;&#25928;&#26102;&#65292;&#36820;&#22238;&#19968;&#20010;&#21305;&#37197;&#20110;&#35813;&#35777;&#20070;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#65292;&#22914;&#26524;&#35777;&#20070;&#26080;&#25928;&#37027;&#20040;&#36820;&#22238; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt; &#12290; &#22914;&#26524;&#23427;&#20204;&#19981;&#21512;&#27861;&#65292;&#23601;&#36820;&#22238;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;None&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn54&quot;&gt;&#22914;14&#31456;&#20013;&#25152;&#36848;&#65292;Django&#31649;&#29702;&#31995;&#32479;&#32039;&#23494;&#36830;&#25509;&#20110;&#20854;&#33258;&#24049;&#21518;&#21488;&#25968;&#25454;&#24211;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290; &#23454;&#29616;&#36825;&#20010;&#21151;&#33021;&#30340;&#26368;&#22909;&#21150;&#27861;&#23601;&#26159;&#20026;&#24744;&#30340;&#21518;&#21488;&#25968;&#25454;&#24211;&#65288;&#22914;LDAP&#30446;&#24405;&#65292;&#22806;&#37096;SQL&#25968;&#25454;&#24211;&#31561;&#65289;&#20013;&#30340;&#27599;&#20010;&#29992;&#25143;&#37117;&#21019;&#24314;&#19968;&#20010;&#23545;&#24212;&#30340;Django User&#23545;&#35937;&#12290; &#24744;&#21487;&#20197;&#25552;&#21069;&#20889;&#19968;&#20010;&#33050;&#26412;&#26469;&#23436;&#25104;&#36825;&#20010;&#24037;&#20316;&#65292;&#20063;&#21487;&#20197;&#22312;&#26576;&#20010;&#29992;&#25143;&#31532;&#19968;&#27425;&#30331;&#38470;&#30340;&#26102;&#20505;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;authenticate&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#20013;&#36827;&#34892;&#23454;&#29616;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#20197;&#19979;&#26159;&#19968;&#20010;&#31034;&#20363;&#21518;&#21488;&#31243;&#24207;&#65292;&#35813;&#21518;&#21488;&#29992;&#20110;&#35748;&#35777;&#23450;&#20041;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;setting.py&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#20013;&#30340;username&#21644;password&#21464;&#37327;&#65292;&#24182;&#19988;&#22312;&#35813;&#29992;&#25143;&#31532;&#19968;&#27425;&#35748;&#35777;&#30340;&#26102;&#20505;&#21019;&#24314;&#19968;&#20010;&#30456;&#24212;&#30340;Django &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;User&lt;/span&gt;&lt;/tt&gt; &#23545;&#35937;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn57&quot;&gt;from django.conf import settings
from django.contrib.auth.models import User, check_password

class SettingsBackend(object):
    &quot;&quot;&quot;
    Authenticate against the settings ADMIN_LOGIN and ADMIN_PASSWORD.

    Use the login name, and a hash of the password. For example:

    ADMIN_LOGIN = &apos;admin&apos;
    ADMIN_PASSWORD = &apos;sha1$4e987$afbcf42e21bd417fb71db8c66b321e9fc33051de&apos;
    &quot;&quot;&quot;
    def authenticate(self, username=None, password=None):
        login_valid = (settings.ADMIN_LOGIN == username)
        pwd_valid = check_password(password, settings.ADMIN_PASSWORD)
        if login_valid and pwd_valid:
            try:
                user = User.objects.get(username=username)
            except User.DoesNotExist:
                # Create a new user. Note that we can set password
                # to anything, because it won&apos;t be checked; the password
                # from settings.py will.
                user = User(username=username, password=&apos;get from settings.py&apos;)
                user.is_staff = True
                user.is_superuser = True
                user.save()
            return user
        return None

    def get_user(self, user_id):
        try:
            return User.objects.get(pk=user_id)
        except User.DoesNotExist:
            return None
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&#26356;&#22810;&#35748;&#35777;&#27169;&#22359;&#30340;&#21518;&#21488;, &#21442;&#32771;Django&#25991;&#26723;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;web&quot;&gt;
&lt;span id=&quot;cn59&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#21644;&#36951;&#30041;Web&#24212;&#29992;&#38598;&#25104;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#21516;&#30001;&#20854;&#20182;&#25216;&#26415;&#39537;&#21160;&#30340;&#24212;&#29992;&#19968;&#26679;&#65292;&#22312;&#30456;&#21516;&#30340;Web&#26381;&#21153;&#22120;&#19978;&#36816;&#34892;Django&#24212;&#29992;&#20063;&#26159;&#21487;&#34892;&#30340;&#12290; &#26368;&#31616;&#21333;&#30452;&#25509;&#30340;&#21150;&#27861;&#23601;&#26159;&#21033;&#29992;Apaches&#37197;&#32622;&#25991;&#20214;httpd.conf&#65292;&#23558;&#19981;&#21516;&#30340;URL&#31867;&#22411;&#20998;&#21457;&#33267;&#19981;&#21516;&#30340;&#25216;&#26415;&#12290; &#65288;&#35831;&#27880;&#24847;&#65292;&#31532;12&#31456;&#21253;&#21547;&#20102;&#22312;Apache/mod_python&#19978;&#37197;&#32622;Django&#30340;&#30456;&#20851;&#20869;&#23481;&#65292;&#22240;&#27492;&#22312;&#23581;&#35797;&#26412;&#31456;&#38598;&#25104;&#20043;&#21069;&#33457;&#20123;&#26102;&#38388;&#21435;&#20180;&#32454;&#38405;&#35835;&#31532;12&#31456;&#25110;&#35768;&#26159;&#20540;&#24471;&#30340;&#12290;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;&#20851;&#38190;&#22312;&#20110;&#21482;&#26377;&#22312;&#24744;&#30340;httpd.conf&#25991;&#20214;&#20013;&#36827;&#34892;&#20102;&#30456;&#20851;&#23450;&#20041;&#65292;Django&#23545;&#26576;&#20010;&#29305;&#23450;&#30340;URL&#31867;&#22411;&#30340;&#39537;&#21160;&#25165;&#20250;&#34987;&#28608;&#27963;&#12290; &#22312;&#31532;12&#31456;&#20013;&#35299;&#37322;&#30340;&#32570;&#30465;&#37096;&#32626;&#26041;&#26696;&#20551;&#23450;&#24744;&#38656;&#35201;Django&#21435;&#39537;&#21160;&#26576;&#20010;&#29305;&#23450;&#22495;&#19978;&#30340;&#27599;&#19968;&#20010;&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn63&quot;&gt;&amp;lt;Location &quot;/&quot;&amp;gt;
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonDebug On
&amp;lt;/Location&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#36825;&#37324;, &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;Location&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&quot;/&quot;&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#36825;&#19968;&#34892;&#34920;&#31034;&#29992;Django&#22788;&#29702;&#27599;&#20010;&#20197;&#26681;&#24320;&#22836;&#30340;URL.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn65&quot;&gt;&#31934;&#22937;&#20043;&#22788;&#22312;&#20110;Django&#23558;&amp;lt;location&amp;gt;&#25351;&#20196;&#20540;&#38480;&#23450;&#20110;&#19968;&#20010;&#29305;&#23450;&#30340;&#30446;&#24405;&#26641;&#19978;&#12290; &#20030;&#20010;&#20363;&#23376;&#65292;&#27604;&#22914;&#35828;&#24744;&#26377;&#19968;&#20010;&#22312;&#26576;&#20010;&#22495;&#20013;&#39537;&#21160;&#22823;&#22810;&#25968;&#39029;&#38754;&#30340;&#36951;&#30041;PHP&#24212;&#29992;&#65292;&#24182;&#19988;&#24744;&#24076;&#26395;&#19981;&#20013;&#26029;PHP&#20195;&#30721;&#30340;&#36816;&#34892;&#32780;&#22312;../admin/&#20301;&#32622;&#23433;&#35013;&#19968;&#20010;Django&#22495;&#12290; &#35201;&#20570;&#21040;&#36825;&#19968;&#28857;&#65292;&#24744;&#21482;&#38656;&#23558;&amp;lt;location&amp;gt;&#20540;&#35774;&#32622;&#20026;/admin/&#21363;&#21487;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn67&quot;&gt;&amp;lt;Location &quot;/admin/&quot;&amp;gt;
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonDebug On
&amp;lt;/Location&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#26377;&#20102;&#36825;&#26679;&#30340;&#35774;&#32622;&#65292;&#21482;&#26377;&#37027;&#20123;&#20197;/admin/&#24320;&#22836;&#30340;URL&#22320;&#22336;&#25165;&#20250;&#35302;&#21457;Django&#21435;&#36827;&#34892;&#22788;&#29702;&#12290; &#20854;&#20182;&#39029;&#38754;&#20250;&#20351;&#29992;&#24050;&#23384;&#22312;&#30340;&#35774;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;&#35831;&#27880;&#24847;&#65292;&#25226;Diango&#32465;&#23450;&#21040;&#30340;&#21512;&#26684;&#30340;URL&#65288;&#27604;&#22914;&#22312;&#26412;&#31456;&#20363;&#23376;&#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/admin/&lt;/span&gt;&lt;/tt&gt; &#65289;&#24182;&#19981;&#20250;&#24433;&#21709;&#20854;&#23545;URL&#30340;&#35299;&#26512;&#12290; &#32477;&#23545;&#36335;&#24452;&#23545;Django&#25165;&#26159;&#26377;&#25928;&#30340;&#65288;&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/admin/people/person/add/&lt;/span&gt;&lt;/tt&gt; &#65289;&#65292;&#32780;&#38750;&#25130;&#26029;&#21518;&#30340;URL&#65288;&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/people/person/add/&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290;&#36825;&#24847;&#21619;&#30528;&#20320;&#30340;&#26681;URLconf&#24517;&#39035;&#21253;&#21547;&#21069;&#32512; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/admin/&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn70&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#22914;&#26524;&#20320;&#30340;&#27597;&#35821;&#26159;&#33521;&#35821;, &#20320;&#21487;&#33021;&#23601;&#19981;&#20250;&#27880;&#24847;&#21040;&#35768;&#22810;Django admin&#32593;&#31449;&#20013;&#26368;&#37239;&#30340;&#29305;&#24615;&#21151;&#33021;&#12290; &#23427;&#25903;&#25345;&#36229;&#36807;50&#31181;&#35821;&#35328;! Django &#30340;&#22269;&#38469;&#21270;&#26694;&#26550;&#20351;&#20854;&#25104;&#20026;&#21487;&#33021;( &#36824;&#26377;Django&#24535;&#24895;&#32763;&#35793;&#32773;&#30340;&#21162;&#21147; ) &lt;a href=&quot;./chapter19&quot;&gt;&#19979;&#19968;&#31456;.&lt;/a&gt;&#20171;&#32461;&#22914;&#20309;&#20351;&#29992;&#36825;&#20010;&#26694;&#26550;&#26469;&#25552;&#20379;&#26412;&#22320;&#21270;&#30340;Django&#32593;&#31449;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter19</id>
        <title type="html">chapter19</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter19"/>
        <published>2015-02-26T20:39:52+08:00</published>
        <updated>2015-02-26T20:39:52+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#21313;&#20061;&#31456;&#65306; &#22269;&#38469;&#21270;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;Django&#35806;&#29983;&#20110;&#32654;&#22269;&#20013;&#37096;&#22570;&#33832;&#26031;&#30340;&#21171;&#20262;&#26031;&#65292;&#36317;&#32654;&#22269;&#30340;&#22320;&#29702;&#20013;&#24515;&#19981;&#21040;40&#33521;&#37324;&#12290; &#20687;&#22823;&#22810;&#25968;&#24320;&#28304;&#39033;&#30446;&#19968;&#26679;&#65292;Djano&#31038;&#21306;&#36880;&#28176;&#24320;&#22987;&#21253;&#25324;&#26469;&#33258;&#20840;&#29699;&#21508;&#22320;&#30340;&#35768;&#22810;&#21442;&#19982;&#32773;&#12290; &#37492;&#20110;Django&#31038;&#21306;&#36880;&#28176;&#21464;&#30340;&#22810;&#26679;&#24615;&#65292;&lt;em&gt;&#22269;&#38469;&#21270;&lt;/em&gt;&#21644;&lt;em&gt;&#26412;&#22320;&#21270;&lt;/em&gt;&#36880;&#28176;&#21464;&#24471;&#24456;&#37325;&#35201;&#12290; &#30001;&#20110;&#24456;&#22810;&#24320;&#21457;&#32773;&#23545;&#36825;&#20123;&#25514;&#36766;&#27604;&#36739;&#22256;&#24785;&#65292;&#25152;&#20197;&#25105;&#20204;&#23558;&#31616;&#26126;&#30340;&#23450;&#20041;&#19968;&#19979;&#23427;&#20204;&#12290;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn2&quot;&gt;&#22269;&#38469;&#21270;* &#26159;&#25351;&#20026;&#20102;&#35813;&#36719;&#20214;&#22312;&#20219;&#20309;&#22320;&#21306;&#30340;&#28508;&#22312;&#20351;&#29992;&#32780;&#36827;&#34892;&#31243;&#24207;&#35774;&#35745;&#30340;&#36807;&#31243;&#12290; &#23427;&#21253;&#25324;&#20102;&#20026;&#23558;&#26469;&#32763;&#35793;&#32780;&#26631;&#35760;&#30340;&#25991;&#26412;&#65288;&#27604;&#22914;&#29992;&#25143;&#30028;&#38754;&#35201;&#32032;&#21644;&#38169;&#35823;&#20449;&#24687;&#31561;&#65289;&#12289;&#26085;&#26399;&#21644;&#26102;&#38388;&#30340;&#25277;&#35937;&#26174;&#31034;&#20197;&#20415;&#20445;&#35777;&#19981;&#21516;&#22320;&#21306;&#30340;&#26631;&#20934;&#24471;&#21040;&#36981;&#24490;&#12289;&#20026;&#19981;&#21516;&#26102;&#21306;&#25552;&#20379;&#25903;&#25345;&#65292;&#24182;&#19988;&#19968;&#33324;&#30830;&#20445;&#20195;&#30721;&#20013;&#19981;&#20250;&#23384;&#22312;&#20851;&#20110;&#20351;&#29992;&#32773;&#25152;&#22312;&#22320;&#21306;&#30340;&#20551;&#35774;&#12290; &#24744;&#20250;&#32463;&#24120;&#30475;&#21040;&#22269;&#38469;&#21270;&#34987;&#32553;&#20889;&#20026;&#8220;I18N&#8221;(18&#34920;&#31034;Internationlization&#36825;&#20010;&#21333;&#35789;&#39318;&#23383;&#27597;I&#21644;&#32467;&#23614;&#23383;&#27597;N&#20043;&#38388;&#30340;&#23383;&#27597;&#26377;18&#20010;)&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn3&quot;&gt;&#26412;&#22320;&#21270;* &#26159;&#25351;&#20351;&#19968;&#20010;&#22269;&#38469;&#21270;&#30340;&#31243;&#24207;&#20026;&#20102;&#22312;&#26576;&#20010;&#29305;&#23450;&#22320;&#21306;&#20351;&#29992;&#32780;&#36827;&#34892;&#23454;&#38469;&#32763;&#35793;&#30340;&#36807;&#31243;&#12290; &#26377;&#26102;&#65292;&#26412;&#22320;&#21270;&#32553;&#20889;&#20026; &lt;em&gt;L10N&lt;/em&gt; &#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;Django&#26412;&#36523;&#26159;&#23436;&#20840;&#22269;&#38469;&#21270;&#20102;&#30340;&#65292;&#25152;&#26377;&#30340;&#23383;&#31526;&#20018;&#22343;&#22240;&#32763;&#35793;&#25152;&#38656;&#32780;&#34987;&#26631;&#35760;&#65292;&#24182;&#19988;&#35774;&#23450;&#20102;&#19982;&#22320;&#22495;&#26080;&#20851;&#30340;&#26174;&#31034;&#25511;&#21046;&#20540;&#65292;&#22914;&#26102;&#38388;&#21644;&#26085;&#26399;&#12290; Django&#26159;&#24102;&#30528;50&#20010;&#19981;&#21516;&#30340;&#26412;&#22320;&#21270;&#25991;&#20214;&#21457;&#34892;&#30340;&#12290; &#21363;&#20351;&#24744;&#30340;&#27597;&#35821;&#19981;&#26159;&#33521;&#35821;&#65292;Django&#20063;&#24456;&#26377;&#21487;&#33021;&#24050;&#32463;&#34987;&#32763;&#35793;&#20026;&#24744;&#30340;&#27597;&#35821;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&#36825;&#20123;&#26412;&#22320;&#21270;&#25991;&#20214;&#25152;&#20351;&#29992;&#30340;&#22269;&#38469;&#21270;&#26694;&#26550;&#21516;&#26679;&#20063;&#21487;&#20197;&#34987;&#29992;&#22312;&#24744;&#33258;&#24049;&#30340;&#20195;&#30721;&#21644;&#27169;&#26495;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn6&quot;&gt;&#24744;&#21482;&#38656;&#35201;&#28155;&#21152;&#23569;&#37327;&#30340;&#25346;&#25509;&#20195;&#30721;&#21040;&#24744;&#30340;Python&#20195;&#30721;&#21644;&#27169;&#26495;&#20013;&#12290; &#36825;&#20123;&#25346;&#25509;&#20195;&#30721;&#34987;&#31216;&#20026;* &#32763;&#35793;&#23383;&#31526;&#20018;* &#12290;&#23427;&#20204;&#21578;&#35785;Django&#65306;&#22914;&#26524;&#36825;&#27573;&#25991;&#26412;&#30340;&#35793;&#25991;&#21487;&#29992;&#30340;&#35805;&#65292;&#23427;&#24212;&#34987;&#32763;&#35793;&#20026;&#32456;&#31471;&#29992;&#25143;&#25351;&#23450;&#30340;&#35821;&#35328;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;Django&#20250;&#26681;&#25454;&#29992;&#25143;&#30340;&#35821;&#35328;&#20559;&#22909;&#65292;&#22312;&#32447;&#22320;&#36816;&#29992;&#36825;&#20123;&#25346;&#25509;&#25351;&#20196;&#21435;&#32763;&#35793;Web&#24212;&#29992;&#31243;&#24207;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#26412;&#36136;&#19978;&#26469;&#35828;&#65292;Django&#20570;&#20004;&#20214;&#20107;&#24773;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn9&quot;&gt;&#23427;&#35753;&#24320;&#21457;&#32773;&#21644;&#27169;&#26495;&#30340;&#20316;&#32773;&#25351;&#23450;&#20182;&#20204;&#30340;&#24212;&#29992;&#31243;&#24207;&#30340;&#21738;&#20123;&#37096;&#20998;&#24212;&#35813;&#34987;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn10&quot;&gt;Django&#26681;&#25454;&#29992;&#25143;&#30340;&#35821;&#35328;&#20559;&#22909;&#26469;&#32763;&#35793;Web&#24212;&#29992;&#31243;&#24207;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#22791;&#27880;:&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn12&quot;&gt;Django&#30340;&#32763;&#35793;&#26426;&#21046;&#26159;&#20351;&#29992; GNU &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; (&lt;a class=&quot;reference external&quot; href=&quot;http://www.gnu.org/software/gettext/&quot;&gt;http://www.gnu.org/software/gettext/&lt;/a&gt;)&#65292;&#20855;&#20307;&#20026;Python&#33258;&#24102;&#30340;&#26631;&#20934;&#27169;&#22359; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn13&quot;&gt;&#22914;&#26524;&#24744;&#19981;&#38656;&#35201;&#22269;&#38469;&#21270;:&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;Django&#30340;&#22269;&#38469;&#21270;&#25346;&#25509;&#26159;&#40664;&#35748;&#24320;&#21551;&#30340;&#65292;&#36825;&#21487;&#33021;&#20250;&#32473;Django&#30340;&#36816;&#34892;&#22686;&#21152;&#19968;&#28857;&#28857;&#24320;&#38144;&#12290; &#22914;&#26524;&#24744;&#19981;&#38656;&#35201;&#22269;&#38469;&#21270;&#25903;&#25345;&#65292;&#37027;&#20040;&#24744;&#21487;&#20197;&#22312;&#24744;&#30340;&#35774;&#32622;&#25991;&#20214;&#20013;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;USE_I18N&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;False&lt;/span&gt;&lt;/tt&gt; &#12290; &#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;USE_I18N&lt;/span&gt;&lt;/tt&gt; &#34987;&#35774;&#20026; False &#65292;&#37027;&#20040;Django&#20250;&#36827;&#34892;&#19968;&#20123;&#20248;&#21270;&#65292;&#32780;&#19981;&#21152;&#36733;&#22269;&#38469;&#21270;&#25903;&#25345;&#26426;&#21046;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn15&quot;&gt;&#24744;&#20063;&#21487;&#20197;&#20174;&#24744;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;TEMPLATE_CONTEXT_PROCESSORS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#31227;&#38500; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.core.context_processors.i18n&apos;&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn16&quot;&gt;&#23545;&#20320;&#30340;Django&#24212;&#29992;&#36827;&#34892;&#22269;&#38469;&#21270;&#30340;&#19977;&#20010;&#27493;&#39588;:&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn17&quot;&gt;&#31532;&#19968;&#27493;&#65306;&#22312;&#20320;&#30340;Python&#20195;&#30721;&#21644;&#27169;&#26495;&#20013;&#23884;&#20837;&#24453;&#32763;&#35793;&#30340;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;2&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn18&quot;&gt;&#31532;&#20108;&#27493;&#65306;&#25226;&#37027;&#20123;&#23383;&#31526;&#20018;&#32763;&#35793;&#25104;&#20320;&#35201;&#25903;&#25345;&#30340;&#35821;&#35328;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;3&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn19&quot;&gt;&#31532;&#19977;&#27493;&#65306;&#22312;&#20320;&#30340;Django settings&#25991;&#20214;&#20013;&#28608;&#27963;&#26412;&#22320;&#20013;&#38388;&#20214;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#25105;&#20204;&#23558;&#35814;&#32454;&#22320;&#23545;&#20197;&#19978;&#27493;&#39588;&#36880;&#19968;&#36827;&#34892;&#25551;&#36848;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn21&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn21&quot;&gt;1&#12289;&#22914;&#20309;&#25351;&#23450;&#24453;&#32763;&#35793;&#23383;&#31526;&#20018;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn22&quot;&gt;&#32763;&#35793;&#23383;&#31526;&#20018;&#25351;&#23450;&#36825;&#27573;&#38656;&#35201;&#34987;&#32763;&#35793;&#30340;&#25991;&#26412;&#12290; &#36825;&#20123;&#23383;&#31526;&#20018;&#21487;&#20197;&#20986;&#29616;&#22312;&#24744;&#30340;Python&#20195;&#30721;&#21644;&#27169;&#26495;&#20013;&#12290; &#32780;&#26631;&#35760;&#20986;&#36825;&#20123;&#32763;&#35793;&#23383;&#31526;&#20018;&#21017;&#26159;&#24744;&#30340;&#36131;&#20219;&#65307;&#31995;&#32479;&#20165;&#33021;&#32763;&#35793;&#20986;&#23427;&#25152;&#30693;&#36947;&#30340;&#19996;&#35199;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;python&quot;&gt;
&lt;span id=&quot;cn23&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#22312;Python &#20195;&#30721;&#20013;&lt;/h3&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn24&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#26631;&#20934;&#32763;&#35793;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn25&quot;&gt;&#20351;&#29992;&#20989;&#25968; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ugettext()&lt;/span&gt;&lt;/tt&gt; &#26469;&#25351;&#23450;&#19968;&#20010;&#32763;&#35793;&#23383;&#31526;&#20018;&#12290; &#20316;&#20026;&#24815;&#20363;&#65292;&#20351;&#29992;&#30701;&#21035;&#21517; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_&lt;/span&gt;&lt;/tt&gt; &#26469;&#24341;&#20837;&#36825;&#20010;&#20989;&#25968;&#20197;&#33410;&#30465;&#38190;&#20837;&#26102;&#38388;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn26&quot;&gt;&#22312;&#19979;&#38754;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#25991;&#26412; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;Welcome&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;site&quot;&lt;/span&gt;&lt;/tt&gt; &#34987;&#26631;&#35760;&#20026;&#24453;&#32763;&#35793;&#23383;&#31526;&#20018;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn28&quot;&gt;from django.utils.translation import ugettext as _

def my_view(request):
    output = _(&quot;Welcome to my site.&quot;)
    return HttpResponse(output)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#26174;&#28982;&#65292;&#20320;&#20063;&#21487;&#20197;&#19981;&#20351;&#29992;&#21035;&#21517;&#26469;&#32534;&#30721;&#12290; &#19979;&#38754;&#36825;&#20010;&#20363;&#23376;&#21644;&#21069;&#38754;&#20004;&#20010;&#20363;&#23376;&#30456;&#21516;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn31&quot;&gt;from django.utils.translation import ugettext

def my_view(request):
    output = ugettext(&quot;Welcome to my site.&quot;)
    return HttpResponse(output)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn32&quot;&gt;&#32763;&#35793;&#23383;&#31526;&#20018;&#23545;&#20110;&#35745;&#31639;&#20986;&#26469;&#30340;&#20540;&#21516;&#26679;&#26377;&#25928;&#12290; &#19979;&#38754;&#36825;&#20010;&#20363;&#23376;&#31561;&#21516;&#21069;&#38754;&#19968;&#31181;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn34&quot;&gt;def my_view(request):
    words = [&apos;Welcome&apos;, &apos;to&apos;, &apos;my&apos;, &apos;site.&apos;]
    output = _(&apos; &apos;.join(words))
    return HttpResponse(output)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn35&quot;&gt;&#32763;&#35793;&#23545;&#21464;&#37327;&#20063;&#21516;&#26679;&#26377;&#25928;&#12290; &#36825;&#37324;&#26159;&#19968;&#20010;&#21516;&#26679;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn37&quot;&gt;def my_view(request):
    sentence = &apos;Welcome to my site.&apos;
    output = _(sentence)
    return HttpResponse(output)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#65288;&#20197;&#19978;&#20004;&#20010;&#20363;&#23376;&#20013;&#65292;&#23545;&#20110;&#20351;&#29992;&#21464;&#37327;&#25110;&#35745;&#31639;&#20540;&#65292;&#38656;&#35201;&#27880;&#24847;&#30340;&#19968;&#28857;&#26159;Django&#30340;&#24453;&#32763;&#35793;&#23383;&#31526;&#20018;&#26816;&#27979;&#24037;&#20855;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;make-messages.py&lt;/span&gt;&lt;/tt&gt; &#65292;&#23558;&#19981;&#33021;&#25214;&#21040;&#36825;&#20123;&#23383;&#31526;&#20018;&#12290; &#31245;&#21518;&#65292;&#22312;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;makemessages&lt;/span&gt;&lt;/tt&gt; &#20013;&#20250;&#26377;&#26356;&#22810;&#35752;&#35770;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&#20320;&#20256;&#36882;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_()&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext()&lt;/span&gt;&lt;/tt&gt; &#30340;&#23383;&#31526;&#20018;&#21487;&#20197;&#25509;&#21463;&#21344;&#20301;&#31526;&#65292;&#30001;Python&#26631;&#20934;&#21629;&#21517;&#23383;&#31526;&#20018;&#25554;&#20837;&#21477;&#27861;&#25351;&#23450;&#30340;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn41&quot;&gt;def my_view(request, m, d):
    output = _(&apos;Today is %(month)s %(day)s.&apos;) % {&apos;month&apos;: m, &apos;day&apos;: d}
    return HttpResponse(output)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn42&quot;&gt;&#36825;&#39033;&#25216;&#26415;&#20351;&#24471;&#29305;&#23450;&#35821;&#35328;&#30340;&#35793;&#25991;&#21487;&#20197;&#23545;&#36825;&#27573;&#25991;&#26412;&#36827;&#34892;&#37325;&#26032;&#25490;&#24207;&#12290; &#27604;&#22914;&#65292;&#19968;&#27573;&#33521;&#35821;&#35793;&#25991;&#21487;&#33021;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;Today&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;November&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;26.&quot;&lt;/span&gt;&lt;/tt&gt; &#65292;&#32780;&#19968;&#27573;&#35199;&#29677;&#29273;&#35821;&#35793;&#25991;&#20250;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;Hoy&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;es&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;26&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;de&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Noviembre.&quot;&lt;/span&gt;&lt;/tt&gt; &#20351;&#29992;&#21344;&#20301;&#31526;&#65288;&#26376;&#20221;&#21644;&#26085;&#26399;&#65289;&#20132;&#25442;&#23427;&#20204;&#30340;&#20301;&#32622;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn43&quot;&gt;&#30001;&#20110;&#36825;&#20010;&#21407;&#22240;&#65292;&#26080;&#35770;&#20309;&#26102;&#24403;&#20320;&#26377;&#22810;&#20110;&#19968;&#20010;&#21333;&#19968;&#21442;&#25968;&#26102;&#65292;&#20320;&#24212;&#24403;&#20351;&#29992;&#21629;&#21517;&#23383;&#31526;&#20018;&#25554;&#20837;&#65288;&#20363;&#22914;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;%(day)s&lt;/span&gt;&lt;/tt&gt; &#65289;&#26469;&#26367;&#20195;&#20301;&#32622;&#25554;&#20837;&#65288;&#20363;&#22914;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;%s&lt;/span&gt;&lt;/tt&gt; or &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;%d&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290; &#22914;&#26524;&#20320;&#20351;&#29992;&#20301;&#32622;&#25554;&#20837;&#30340;&#35805;&#65292;&#32763;&#35793;&#21160;&#20316;&#23558;&#19981;&#33021;&#37325;&#26032;&#25490;&#24207;&#21344;&#20301;&#31526;&#25991;&#26412;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn44&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#26631;&#35760;&#23383;&#31526;&#20018;&#20026;&#19981;&#25805;&#20316;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.translation.gettext_noop()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#26469;&#26631;&#35760;&#19968;&#20010;&#19981;&#38656;&#35201;&#31435;&#21363;&#32763;&#35793;&#30340;&#23383;&#31526;&#20018;&#12290; &#36825;&#20010;&#20018;&#20250;&#31245;&#21518;&#20174;&#21464;&#37327;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#20351;&#29992;&#36825;&#31181;&#26041;&#27861;&#30340;&#29615;&#22659;&#26159;&#65292;&#26377;&#23383;&#31526;&#20018;&#24517;&#39035;&#20197;&#21407;&#22987;&#35821;&#35328;&#30340;&#24418;&#24335;&#23384;&#20648;&#65288;&#22914;&#20648;&#23384;&#22312;&#25968;&#25454;&#24211;&#20013;&#30340;&#23383;&#31526;&#20018;&#65289;&#32780;&#22312;&#26368;&#21518;&#38656;&#35201;&#34987;&#32763;&#35793;&#20986;&#26469;&#65288;&#22914;&#26174;&#31034;&#32473;&#29992;&#25143;&#26102;&#65289;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn47&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#24816;&#24615;&#32763;&#35793;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.translation.gettext_lazy()&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#65292;&#20351;&#24471;&#20854;&#20013;&#30340;&#20540;&#21482;&#26377;&#22312;&#35775;&#38382;&#26102;&#25165;&#20250;&#34987;&#32763;&#35793;&#65292;&#32780;&#19981;&#26159;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext_lazy()&lt;/span&gt;&lt;/tt&gt; &#34987;&#35843;&#29992;&#26102;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#20363;&#22914;&#65306;&#35201;&#32763;&#35793;&#19968;&#20010;&#27169;&#22411;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;help_text&lt;/span&gt;&lt;/tt&gt;&#65292;&#25353;&#20197;&#19979;&#36827;&#34892;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn51&quot;&gt;from django.utils.translation import ugettext_lazy

class MyThing(models.Model):
    name = models.CharField(help_text=ugettext_lazy(&apos;This is the help text&apos;))
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ugettext_lazy()&lt;/span&gt;&lt;/tt&gt; &#23558;&#23383;&#31526;&#20018;&#20316;&#20026;&#24816;&#24615;&#21442;&#29031;&#23384;&#20648;&#65292;&#32780;&#19981;&#26159;&#23454;&#38469;&#32763;&#35793;&#12290; &#32763;&#35793;&#24037;&#20316;&#23558;&#22312;&#23383;&#31526;&#20018;&#22312;&#23383;&#31526;&#20018;&#19978;&#19979;&#25991;&#20013;&#34987;&#29992;&#21040;&#26102;&#36827;&#34892;&#65292;&#27604;&#22914;&#22312;Django&#31649;&#29702;&#39029;&#38754;&#25552;&#20132;&#27169;&#26495;&#26102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn53&quot;&gt;&#22312;Python&#20013;&#65292;&#26080;&#35770;&#20309;&#22788;&#20320;&#35201;&#20351;&#29992;&#19968;&#20010;unicode &#23383;&#31526;&#20018;&#65288;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;unicode&lt;/span&gt;&lt;/tt&gt; &#31867;&#22411;&#30340;&#23545;&#35937;&#65289;&#65292;&#24744;&#37117;&#21487;&#20197;&#20351;&#29992;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ugettext_lazy()&lt;/span&gt;&lt;/tt&gt; &#35843;&#29992;&#30340;&#32467;&#26524;&#12290; &#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ugettext_lazy()&lt;/span&gt;&lt;/tt&gt;&#23545;&#35937;&#24182;&#19981;&#30693;&#36947;&#22914;&#20309;&#25226;&#23427;&#33258;&#24049;&#36716;&#25442;&#25104;&#19968;&#20010;&#23383;&#33410;&#20018;&#12290;&#22914;&#26524;&#20320;&#23581;&#35797;&#22312;&#19968;&#20010;&#38656;&#35201;&#23383;&#33410;&#20018;&#30340;&#22320;&#26041;&#20351;&#29992;&#23427;&#65292;&#20107;&#24773;&#23558;&#19981;&#20250;&#22914;&#20320;&#26399;&#24453;&#30340;&#37027;&#26679;&#12290; &#21516;&#26679;&#65292;&#20320;&#20063;&#19981;&#33021;&#22312;&#19968;&#20010;&#23383;&#33410;&#20018;&#20013;&#20351;&#29992;&#19968;&#20010; unicode &#23383;&#31526;&#20018;&#12290;&#25152;&#20197;&#65292;&#36825;&#21516;&#24120;&#35268;&#30340;Python&#34892;&#20026;&#26159;&#19968;&#33268;&#30340;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn55&quot;&gt;# This is fine: putting a unicode proxy into a unicode string.
u&quot;Hello %s&quot; % ugettext_lazy(&quot;people&quot;)

# This will not work, since you cannot insert a unicode object
# into a bytestring (nor can you insert our unicode proxy there)
&quot;Hello %s&quot; % ugettext_lazy(&quot;people&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn56&quot;&gt;&#22914;&#26524;&#20320;&#26366;&#32463;&#35265;&#21040;&#21040;&#20687;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;/tt&gt;&#36825;&#26679;&#30340;&#36755;&#20986;&#65292;&#20320;&#23601;&#21487;&#33021;&#22312;&#19968;&#20010;&#23383;&#33410;&#20018;&#20013;&#25554;&#20837;&#20102;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ugettext_lazy()&lt;/span&gt;&lt;/tt&gt;&#30340;&#32467;&#26524;&#12290;
&#22312;&#24744;&#30340;&#20195;&#30721;&#20013;&#65292;&#37027;&#26159;&#19968;&#20010;&#28431;&#27934;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn57&quot;&gt;&#22914;&#26524;&#35273;&#24471; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext_lazy&lt;/span&gt;&lt;/tt&gt; &#22826;&#36807;&#20887;&#38271;&#65292;&#21487;&#20197;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_&lt;/span&gt;&lt;/tt&gt; &#65288;&#19979;&#21010;&#32447;&#65289;&#20316;&#20026;&#21035;&#21517;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn59&quot;&gt;from django.utils.translation import ugettext_lazy as _

class MyThing(models.Model):
    name = models.CharField(help_text=_(&apos;This is the help text&apos;))
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#22312;Django&#27169;&#22411;&#20013;&#24635;&#26159;&#26080;&#19968;&#20363;&#22806;&#30340;&#20351;&#29992;&#24816;&#24615;&#32763;&#35793;&#12290; &#20026;&#20102;&#32763;&#35793;&#65292;&#23383;&#27573;&#21517;&#21644;&#34920;&#21517;&#24212;&#35813;&#34987;&#26631;&#35760;&#12290;&#65288;&#21542;&#21017;&#30340;&#35805;&#65292;&#22312;&#31649;&#29702;&#30028;&#38754;&#20013;&#23427;&#20204;&#23558;&#19981;&#20250;&#34987;&#32763;&#35793;&#65289; &#36825;&#24847;&#21619;&#30528;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Meta&lt;/span&gt;&lt;/tt&gt;&#31867;&#20013;&#26174;&#24335;&#22320;&#32534;&#20889;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_nane&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_name_plural&lt;/span&gt;&lt;/tt&gt;&#36873;&#39033;&#65292;&#32780;&#19981;&#26159;&#20381;&#36182;&#20110;Django&#40664;&#35748;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_name&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;verbose_name_plural&lt;/span&gt;&lt;/tt&gt;&#65288;&#36890;&#36807;&#26816;&#26597;model&#30340;&#31867;&#21517;&#24471;&#21040;&#65289;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn62&quot;&gt;from django.utils.translation import ugettext_lazy as _

class MyThing(models.Model):
    name = models.CharField(_(&apos;name&apos;), help_text=_(&apos;This is the help text&apos;))
    class Meta:
        verbose_name = _(&apos;my thing&apos;)
        verbose_name_plural = _(&apos;mythings&apos;)
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn63&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#22797;&#25968;&#30340;&#22788;&#29702;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.translation.ungettext()&lt;/span&gt;&lt;/tt&gt;&#26469;&#25351;&#23450;&#20197;&#22797;&#25968;&#24418;&#24335;&#34920;&#31034;&#30340;&#28040;&#24687;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn66&quot;&gt;from django.utils.translation import ungettext

def hello_world(request, count):
    page = ungettext(&apos;there is %(count)d object&apos;,
        &apos;there are %(count)d objects&apos;, count) % {
            &apos;count&apos;: count,
        }
    return HttpResponse(page)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ngettext&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#21253;&#25324;&#19977;&#20010;&#21442;&#25968;&#65306; &#21333;&#25968;&#24418;&#24335;&#30340;&#32763;&#35793;&#23383;&#31526;&#20018;&#65292;&#22797;&#25968;&#24418;&#24335;&#30340;&#32763;&#35793;&#23383;&#31526;&#20018;&#65292;&#21644;&#23545;&#35937;&#30340;&#20010;&#25968;&#65288;&#23558;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;count&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#20256;&#36882;&#32473;&#38656;&#35201;&#32763;&#35793;&#30340;&#35821;&#35328;&#65289;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn68&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn68&quot;&gt;&#27169;&#26495;&#20195;&#30721;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn69&quot;&gt;Django&#27169;&#26495;&#20351;&#29992;&#20004;&#31181;&#27169;&#26495;&#26631;&#31614;&#65292;&#19988;&#35821;&#27861;&#26684;&#24335;&#19982;Python&#20195;&#30721;&#26377;&#20123;&#35768;&#19981;&#21516;&#12290; &#20026;&#20102;&#20351;&#24471;&#27169;&#26495;&#35775;&#38382;&#21040;&#26631;&#31614;&#65292;&#38656;&#35201;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;i18n&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#25918;&#22312;&#27169;&#26495;&#26368;&#21069;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#36825;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;trans&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt;&#27169;&#26495;&#26631;&#35760;&#32763;&#35793;&#19968;&#20010;&#24120;&#37327;&#23383;&#31526;&#20018; (&#25324;&#20197;&#21333;&#25110;&#21452;&#24341;&#21495;) &#25110; &#21487;&#21464;&#20869;&#23481;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn72&quot;&gt;&amp;lt;title&amp;gt;{% trans &quot;This is the title.&quot; %}&amp;lt;/title&amp;gt;
&amp;lt;title&amp;gt;{% trans myvar %}&amp;lt;/title&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn73&quot;&gt;&#22914;&#26524;&#26377;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;noop&lt;/span&gt;&lt;/tt&gt; &#36873;&#39033;&#65292;&#21464;&#37327;&#26597;&#35810;&#36824;&#26159;&#26377;&#25928;&#20294;&#32763;&#35793;&#20250;&#36339;&#36807;&#12290; &#24403;&#31354;&#32570;&#20869;&#23481;&#35201;&#27714;&#23558;&#26469;&#20877;&#32763;&#35793;&#26102;&#65292;&#36825;&#24456;&#26377;&#29992;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn75&quot;&gt;&amp;lt;title&amp;gt;{% trans &quot;myvar&quot; noop %}&amp;lt;/title&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&#22312;&#19968;&#20010;&#24102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;trans&lt;/span&gt;
&lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#30340;&#23383;&#31526;&#20018;&#20013;&#65292;&#28151;&#36827;&#19968;&#20010;&#27169;&#26495;&#21464;&#37327;&#26159;&#19981;&#21487;&#33021;&#30340;&#12290;&#22914;&#26524;&#20320;&#30340;&#35793;&#25991;&#35201;&#27714;&#23383;&#31526;&#20018;&#24102;&#26377;&#21464;&#37327;(&#21344;&#20301;&#31526;placeholders)&#65292;&#35831;&#20351;&#29992;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;blocktrans&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn78&quot;&gt;{% blocktrans %}This string will have {{ value }} inside.{% endblocktrans %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&#20351;&#29992;&#27169;&#26495;&#36807;&#28388;&#22120;&#26469;&#32763;&#35793;&#19968;&#20010;&#27169;&#26495;&#34920;&#36798;&#24335;&#65292;&#38656;&#35201;&#22312;&#32763;&#35793;&#30340;&#36825;&#27573;&#25991;&#26412;&#20013;&#23558;&#34920;&#36798;&#24335;&#32465;&#23450;&#21040;&#19968;&#20010;&#26412;&#22320;&#21464;&#37327;&#20013;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn81&quot;&gt;{% blocktrans with value|filter as myvar %}
This will have {{ myvar }} inside.
{% endblocktrans %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&#22914;&#26524;&#38656;&#35201;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;blocktrans&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#20869;&#32465;&#23450;&#22810;&#20010;&#34920;&#36798;&#24335;&#65292;&#21487;&#20197;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;and&lt;/span&gt;&lt;/tt&gt; &#26469;&#20998;&#38548;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn84&quot;&gt;{% blocktrans with book|title as book_t and author|title as author_t %}
This is {{ book_t }} by {{ author_t }}
{% endblocktrans %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&#20026;&#20102;&#34920;&#31034;&#21333;&#22797;&#25968;&#30456;&#20851;&#30340;&#20869;&#23481;&#65292;&#38656;&#35201;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;blocktrans&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;endblocktrans&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#20043;&#38388;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;plural&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#26469;&#25351;&#23450;&#21333;&#22797;&#25968;&#24418;&#24335;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn87&quot;&gt;{% blocktrans count list|length as counter %}
There is only one {{ name }} object.
{% plural %}
There are {{ counter }} {{ name }} objects.
{% endblocktrans %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#20854;&#20869;&#22312;&#26426;&#21046;&#26159;&#65292;&#25152;&#26377;&#30340;&#22359;&#21644;&#20869;&#23884;&#32763;&#35793;&#35843;&#29992;&#30456;&#24212;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ngettext&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#27599;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt;&#21487;&#20197;&#35775;&#38382;&#19977;&#20010;&#25351;&#23450;&#32763;&#35793;&#21464;&#37327;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn90&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn90&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;LANGUAGES&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;}}&lt;/span&gt;&lt;/tt&gt; &#26159;&#19968;&#31995;&#21015;&#20803;&#32452;&#32452;&#25104;&#30340;&#21015;&#34920;&#65292;&#27599;&#20010;&#20803;&#32452;&#30340;&#31532;&#19968;&#20010;&#20803;&#32032;&#26159;&#35821;&#35328;&#20195;&#30721;&#65292;&#31532;&#20108;&#20010;&#20803;&#32032;&#26159;&#29992;&#35813;&#35821;&#35328;&#34920;&#31034;&#30340;&#35821;&#35328;&#21517;&#31216;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn91&quot;&gt;&#20316;&#20026;&#19968;&#20108;&#23383;&#31526;&#20018;&#65292;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt;&#26159;&#24403;&#21069;&#29992;&#25143;&#30340;&#20248;&#20808;&#35821;&#35328;&#12290;
&#20363;&#22914;&#65306; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;en-us&lt;/span&gt;&lt;/tt&gt;&#12290;&#65288;&#35831;&#21442;&#35265;&#19979;&#38754;&#30340;Django&#22914;&#20309;&#21457;&#29616;&#35821;&#35328;&#20559;&#22909;&#65289;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn92&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_BIDI&lt;/span&gt;&lt;/tt&gt;&#23601;&#26159;&#24403;&#21069;&#22320;&#22495;&#30340;&#35828;&#26126;&#12290; &#22914;&#26524;&#20026;&#30495;&#65288;True&#65289;&#65292;&#23427;&#23601;&#26159;&#20174;&#21491;&#21521;&#24038;&#20070;&#20889;&#30340;&#35821;&#35328;&#65292;&#20363;&#22914;&#65306; &#24076;&#20271;&#26469;&#35821;&#65292;&#38463;&#25289;&#20271;&#35821;&#12290; &#22914;&#26524;&#20026;&#20551;&#65288;False&#65289;&#65292;&#23427;&#23601;&#26159;&#20174;&#24038;&#21040;&#21491;&#20070;&#20889;&#30340;&#35821;&#35328;&#65292;&#22914;&#65306; &#33521;&#35821;&#65292;&#27861;&#35821;&#65292;&#24503;&#35821;&#31561;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&#22914;&#26524;&#20320;&#19981;&#29992;&#36825;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;RequestContext&lt;/span&gt;&lt;/tt&gt;&#25193;&#23637;&#65292;&#20320;&#21487;&#20197;&#29992;3&#20010;&#26631;&#35760;&#21040;&#37027;&#20123;&#20540;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn95&quot;&gt;{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_current_language_bidi as LANGUAGE_BIDI %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#36825;&#20123;&#26631;&#35760;&#20134;&#35201;&#27714;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;i18n&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;%}&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#32763;&#35793;&#30340;hook&#22312;&#20219;&#20309;&#25509;&#21463;&#24120;&#37327;&#23383;&#31526;&#20018;&#30340;&#27169;&#26495;&#22359;&#26631;&#31614;&#20869;&#20063;&#26159;&#21487;&#20197;&#20351;&#29992;&#30340;&#12290; &#27492;&#26102;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_()&lt;/span&gt;&lt;/tt&gt; &#34920;&#36798;&#24335;&#26469;&#25351;&#23450;&#32763;&#35793;&#23383;&#31526;&#20018;&#65292;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn99&quot;&gt;{% some_special_tag _(&quot;Page not found&quot;) value|yesno:_(&quot;yes,no&quot;) %}
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#26631;&#35760;&#21644;&#36807;&#28388;&#22120;&#20004;&#20010;&#37117;&#20250;&#30475;&#21040;&#24050;&#32463;&#32763;&#35793;&#30340;&#23383;&#31526;&#20018;&#65292;&#25152;&#26377;&#23427;&#20204;&#24182;&#19981;&#38656;&#35201;&#25552;&#38450;&#32763;&#35793;&#25805;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&#22791;&#27880;:&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn102&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#32763;&#35793;&#32467;&#26500;&#23558;&#25918;&#36807;&#23383;&#31526;&#20018;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;yes,no&quot;&lt;/span&gt;&lt;/tt&gt;&#65292;&#32780;&#19981;&#26159;&#21333;&#29420;&#30340;&#23383;&#31526;&#20018;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;yes&quot;&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;no&quot;&lt;/span&gt;&lt;/tt&gt;&#12290;&#32763;&#35793;&#30340;&#23383;&#31526;&#20018;&#23558;&#38656;&#35201;&#21253;&#25324;&#36887;&#21495;&#20197;&#20415;&#36807;&#28388;&#22120;&#35299;&#26512;&#20195;&#30721;&#26126;&#30333;&#22914;&#20309;&#20998;&#21106;&#21442;&#25968;&#12290; &#20363;&#22914;&#65292; &#19968;&#20010;&#24503;&#35821;&#32763;&#35793;&#22120;&#21487;&#33021;&#20250;&#32763;&#35793;&#23383;&#31526;&#20018; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;yes,no&quot;&lt;/span&gt;&lt;/tt&gt; &#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;ja,nein&quot;&lt;/span&gt;&lt;/tt&gt; (&#20445;&#25345;&#36887;&#21495;&#21407;&#23553;&#19981;&#21160;)&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn103&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn103&quot;&gt;&#19982;&#24816;&#24615;&#32763;&#35793;&#23545;&#35937;&#19968;&#36947;&#24037;&#20316;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&#22312;&#27169;&#22411;&#21644;&#20844;&#29992;&#20989;&#25968;&#20013;&#65292;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ugettext_lazy()&lt;/span&gt;&lt;/tt&gt;&#21644;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ungettext_lazy()&lt;/span&gt;&lt;/tt&gt;&#26469;&#26631;&#35760;&#23383;&#31526;&#20018;&#26159;&#24456;&#26222;&#36941;&#30340;&#25805;&#20316;&#12290; &#24403;&#20320;&#22312;&#20320;&#30340;&#20195;&#30721;&#20013;&#20854;&#23427;&#22320;&#26041;&#20351;&#29992;&#36825;&#20123;&#23545;&#35937;&#26102;&#65292;&#20320;&#24212;&#24403;&#30830;&#23450;&#20320;&#19981;&#20250;&#24847;&#22806;&#22320;&#36716;&#25442;&#23427;&#20204;&#25104;&#19968;&#20010;&#23383;&#31526;&#20018;&#65292;&#22240;&#20026;&#23427;&#20204;&#24212;&#34987;&#23613;&#37327;&#26202;&#22320;&#36716;&#25442;&#65288;&#20197;&#20415;&#27491;&#30830;&#30340;&#22320;&#22495;&#29983;&#25928;&#65289; &#36825;&#38656;&#35201;&#20351;&#29992;&#21450;&#20010;&#24110;&#21161;&#20989;&#25968;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;string-concat&quot;&gt;
&lt;span id=&quot;cn105&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&#25340;&#25509;&#23383;&#31526;&#20018;&#65306; string_concat()&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#26631;&#20934;Python&#23383;&#31526;&#20018;&#25340;&#25509;(&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;&apos;.join([...])&lt;/span&gt;&lt;/tt&gt; ) &#23558;&#19981;&#20250;&#24037;&#20316;&#22312;&#21253;&#25324;&#24816;&#24615;&#32763;&#35793;&#23545;&#35937;&#30340;&#21015;&#34920;&#19978;&#12290; &#20316;&#20026;&#26367;&#20195;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.translation.string_concat()&lt;/span&gt;&lt;/tt&gt;&#65292; &#36825;&#20010;&#20989;&#25968;&#21019;&#24314;&#20102;&#19968;&#20010;&#24816;&#24615;&#23545;&#35937;&#65292;&#20854;&#36830;&#25509;&#36215;&#23427;&#30340;&#20869;&#23481; &lt;em&gt;&#24182;&#19988;&lt;/em&gt; &#20165;&#24403;&#32467;&#26524;&#34987;&#21253;&#25324;&#22312;&#19968;&#20010;&#23383;&#31526;&#20018;&#20013;&#26102;&#36716;&#25442;&#23427;&#20204;&#20026;&#23383;&#31526;&#20018; &#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn108&quot;&gt;from django.utils.translation import string_concat
# ...
name = ugettext_lazy(u&apos;John Lennon&apos;)
instrument = ugettext_lazy(u&apos;guitar&apos;)
result = string_concat([name, &apos;: &apos;, instrument])
&lt;/pre&gt;
&lt;div class=&quot;system-message&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: ERROR/3 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 519)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;Error in &#8220;cnid&#8221; directive:
no content permitted.&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn108&quot;&gt;.. cnid:: 109


  &#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#24403;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;system-message&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 523)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;Explicit markup ends without a blank line; unexpected unindent.&lt;/p&gt;
&lt;/div&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;result&lt;/span&gt;&lt;/tt&gt; &#33258;&#24049;&#34987;&#29992;&#19982;&#19968;&#20010;&#23383;&#31526;&#20018;&#26102;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;result&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#24816;&#24615;&#32763;&#35793;&#23558;&#20165;&#34987;&#36716;&#25442;&#20026;&#23383;&#31526;&#20018;(&#36890;&#24120;&#22312;&#27169;&#26495;&#28210;&#26579;&#26102;&#38388;)&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;allow-lazy&quot;&gt;
&lt;span id=&quot;cn110&quot;&gt;&lt;/span&gt;&lt;h4 class=&quot;cn&quot; id=&quot;cn110&quot;&gt;allow_lazy() &#20462;&#39280;&#31526;&lt;/h4&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn111&quot;&gt;Django&#25552;&#20379;&#24456;&#22810;&#21151;&#33021;&#20989;&#25968;&#65288;&#22914;&#65306;&#21462;&#19968;&#20010;&#23383;&#31526;&#20018;&#20316;&#20026;&#20182;&#20204;&#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#24182;&#19988;&#23545;&#37027;&#20010;&#23383;&#31526;&#20018;&#20570;&#20123;&#20160;&#20040;&#65289;&#12290;(&#23588;&#20854;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils&lt;/span&gt;&lt;/tt&gt; &#20013;) &#36825;&#20123;&#20989;&#25968;&#34987;&#27169;&#26495;&#36807;&#28388;&#22120;&#20687;&#22312;&#20854;&#20182;&#20195;&#30721;&#20013;&#19968;&#26679;&#30452;&#25509;&#20351;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn112&quot;&gt;&#22914;&#26524;&#20320;&#20889;&#20320;&#33258;&#24049;&#30340;&#31867;&#20284;&#20989;&#25968;&#24182;&#19988;&#19982;&#32763;&#35793;&#25171;&#20132;&#36947;&#65292;&#24403;&#31532;&#19968;&#20010;&#21442;&#25968;&#26159;&#24816;&#24615;&#32763;&#35793;&#23545;&#35937;&#26102;&#65292;&#20320;&#20250;&#38754;&#20020;&#8220;&#20570;&#20160;&#20040;&#8221;&#30340;&#38590;&#39064;&#12290;
&#22240;&#20026;&#20320;&#21487;&#33021;&#22312;&#35270;&#22270;&#20043;&#22806;&#20351;&#29992;&#36825;&#20010;&#20989;&#25968;&#65288;&#24182;&#19988;&#22240;&#27492;&#24403;&#21069;&#32447;&#31243;&#30340;&#26412;&#22320;&#35774;&#32622;&#23558;&#20250;&#19981;&#27491;&#30830;&#65289;&#65292;&#25152;&#20197;&#20320;&#19981;&#24819;&#31435;&#21363;&#36716;&#25442;&#20854;&#20026;&#19968;&#20010;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn113&quot;&gt;&#35937;&#36825;&#31181;&#24773;&#20917;&#65292;&#35831;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.functional.allow_lazy()&lt;/span&gt;&lt;/tt&gt;
&#20462;&#39280;&#31526;&#12290; &#23427;&#20462;&#25913;&#36825;&#20010;&#20989;&#25968;&#20197;&#20415; &lt;em&gt;&#20551;&#22914;&lt;/em&gt;&#31532;&#19968;&#20010;&#21442;&#25968;&#26159;&#19968;&#20010;&#24816;&#24615;&#32763;&#35793;&#65292; &#36825;&#20010;&#20989;&#25968;&#30340;&#36171;&#20540;&#20250;&#34987;&#24310;&#21518;&#30452;&#21040;&#23427;&#38656;&#35201;&#34987;&#36716;&#21270;&#20026;&#19968;&#20010;&#23383;&#31526;&#20018;&#20026;&#27490;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#20363;&#22914;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn116&quot;&gt;from django.utils.functional import allow_lazy

def fancy_utility_function(s, ...):
    # Do some conversion on string &apos;s&apos;
    # ...
fancy_utility_function = allow_lazy(fancy_utility_function, unicode)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;allow_lazy()&lt;/span&gt;&lt;/tt&gt; &#35013;&#39280;&#31526; &#37319;&#29992;&#20102;&#21478;&#22806;&#30340;&#20989;&#25968;&#26469;&#35013;&#39280;&#65292;&#20197;&#21450;&#19968;&#23450;&#37327;&#30340;&#65292;&#21407;&#22987;&#20989;&#25968;&#21487;&#20197;&#36820;&#22238;&#30340;&#29305;&#23450;&#31867;&#22411;&#30340;&#39069;&#22806;&#21442;&#25968; (&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;*args&lt;/span&gt;&lt;/tt&gt; ) &#12290; &#36890;&#24120;&#65292;&#22312;&#36825;&#37324;&#21253;&#25324; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;unicode&lt;/span&gt;&lt;/tt&gt; &#23601;&#36275;&#22815;&#20102;&#24182;&#19988;&#30830;&#23450;&#20320;&#30340;&#20989;&#25968;&#23558;&#20165;&#36820;&#22238;Unicode&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&#20351;&#29992;&#36825;&#20010;&#20462;&#39280;&#31526;&#24847;&#21619;&#30528;&#20320;&#33021;&#20889;&#20320;&#30340;&#20989;&#25968;&#24182;&#19988;&#20551;&#35774;&#36755;&#20837;&#26159;&#21512;&#36866;&#30340;&#23383;&#31526;&#20018;&#65292;&#28982;&#21518;&#22312;&#26411;&#23614;&#28155;&#21152;&#23545;&#24816;&#24615;&#32763;&#35793;&#23545;&#35937;&#30340;&#25903;&#25345;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn119&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn119&quot;&gt;2&#12289;&#22914;&#20309;&#21019;&#24314;&#35821;&#35328;&#25991;&#20214;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn120&quot;&gt;&#24403;&#20320;&#26631;&#35760;&#20102;&#32763;&#35793;&#23383;&#31526;&#20018;&#65292;&#20320;&#23601;&#38656;&#35201;&#20889;&#20986;&#65288;&#25110;&#33719;&#21462;&#24050;&#26377;&#30340;&#65289;&#23545;&#24212;&#30340;&#35821;&#35328;&#32763;&#35793;&#20449;&#24687;&#12290; &#36825;&#37324;&#23601;&#26159;&#23427;&#22914;&#20309;&#24037;&#20316;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn121&quot;&gt;&#22320;&#22495;&#38480;&#21046;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn122&quot;&gt;Django&#19981;&#25903;&#25345;&#25226;&#20320;&#30340;&#24212;&#29992;&#26412;&#22320;&#21270;&#21040;&#19968;&#20010;&#36830;&#23427;&#33258;&#24049;&#37117;&#36824;&#27809;&#34987;&#32763;&#35793;&#30340;&#22320;&#22495;&#12290; &#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#23427;&#23558;&#24573;&#30053;&#20320;&#30340;&#32763;&#35793;&#25991;&#20214;&#12290; &#22914;&#26524;&#20320;&#24819;&#23581;&#35797;&#36825;&#20010;&#24182;&#19988;Django&#25903;&#25345;&#23427;&#65292;&#20320;&#20250;&#19981;&#21487;&#36991;&#20813;&#22320;&#35265;&#21040;&#36825;&#26679;&#19968;&#20010;&#28151;&#21512;&#20307;&#8211;&#8211;&#21442;&#26434;&#30528;&#20320;&#30340;&#35793;&#25991;&#21644;&#26469;&#33258;Django&#33258;&#24049;&#30340;&#33521;&#25991;&#12290; &#22914;&#26524;&#20320;&#30340;&#24212;&#29992;&#38656;&#35201;&#20320;&#25903;&#25345;&#19968;&#20010;Django&#20013;&#27809;&#26377;&#30340;&#22320;&#22495;&#65292;&#20320;&#23558;&#33267;&#23569;&#38656;&#35201;&#20570;&#19968;&#20010;Django core&#30340;&#26368;&#23567;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn123&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn123&quot;&gt;&#28040;&#24687;&#25991;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;&#31532;&#19968;&#27493;&#65292;&#23601;&#26159;&#20026;&#19968;&#31181;&#35821;&#35328;&#21019;&#24314;&#19968;&#20010;&#20449;&#24687;&#25991;&#20214;&#12290; &#20449;&#24687;&#25991;&#20214;&#26159;&#21253;&#21547;&#20102;&#26576;&#19968;&#35821;&#35328;&#32763;&#35793;&#23383;&#31526;&#20018;&#21644;&#23545;&#36825;&#20123;&#23383;&#31526;&#20018;&#30340;&#32763;&#35793;&#30340;&#19968;&#20010;&#25991;&#26412;&#25991;&#20214;&#12290; &#20449;&#24687;&#25991;&#20214;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.po&lt;/span&gt;&lt;/tt&gt; &#20026;&#21518;&#32512;&#21517;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;Django&#20013;&#24102;&#26377;&#19968;&#20010;&#24037;&#20855;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;bin/make-messages.py&lt;/span&gt;&lt;/tt&gt; &#65292;&#23427;&#23436;&#25104;&#20102;&#36825;&#20123;&#25991;&#20214;&#30340;&#21019;&#24314;&#21644;&#32500;&#25252;&#24037;&#20316;&#12290; &#36816;&#34892;&#20197;&#19979;&#21629;&#20196;&#26469;&#21019;&#24314;&#25110;&#26356;&#26032;&#19968;&#20010;&#20449;&#24687;&#25991;&#20214;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn127&quot;&gt;django-admin.py makemessages -l de
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#20854;&#20013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;de&lt;/span&gt;&lt;/tt&gt; &#26159;&#25152;&#21019;&#24314;&#30340;&#20449;&#24687;&#25991;&#20214;&#30340;&#35821;&#35328;&#20195;&#30721;&#12290; &#22312;&#36825;&#37324;&#65292;&#35821;&#35328;&#20195;&#30721;&#26159;&#20197;&#26412;&#22320;&#26684;&#24335;&#32473;&#20986;&#30340;&#12290; &#20363;&#22914;&#65292;&#24052;&#35199;&#22320;&#21306;&#30340;&#33889;&#33796;&#29273;&#35821;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pt_BR&lt;/span&gt;&lt;/tt&gt; &#65292;&#28595;&#22823;&#21033;&#20122;&#22320;&#21306;&#30340;&#24503;&#35821;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;de_AT&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#36825;&#27573;&#33050;&#26412;&#24212;&#35813;&#22312;&#19977;&#22788;&#20043;&#19968;&#36816;&#34892;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn130&quot;&gt;Django&#39033;&#30446;&#26681;&#30446;&#24405;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn131&quot;&gt;&#24744;Django&#24212;&#29992;&#30340;&#26681;&#30446;&#24405;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn132&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django&lt;/span&gt;&lt;/tt&gt; &#26681;&#30446;&#24405;&#65288;&#19981;&#26159;Subversion&#26816;&#20986;&#30446;&#24405;&#65292;&#32780;&#26159;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;$PYTHONPATH&lt;/span&gt;&lt;/tt&gt; &#38142;&#25509;&#25110;&#20301;&#20110;&#35813;&#36335;&#24452;&#30340;&#26576;&#22788;&#65289;&#12290;
&#36825;&#20165;&#21644;&#20320;&#20026;Django&#33258;&#24049;&#21019;&#24314;&#19968;&#20010;&#32763;&#35793;&#26102;&#26377;&#20851;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#36825;&#27573;&#33050;&#26412;&#36941;&#21382;&#20320;&#30340;&#39033;&#30446;&#28304;&#26641;&#25110;&#20320;&#30340;&#24212;&#29992;&#31243;&#24207;&#28304;&#26641;&#24182;&#19988;&#25552;&#21462;&#20986;&#25152;&#26377;&#20026;&#32763;&#35793;&#32780;&#34987;&#26631;&#35760;&#30340;&#23383;&#31526;&#20018;&#12290; &#23427;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locale/LANG/LC_MESSAGES&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#19979;&#21019;&#24314;&#65288;&#25110;&#26356;&#26032;&#65289;&#20102;&#19968;&#20010;&#20449;&#24687;&#25991;&#20214;&#12290;&#38024;&#23545;&#19978;&#38754;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;de&lt;/span&gt;&lt;/tt&gt;&#65292;&#24212;&#35813;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locale/de/LC_MESSAGES/django.po&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn134&quot;&gt;&#20316;&#20026;&#40664;&#35748;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;makemessages&lt;/span&gt;&lt;/tt&gt; &#26816;&#27979;&#27599;&#19968;&#20010;&#26377;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.html&lt;/span&gt;&lt;/tt&gt; &#25193;&#23637;&#21517;&#30340;&#25991;&#20214;&#12290;&amp;nbsp; &#20197;&#22791;&#20320;&#35201;&#37325;&#36733;&#32570;&#30465;&#20540;&#65292;&#20351;&#29992;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;--extension&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;-e&lt;/span&gt;&lt;/tt&gt; &#36873;&#39033;&#25351;&#23450;&#25991;&#20214;&#25193;&#23637;&#21517;&#26469;&#26816;&#27979;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn136&quot;&gt;django-admin.py makemessages -l de -e txt
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn137&quot;&gt;&#29992;&#36887;&#21495;&#21644;&#65288;&#25110;&#65289;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;-e&lt;/span&gt;&lt;/tt&gt;&#25110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;--extension&lt;/span&gt;&lt;/tt&gt;&#26469;&#20998;&#38548;&#22810;&#39033;&#25193;&#23637;&#21517;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn139&quot;&gt;django-admin.py makemessages -l de -e html,txt -e xml
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn140&quot;&gt;&#24403;&#21019;&#24314;JavaScript&#32763;&#35793;&#30446;&#24405;&#26102;&#65292;&#20320;&#38656;&#35201;&#20351;&#29992;&#29305;&#27530;&#30340;Django&#22495;&#65306;&lt;strong&gt;not&lt;/strong&gt; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;js&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn141&quot;&gt;&#27809;&#26377;gettext?&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn142&quot;&gt;&#22914;&#26524;&#27809;&#26377;&#23433;&#35013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#32452;&#20214;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;make-messages.py&lt;/span&gt;&lt;/tt&gt; &#23558;&#20250;&#21019;&#24314;&#31354;&#30333;&#25991;&#20214;&#12290; &#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#23433;&#35013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#32452;&#20214;&#25110;&#21482;&#26159;&#22797;&#21046;&#33521;&#35821;&#20449;&#24687;&#25991;&#20214;( &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;conf/locale/en/LC_MESSAGES/django.po&lt;/span&gt;&lt;/tt&gt; )&#26469;&#20316;&#20026;&#19968;&#20010;&#36215;&#28857;&#65307;&#21482;&#26159;&#19968;&#20010;&#31354;&#30333;&#30340;&#32763;&#35793;&#20449;&#24687;&#25991;&#20214;&#32780;&#24050;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn143&quot;&gt;&#24037;&#20316;&#22312;Windows&#19978;&#20040;&#65311;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn144&quot;&gt;&#22914;&#26524;&#20320;&#27491;&#22312;&#20351;&#29992;Windows&#65292;&#19988;&#38656;&#35201;&#23433;&#35013;GNU gettext&#20849;&#29992;&#31243;&#24207;&#20197;&#20415;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;makemessages&lt;/span&gt;&lt;/tt&gt; &#21487;&#20197;&#24037;&#20316;&#65292;&#35831;&#21442;&#30475;&#19979;&#38754;Windows&#23567;&#33410;&#20013;gettext&#37096;&#20998;&#20197;&#33719;&#24471;&#26356;&#22810;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn145&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.po&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#26684;&#24335;&#24456;&#30452;&#35266;&#12290; &#27599;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.po&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#21253;&#21547;&#19968;&#23567;&#37096;&#20998;&#30340;&#20803;&#25968;&#25454;&#65292;&#27604;&#22914;&#32763;&#35793;&#32500;&#25252;&#20154;&#21592;&#30340;&#32852;&#31995;&#20449;&#24687;&#65292;&#32780;&#25991;&#20214;&#30340;&#22823;&#37096;&#20998;&#20869;&#23481;&#26159;&#31616;&#21333;&#30340;&#32763;&#35793;&#23383;&#31526;&#20018;&#21644;&#23545;&#24212;&#35821;&#35328;&#32763;&#35793;&#32467;&#26524;&#30340;&#26144;&#23556;&#20851;&#31995;&#30340;&#21015;&#34920;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn146&quot;&gt;&#20030;&#20010;&#20363;&#23376;&#65292;&#22914;&#26524;Django&#24212;&#29992;&#31243;&#24207;&#21253;&#25324;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;Welcome&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;site.&quot;&lt;/span&gt;&lt;/tt&gt; &#30340;&#24453;&#32763;&#35793;&#23383;&#31526;&#20018; &#65292;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn148&quot;&gt;_(&quot;Welcome to my site.&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn149&quot;&gt;&#21017;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;makemessages&lt;/span&gt;&lt;/tt&gt;&#23558;&#21019;&#24314;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.po&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#26469;&#21253;&#21547;&#20197;&#19979;&#29255;&#27573;&#30340;&#28040;&#24687;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn151&quot;&gt;#: path/to/python/module.py:23
msgid &quot;Welcome to my site.&quot;
msgstr &quot;&quot;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn152&quot;&gt;&#24555;&#36895;&#35299;&#37322;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn153&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn153&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;msgid&lt;/span&gt;&lt;/tt&gt; &#26159;&#22312;&#28304;&#25991;&#20214;&#20013;&#20986;&#29616;&#30340;&#32763;&#35793;&#23383;&#31526;&#20018;&#12290; &#19981;&#35201;&#20570;&#25913;&#21160;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn154&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn154&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;msgstr&lt;/span&gt;&lt;/tt&gt; &#26159;&#30456;&#24212;&#35821;&#35328;&#30340;&#32763;&#35793;&#32467;&#26524;&#12290; &#21018;&#21019;&#24314;&#26102;&#23427;&#21482;&#26159;&#31354;&#23383;&#31526;&#20018;&#65292;&#27492;&#26102;&#23601;&#38656;&#35201;&#20320;&#26469;&#23436;&#25104;&#23427;&#12290; &#27880;&#24847;&#19981;&#35201;&#20002;&#25481;&#35821;&#21477;&#21069;&#21518;&#30340;&#24341;&#21495;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn155&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn155&quot;&gt;&#20316;&#20026;&#26041;&#20415;&#20043;&#22788;&#65292;&#27599;&#19968;&#20010;&#28040;&#24687;&#37117;&#21253;&#25324;&#65306;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;#&lt;/span&gt;&lt;/tt&gt; &#20026;&#21069;&#32512;&#30340;&#19968;&#20010;&#27880;&#37322;&#34892;&#24182;&#19988;&#23450;&#20301;&#19978;&#36793;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;msgid&lt;/span&gt;&lt;/tt&gt; &#34892;&#65292;&#25991;&#20214;&#21517;&#21644;&#34892;&#21495;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn156&quot;&gt;&#23545;&#20110;&#27604;&#36739;&#38271;&#30340;&#20449;&#24687;&#20063;&#26377;&#20854;&#22788;&#29702;&#26041;&#27861;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;msgstr&lt;/span&gt;&lt;/tt&gt; &#65288;&#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;msgid&lt;/span&gt;&lt;/tt&gt; &#65289;&#21518;&#32039;&#36319;&#30528;&#30340;&#23383;&#31526;&#20018;&#20026;&#19968;&#20010;&#31354;&#23383;&#31526;&#20018;&#12290; &#28982;&#21518;&#30495;&#27491;&#30340;&#20869;&#23481;&#22312;&#20854;&#19979;&#38754;&#30340;&#20960;&#34892;&#12290; &#36825;&#20123;&#23383;&#31526;&#20018;&#20250;&#34987;&#30452;&#25509;&#36830;&#22312;&#19968;&#36215;&#12290; &#21516;&#26102;&#65292;&#19981;&#35201;&#24536;&#20102;&#23383;&#31526;&#20018;&#26411;&#23614;&#30340;&#31354;&#26684;&#65292;&#22240;&#20026;&#23427;&#20204;&#20250;&#19981;&#21152;&#31354;&#26684;&#22320;&#36830;&#21040;&#19968;&#36215;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn157&quot;&gt;&#33509;&#35201;&#23545;&#26032;&#21019;&#24314;&#30340;&#32763;&#35793;&#23383;&#31526;&#20018;&#26657;&#39564;&#25152;&#26377;&#30340;&#28304;&#20195;&#30721;&#21644;&#27169;&#26495;&#65292;&#24182;&#19988;&#26356;&#26032;&#25152;&#26377;&#35821;&#35328;&#30340;&#20449;&#24687;&#25991;&#20214;&#65292;&#21487;&#20197;&#36816;&#34892;&#20197;&#19979;&#21629;&#20196;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn159&quot;&gt;django-admin.py makemessages -a
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn160&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn160&quot;&gt;&#32534;&#35793;&#20449;&#24687;&#25991;&#20214;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn161&quot;&gt;&#21019;&#24314;&#20449;&#24687;&#25991;&#20214;&#20043;&#21518;&#65292;&#27599;&#27425;&#23545;&#20854;&#20570;&#20102;&#20462;&#25913;&#65292;&#37117;&#38656;&#35201;&#23558;&#23427;&#37325;&#26032;&#32534;&#35793;&#25104;&#19968;&#31181;&#26356;&#26377;&#25928;&#29575;&#30340;&#24418;&#24335;&#65292;&#20379; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#20351;&#29992;&#12290;&#21487;&#20197;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;compilemessages&lt;/span&gt;&lt;/tt&gt;&#23436;&#25104;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn162&quot;&gt;&#36825;&#20010;&#24037;&#20855;&#20316;&#29992;&#20110;&#25152;&#26377;&#26377;&#25928;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.po&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#65292;&#21019;&#24314;&#20248;&#21270;&#36807;&#30340;&#20108;&#36827;&#21046; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.mo&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#20379; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#20351;&#29992;&#12290;&#22312;&#20320;&#21487;&#20197;&#36816;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;makemessages&lt;/span&gt;&lt;/tt&gt;&#30340;&#30446;&#24405;&#19979;&#65292;&#36816;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;compilemessages&lt;/span&gt;&lt;/tt&gt;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn164&quot;&gt;django-admin.py compilemessages
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn165&quot;&gt;&#23601;&#26159;&#36825;&#26679;&#20102;&#12290; &#20320;&#30340;&#32763;&#35793;&#25104;&#26524;&#24050;&#32463;&#21487;&#20197;&#20351;&#29992;&#20102;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;django&quot;&gt;
&lt;span id=&quot;cn166&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn166&quot;&gt;Django&#22914;&#20309;&#22788;&#29702;&#35821;&#35328;&#20559;&#22909;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn167&quot;&gt;&#19968;&#26086;&#20320;&#20934;&#22791;&#22909;&#20102;&#32763;&#35793;&#65292;&#22914;&#26524;&#24076;&#26395;&#22312;Django&#20013;&#20351;&#29992;&#65292;&#37027;&#20040;&#21482;&#38656;&#35201;&#28608;&#27963;&#36825;&#20123;&#32763;&#35793;&#21363;&#21487;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn168&quot;&gt;&#22312;&#36825;&#20123;&#21151;&#33021;&#32972;&#21518;&#65292;Django&#25317;&#26377;&#19968;&#20010;&#28789;&#27963;&#30340;&#27169;&#22411;&#26469;&#30830;&#23450;&#22312;&#23433;&#35013;&#21644;&#20351;&#29992;&#24212;&#29992;&#31243;&#24207;&#30340;&#36807;&#31243;&#20013;&#36873;&#25321;&#20351;&#29992;&#30340;&#35821;&#35328;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn169&quot;&gt;&#35201;&#35774;&#23450;&#19968;&#20010;&#23433;&#35013;&#38454;&#27573;&#30340;&#35821;&#31181;&#20559;&#22909;&#65292;&#35831;&#35774;&#23450;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt;&#12290;&#22914;&#26524;&#20854;&#20182;&#32763;&#35793;&#22120;&#27809;&#26377;&#25214;&#21040;&#19968;&#20010;&#35793;&#25991;&#65292;Django&#23558;&#20351;&#29992;&#36825;&#20010;&#35821;&#31181;&#20316;&#20026;&#32570;&#30465;&#30340;&#32763;&#35793;&#26368;&#32456;&#23581;&#35797;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn170&quot;&gt;&#22914;&#26524;&#20320;&#21482;&#26159;&#24819;&#35201;&#29992;&#26412;&#22320;&#35821;&#35328;&#26469;&#36816;&#34892;Django&#65292;&#24182;&#19988;&#35813;&#35821;&#35328;&#30340;&#35821;&#35328;&#25991;&#20214;&#23384;&#22312;&#65292;&#21482;&#38656;&#35201;&#31616;&#21333;&#22320;&#35774;&#32622; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt; &#21363;&#21487;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn171&quot;&gt;&#22914;&#26524;&#35201;&#35753;&#27599;&#19968;&#20010;&#20351;&#29992;&#32773;&#21508;&#33258;&#25351;&#23450;&#35821;&#35328;&#20559;&#22909;&#65292;&#23601;&#38656;&#35201;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocaleMiddleware&lt;/span&gt;&lt;/tt&gt; &#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocaleMiddleware&lt;/span&gt;&lt;/tt&gt; &#20351;&#24471;Django&#22522;&#20110;&#35831;&#27714;&#30340;&#25968;&#25454;&#36827;&#34892;&#35821;&#35328;&#36873;&#25321;&#65292;&#20174;&#32780;&#20026;&#27599;&#19968;&#20301;&#29992;&#25143;&#23450;&#21046;&#20869;&#23481;&#12290; &#23427;&#20026;&#27599;&#19968;&#20010;&#29992;&#25143;&#23450;&#21046;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn172&quot;&gt;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocaleMiddleware&lt;/span&gt;&lt;/tt&gt; &#38656;&#35201;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLEWARE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#22686;&#21152; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&apos;django.middleware.locale.LocaleMiddleware&apos;&lt;/span&gt;&lt;/tt&gt; &#12290; &#20013;&#38388;&#20214;&#30340;&#39034;&#24207;&#26159;&#26377;&#24433;&#21709;&#30340;&#65292;&#26368;&#22909;&#25353;&#29031;&#20381;&#29031;&#20197;&#19979;&#35201;&#27714;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn173&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn173&quot;&gt;&#20445;&#35777;&#23427;&#26159;&#31532;&#19968;&#25209;&#23433;&#35013;&#30340;&#20013;&#38388;&#20214;&#31867;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn174&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn174&quot;&gt;&#22240;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocalMiddleware&lt;/span&gt;&lt;/tt&gt; &#35201;&#29992;&#21040;session&#25968;&#25454;&#65292;&#25152;&#20197;&#38656;&#35201;&#25918;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SessionMiddleware&lt;/span&gt;&lt;/tt&gt; &#20043;&#21518;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn175&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn175&quot;&gt;&#22914;&#26524;&#20320;&#20351;&#29992;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;CacheMiddleware&lt;/span&gt;&lt;/tt&gt;,&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocaleMiddleware&lt;/span&gt;&lt;/tt&gt;&#25918;&#22312;&#23427;&#21518;&#38754;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn176&quot;&gt;&#20363;&#22914;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;MIDDLE_CLASSES&lt;/span&gt;&lt;/tt&gt; &#21487;&#33021;&#20250;&#26159;&#22914;&#27492;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn178&quot;&gt;MIDDLEWARE_CLASSES = (
   &apos;django.contrib.sessions.middleware.SessionMiddleware&apos;,
   &apos;django.middleware.locale.LocaleMiddleware&apos;,
   &apos;django.middleware.common.CommonMiddleware&apos;,
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn179&quot;&gt;&#65288;&#26356;&#22810;&#20851;&#20110;&#20013;&#38388;&#20214;&#30340;&#20869;&#23481;&#65292;&#35831;&#21442;&#38405;&#31532;17&#31456;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn180&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocaleMiddleware&lt;/span&gt;&lt;/tt&gt; &#25353;&#29031;&#22914;&#19979;&#31639;&#27861;&#30830;&#23450;&#29992;&#25143;&#30340;&#35821;&#35328;:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn181&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn181&quot;&gt;&#39318;&#20808;&#65292;&#22312;&#24403;&#21069;&#29992;&#25143;&#30340; session &#30340;&#20013;&#26597;&#25214;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django_language&lt;/span&gt;&lt;/tt&gt;&#38190;&#65307;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn182&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn182&quot;&gt;&#22914;&#26410;&#25214;&#21040;&#65292;&#23427;&#20250;&#25214;&#23547;&#19968;&#20010;cookie&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn183&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn183&quot;&gt;&#36824;&#25214;&#19981;&#21040;&#30340;&#35805;&#65292;&#23427;&#20250;&#22312; HTTP &#35831;&#27714;&#22836;&#37096;&#37324;&#26597;&#25214;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Accept-Language&lt;/span&gt;&lt;/tt&gt;&#65292; &#35813;&#22836;&#37096;&#26159;&#20320;&#30340;&#27983;&#35272;&#22120;&#21457;&#36865;&#30340;&#65292;&#24182;&#19988;&#25353;&#20248;&#20808;&#39034;&#24207;&#21578;&#35785;&#26381;&#21153;&#22120;&#20320;&#30340;&#35821;&#35328;&#20559;&#22909;&#12290; Django&#20250;&#23581;&#35797;&#22836;&#37096;&#20013;&#30340;&#27599;&#19968;&#20010;&#35821;&#31181;&#30452;&#21040;&#23427;&#21457;&#29616;&#19968;&#20010;&#21487;&#29992;&#30340;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn184&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn184&quot;&gt;&#20197;&#19978;&#37117;&#22833;&#36133;&#20102;&#30340;&#35805;, &#23601;&#20351;&#29992;&#20840;&#23616;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt; &#35774;&#23450;&#20540;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn185&quot;&gt;&#22791;&#27880;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn186&quot;&gt;&#22312;&#19978;&#36848;&#27599;&#19968;&#22788;&#65292;&#35821;&#31181;&#20559;&#22909;&#24212;&#20316;&#20026;&#23383;&#31526;&#20018;&#65292;&#20197;&#26631;&#20934;&#30340;&#35821;&#31181;&#26684;&#24335;&#20986;&#29616;&#12290; &#20363;&#22914;&#65292;&#24052;&#35199;&#33889;&#33796;&#29273;&#35821;&#26159;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;pt-br&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn187&quot;&gt;&#22914;&#26524;&#19968;&#20010;&#22522;&#26412;&#35821;&#31181;&#23384;&#22312;&#32780;&#20122;&#35821;&#31181;&#27809;&#26377;&#25351;&#23450;&#65292;Django&#23558;&#20351;&#29992;&#22522;&#26412;&#35821;&#31181;&#12290; &#27604;&#22914;&#65292;&#22914;&#26524;&#29992;&#25143;&#25351;&#23450;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;de-at&lt;/span&gt;&lt;/tt&gt; &#65288;&#28595;&#24335;&#24503;&#35821;&#65289;&#20294;Django&#21482;&#26377;&#38024;&#23545; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;de&lt;/span&gt;&lt;/tt&gt; &#30340;&#32763;&#35793;&#65292;&#37027;&#20040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;de&lt;/span&gt;&lt;/tt&gt; &#20250;&#34987;&#36873;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn188&quot;&gt;&#21482;&#26377;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGES&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#21015;&#20986;&#30340;&#35821;&#35328;&#25165;&#33021;&#34987;&#36873;&#29992;&#12290; &#33509;&#24076;&#26395;&#23558;&#35821;&#35328;&#38480;&#21046;&#20026;&#25152;&#25552;&#20379;&#35821;&#35328;&#20013;&#30340;&#26576;&#20123;&#65288;&#22240;&#20026;&#24212;&#29992;&#31243;&#24207;&#24182;&#19981;&#25552;&#20379;&#25152;&#26377;&#35821;&#35328;&#30340;&#34920;&#31034;&#65289;&#65292;&#21017;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGES&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026;&#25152;&#24076;&#26395;&#25552;&#20379;&#35821;&#35328;&#30340;&#21015;&#34920;&#65292;&#20363;&#22914;&#65306; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn190&quot;&gt;LANGUAGES = (
  (&apos;de&apos;, _(&apos;German&apos;)),
  (&apos;en&apos;, _(&apos;English&apos;)),
)
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn191&quot;&gt;&#19978;&#38754;&#36825;&#20010;&#20363;&#23376;&#38480;&#21046;&#20102;&#35821;&#35328;&#20559;&#22909;&#21482;&#33021;&#26159;&#24503;&#35821;&#21644;&#33521;&#35821;&#65288;&#21253;&#25324;&#23427;&#20204;&#30340;&#23376;&#35821;&#35328;&#65292;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;de-ch&lt;/span&gt;&lt;/tt&gt; &#21644; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;en-us&lt;/span&gt;&lt;/tt&gt; &#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn192&quot;&gt;&#22914;&#26524;&#33258;&#23450;&#20041;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGES&lt;/span&gt;&lt;/tt&gt; &#65292;&#23558;&#35821;&#35328;&#26631;&#35760;&#20026;&#32763;&#35793;&#23383;&#31526;&#20018;&#26159;&#21487;&#20197;&#30340;&#65292;&#20294;&#26159;&#65292;&#35831;&#19981;&#35201;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.translation&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext()&lt;/span&gt;&lt;/tt&gt; &#65288;&#20915;&#19981;&#35201;&#22312;settings&#25991;&#20214;&#20013;&#23548;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.utils.translation&lt;/span&gt;&lt;/tt&gt; &#65292;&#22240;&#20026;&#36825;&#20010;&#27169;&#22359;&#26412;&#36523;&#26159;&#20381;&#36182;&#20110;settings&#65292;&#36825;&#26679;&#20570;&#20250;&#23548;&#33268;&#26080;&#38480;&#24490;&#29615;&#65289;&#65292;&#32780;&#26159;&#20351;&#29992;&#19968;&#20010;&#8220;&#34394;&#26500;&#30340;&#8221; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext()&lt;/span&gt;&lt;/tt&gt; &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn193&quot;&gt;&#35299;&#20915;&#26041;&#26696;&#23601;&#26159;&#20351;&#29992;&#19968;&#20010;&#8220;&#34394;&#20551;&#30340;&#8221; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext()&lt;/span&gt;&lt;/tt&gt; &#12290;&#20197; &#19979;&#26159;&#19968;&#20010;settings&#25991;&#20214;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn195&quot;&gt;ugettext = lambda s: s

LANGUAGES = (
    (&apos;de&apos;, ugettext(&apos;German&apos;)),
    (&apos;en&apos;, ugettext(&apos;English&apos;)),
)
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn196&quot;&gt;&#36825;&#26679;&#20570;&#30340;&#35805;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;make-messages.py&lt;/span&gt;&lt;/tt&gt; &#20173;&#20250;&#23547;&#25214;&#24182;&#26631;&#35760;&#20986;&#23558;&#35201;&#34987;&#32763;&#35793;&#30340;&#36825;&#20123;&#23383;&#31526;&#20018;&#65292;&#20294;&#32763;&#35793;&#19981;&#20250;&#22312;&#36816;&#34892;&#26102;&#36827;&#34892;&#65292;&#25925;&#32780;&#38656;&#35201;&#22312;&#20219;&#20309;&#20351;&#29992; &lt;em&gt;LANGUAGES&lt;/em&gt; &#30340;&#20195;&#30721;&#20013;&#29992;&#8220;&#30495;&#23454;&#30340;&#8221;
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ugettext()&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn197&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocaleMiddleware&lt;/span&gt;&lt;/tt&gt; &#21482;&#33021;&#36873;&#25321;&#37027;&#20123;Django&#24050;&#32463;&#25552;&#20379;&#20102;&#22522;&#30784;&#32763;&#35793;&#30340;&#35821;&#35328;&#12290; &#22914;&#26524;&#24819;&#35201;&#22312;&#24212;&#29992;&#31243;&#24207;&#20013;&#23545;Django&#20013;&#36824;&#27809;&#26377;&#22522;&#30784;&#32763;&#35793;&#30340;&#35821;&#35328;&#25552;&#20379;&#32763;&#35793;&#65292;&#37027;&#20040;&#24517;&#39035;&#33267;&#23569;&#20808;&#25552;&#20379;&#35813;&#35821;&#35328;&#30340;&#22522;&#26412;&#30340;&#32763;&#35793;&#12290; &#20363;&#22914;&#65292;Django&#20351;&#29992;&#29305;&#23450;&#30340;&#20449;&#24687;ID&#26469;&#32763;&#35793;&#26085;&#26399;&#21644;&#26102;&#38388;&#26684;&#24335;&#65292;&#25925;&#35201;&#35753;&#31995;&#32479;&#27491;&#24120;&#24037;&#20316;&#65292;&#33267;&#23569;&#35201;&#25552;&#20379;&#36825;&#20123;&#22522;&#26412;&#30340;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn198&quot;&gt;&#20197;&#33521;&#35821;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.po&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#20026;&#22522;&#30784;&#65292;&#32763;&#35793;&#20854;&#20013;&#30340;&#25216;&#26415;&#30456;&#20851;&#30340;&#20449;&#24687;&#65292;&#21487;&#33021;&#36824;&#21253;&#25324;&#19968;&#20123;&#20351;&#20043;&#29983;&#25928;&#30340;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn199&quot;&gt;&#25216;&#26415;&#30456;&#20851;&#30340;&#20449;&#24687;ID&#24456;&#23481;&#26131;&#34987;&#35748;&#20986;&#26469;&#65306;&#23427;&#20204;&#37117;&#26159;&#22823;&#20889;&#30340;&#12290; &#36825;&#20123;&#20449;&#24687;ID&#30340;&#32763;&#35793;&#19982;&#20854;&#20182;&#20449;&#24687;&#19981;&#21516;:&#20320;&#38656;&#35201;&#25552;&#20379;&#20854;&#23545;&#24212;&#30340;&#26412;&#22320;&#21270;&#20869;&#23481;&#12290; &#20363;&#22914;&#65292;&#23545;&#20110; DATETIME_FORMAT &#65288;&#25110; DATE_FORMAT &#12289; TIME_FORMAT &#65289;&#65292;&#24212;&#35813;&#25552;&#20379;&#24076;&#26395;&#22312;&#35813;&#35821;&#35328;&#20013;&#20351;&#29992;&#30340;&#26684;&#24335;&#21270;&#23383;&#31526;&#20018;&#12290; &#26684;&#24335;&#34987;&#27169;&#26495;&#26631;&#31614;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;now&lt;/span&gt;&lt;/tt&gt;&#29992;&#26469;&#35782;&#21035;&#26684;&#24335;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn200&quot;&gt;&#19968;&#26086;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocaleMiddleware&lt;/span&gt;&lt;/tt&gt;&#20915;&#23450;&#29992;&#25143;&#30340;&#20559;&#22909;&#65292;&#23427;&#20250;&#35753;&#36825;&#20010;&#20559;&#22909;&#20316;&#20026;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt;&#23545;&#27599;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;HttpRequest&lt;/span&gt;&lt;/tt&gt;&#26377;&#25928;&#12290;&#35831;&#38543;&#24847;&#22312;&#20320;&#30340;&#35270;&#22270;&#20195;&#30721;&#20013;&#35835;&#19968;&#35835;&#36825;&#20010;&#20540;&#12290; &#20197;&#19979;&#26159;&#19968;&#20010;&#31616;&#21333;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn202&quot;&gt;def hello_world(request):
    if request.LANGUAGE_CODE == &apos;de-at&apos;:
        return HttpResponse(&quot;You prefer to read Austrian German.&quot;)
    else:
        return HttpResponse(&quot;You prefer to read another language.&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn203&quot;&gt;&#27880;&#24847;&#65292;&#23545;&#20110;&#38745;&#24577;&#32763;&#35793;&#65288;&#26080;&#20013;&#38388;&#20214;&#65289;&#32780;&#35328;&#65292;&#27492;&#35821;&#35328;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;settings.LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt;&#20013;&#65292;&#32780;&#23545;&#20110;&#21160;&#24577;&#32763;&#35793;&#65288;&#20013;&#38388;&#20214;&#65289;&#65292;&#23427;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.LANGUAGE_CODE&lt;/span&gt;&lt;/tt&gt;&#20013;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn204&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn204&quot;&gt;&#22312;&#20320;&#33258;&#24049;&#30340;&#39033;&#30446;&#20013;&#20351;&#29992;&#32763;&#35793;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn205&quot;&gt;Django&#20351;&#29992;&#20197;&#19979;&#31639;&#27861;&#23547;&#25214;&#32763;&#35793;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn206&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn206&quot;&gt;&#39318;&#20808;&#65292;Django&#22312;&#35813;&#35270;&#22270;&#25152;&#22312;&#30340;&#24212;&#29992;&#31243;&#24207;&#25991;&#20214;&#22841;&#20013;&#23547;&#25214; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locale&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#12290; &#33509;&#25214;&#21040;&#25152;&#36873;&#35821;&#35328;&#30340;&#32763;&#35793;&#65292;&#21017;&#21152;&#36733;&#35813;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn207&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn207&quot;&gt;&#31532;&#20108;&#27493;&#65292;Django&#22312;&#39033;&#30446;&#30446;&#24405;&#20013;&#23547;&#25214; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locale&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#12290; &#33509;&#25214;&#21040;&#32763;&#35793;&#65292;&#21017;&#21152;&#36733;&#35813;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn208&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn208&quot;&gt;&#26368;&#21518;&#65292;Django&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django/conf/locale&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#20013;&#30340;&#22522;&#26412;&#32763;&#35793;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn209&quot;&gt;&#20197;&#36825;&#31181;&#26041;&#24335;&#65292;&#20320;&#21487;&#20197;&#21019;&#24314;&#21253;&#21547;&#29420;&#31435;&#32763;&#35793;&#30340;&#24212;&#29992;&#31243;&#24207;&#65292;&#21487;&#20197;&#35206;&#30422;&#39033;&#30446;&#20013;&#30340;&#22522;&#26412;&#32763;&#35793;&#12290; &#25110;&#32773;&#65292;&#20320;&#21487;&#20197;&#21019;&#24314;&#19968;&#20010;&#21253;&#21547;&#20960;&#20010;&#24212;&#29992;&#31243;&#24207;&#30340;&#22823;&#39033;&#30446;&#65292;&#24182;&#23558;&#25152;&#26377;&#38656;&#35201;&#30340;&#32763;&#35793;&#25918;&#22312;&#19968;&#20010;&#22823;&#30340;&#39033;&#30446;&#20449;&#24687;&#25991;&#20214;&#20013;&#12290; &#20915;&#23450;&#26435;&#22312;&#20320;&#25163;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn210&quot;&gt;&#25152;&#26377;&#30340;&#20449;&#24687;&#25991;&#20214;&#24211;&#37117;&#26159;&#20197;&#21516;&#26679;&#26041;&#24335;&#32452;&#32455;&#30340;&#65306; &#23427;&#20204;&#26159;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn211&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn211&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;$APPPATH/locale/&amp;lt;language&amp;gt;/LC_MESSAGES/django.(po|mo)&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn212&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn212&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;$PROJECTPATH/locale/&amp;lt;language&amp;gt;/LC_MESSAGES/django.(po|mo)&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn213&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn213&quot;&gt;&#25152;&#26377;&#22312;settings&#25991;&#20214;&#20013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LOCALE_PATHS&lt;/span&gt;&lt;/tt&gt; &#20013;&#21015;&#20986;&#30340;&#36335;&#24452;&#20197;&#20854;&#21015;&#20986;&#30340;&#39034;&#24207;&#25628;&#32034; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;language&amp;gt;/LC_MESSAGES/django.(po|mo)&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn214&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn214&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;$PYTHONPATH/django/conf/locale/&amp;lt;language&amp;gt;/LC_MESSAGES/django.(po|mo)&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn215&quot;&gt;&#35201;&#21019;&#24314;&#20449;&#24687;&#25991;&#20214;&#65292;&#20063;&#26159;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;makemessages.py&lt;/span&gt;&lt;/tt&gt; &#24037;&#20855;&#65292;&#21644;Django&#20449;&#24687;&#25991;&#20214;&#19968;&#26679;&#12290; &#38656;&#35201;&#20570;&#30340;&#23601;&#26159;&#36827;&#20837;&#27491;&#30830;&#30340;&#30446;&#24405;&#8212;&#8212; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;conf/locale&lt;/span&gt;&lt;/tt&gt; &#65288;&#22312;&#28304;&#30721;&#26641;&#30340;&#24773;&#20917;&#19979;&#65289;&#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locale/&lt;/span&gt;&lt;/tt&gt; &#65288;&#22312;&#24212;&#29992;&#31243;&#24207;&#20449;&#24687;&#25110;&#39033;&#30446;&#20449;&#24687;&#30340;&#24773;&#20917;&#19979;&#65289;&#25152;&#22312;&#30340;&#30446;&#24405;&#19979;&#12290; &#21516;&#26679;&#22320;&#65292;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;compile-messages.py&lt;/span&gt;&lt;/tt&gt; &#29983;&#25104; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#38656;&#35201;&#20351;&#29992;&#30340;&#20108;&#36827;&#21046; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.mo&lt;/span&gt;&lt;/tt&gt; &#25991;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn216&quot;&gt;&#24744;&#20134;&#21487;&#36816;&#34892;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django-admin.py&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;compilemessages&lt;/span&gt;
&lt;span class=&quot;pre&quot;&gt;--settings=path.to.settings&lt;/span&gt;&lt;/tt&gt; &#26469;&#20351;&#32534;&#35793;&#22120;&#22788;&#29702;&#25152;&#26377;&#23384;&#22312;&#20110;&#24744; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LOCALE_PATHS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#30340;&#30446;&#24405;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn217&quot;&gt;&#24212;&#29992;&#31243;&#24207;&#20449;&#24687;&#25991;&#20214;&#31245;&#24494;&#38590;&#20197;&#21457;&#29616;&#8212;&#8212;&#22240;&#20026;&#23427;&#20204;&#38656;&#35201; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LocaleMiddle&lt;/span&gt;&lt;/tt&gt; &#12290;&#22914;&#26524;&#19981;&#20351;&#29992;&#20013;&#38388;&#20214;&#65292;Django&#21482;&#20250;&#22788;&#29702;Django&#30340;&#20449;&#24687;&#25991;&#20214;&#21644;&#39033;&#30446;&#30340;&#20449;&#24687;&#25991;&#20214;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn218&quot;&gt;&#26368;&#21518;&#65292;&#38656;&#35201;&#32771;&#34385;&#19968;&#19979;&#32763;&#35793;&#25991;&#20214;&#30340;&#32467;&#26500;&#12290; &#33509;&#24212;&#29992;&#31243;&#24207;&#35201;&#21457;&#25918;&#32473;&#20854;&#20182;&#29992;&#25143;&#65292;&#24212;&#29992;&#21040;&#20854;&#23427;&#39033;&#30446;&#20013;&#65292;&#21487;&#33021;&#38656;&#35201;&#20351;&#29992;&#24212;&#29992;&#31243;&#24207;&#30456;&#20851;&#30340;&#32763;&#35793;&#12290; &#20294;&#26159;&#65292;&#20351;&#29992;&#24212;&#29992;&#31243;&#24207;&#30456;&#20851;&#30340;&#32763;&#35793;&#21644;&#39033;&#30446;&#32763;&#35793;&#22312;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;make-messages&lt;/span&gt;&lt;/tt&gt; &#26102;&#20250;&#20135;&#29983;&#21476;&#24618;&#30340;&#38382;&#39064;&#12290;&#23427;&#20250;&#36941;&#21382;&#24403;&#21069;&#36335;&#24452;&#19979;&#25152;&#26377;&#30340;&#25991;&#20214;&#22841;&#65292;&#36825;&#26679;&#21487;&#33021;&#20250;&#25226;&#24212;&#29992;&#28040;&#24687;&#25991;&#20214;&#37324;&#23384;&#22312;&#30340;&#28040;&#24687;ID&#37325;&#22797;&#25918;&#20837;&#39033;&#30446;&#28040;&#24687;&#25991;&#20214;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn219&quot;&gt;&#26368;&#23481;&#26131;&#30340;&#35299;&#20915;&#26041;&#27861;&#23601;&#26159;&#23558;&#19981;&#23646;&#20110;&#39033;&#30446;&#30340;&#24212;&#29992;&#31243;&#24207;&#65288;&#22240;&#27492;&#38468;&#24102;&#30528;&#26412;&#36523;&#30340;&#32763;&#35793;&#65289;&#23384;&#20648;&#22312;&#39033;&#30446;&#26641;&#20043;&#22806;&#12290; &#36825;&#26679;&#20570;&#30340;&#35805;&#65292;&#39033;&#30446;&#32423;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;make-messages&lt;/span&gt;&lt;/tt&gt; &#23558;&#21482;&#20250;&#32763;&#35793;&#19982;&#39033;&#30446;&#31934;&#30830;&#30456;&#20851;&#30340;&#65292;&#32780;&#19981;&#21253;&#25324;&#37027;&#20123;&#29420;&#31435;&#21457;&#24067;&#30340;&#24212;&#29992;&#31243;&#24207;&#20013;&#30340;&#23383;&#31526;&#20018;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;set-language&quot;&gt;
&lt;span id=&quot;cn220&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn220&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;set_language&lt;/span&gt;&lt;/tt&gt; &#37325;&#23450;&#21521;&#35270;&#22270;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn221&quot;&gt;&#26041;&#20415;&#36215;&#35265;&#65292;Django&#33258;&#24102;&#20102;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.views.i18n.set_language&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#65292;&#20316;&#29992;&#26159;&#35774;&#32622;&#29992;&#25143;&#35821;&#35328;&#20559;&#22909;&#24182;&#37325;&#23450;&#21521;&#36820;&#22238;&#21040;&#21069;&#19968;&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn222&quot;&gt;&#22312;URLconf&#20013;&#21152;&#20837;&#19979;&#38754;&#36825;&#34892;&#20195;&#30721;&#26469;&#28608;&#27963;&#36825;&#20010;&#35270;&#22270;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn224&quot;&gt;(r&apos;^i18n/&apos;, include(&apos;django.conf.urls.i18n&apos;)),
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn225&quot;&gt;&#65288;&#27880;&#24847;&#36825;&#20010;&#20363;&#23376;&#20351;&#24471;&#36825;&#20010;&#35270;&#22270;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/i18n/setlang/&lt;/span&gt;&lt;/tt&gt; &#20013;&#26377;&#25928;&#12290;&#65289;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn226&quot;&gt;&#36825;&#20010;&#35270;&#22270;&#26159;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#35843;&#29992;&#30340;&#65292;&#22312;&#35831;&#27714;&#20013;&#21253;&#21547;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;language&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#12290; &#22914;&#26524;session&#24050;&#21551;&#29992;&#65292;&#36825;&#20010;&#35270;&#22270;&#20250;&#23558;&#35821;&#35328;&#36873;&#25321;&#20445;&#23384;&#22312;&#29992;&#25143;&#30340;session&#20013;&#12290; &#21542;&#21017;&#65292;&#23427;&#20250;&#20197;&#32570;&#30465;&#21517;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django_language&lt;/span&gt;&lt;/tt&gt;&#22312;cookie&#20013;&#20445;&#23384;&#36825;&#20010;&#35821;&#35328;&#36873;&#25321;&#12290;(&#36825;&#20010;&#21517;&#23383;&#21487;&#20197;&#36890;&#36807;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LANGUAGE_COOKIE_NAME&lt;/span&gt;&lt;/tt&gt;&#35774;&#32622;&#26469;&#25913;&#21464;)&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn227&quot;&gt;&#20445;&#23384;&#20102;&#35821;&#35328;&#36873;&#25321;&#21518;&#65292;Django&#26681;&#25454;&#20197;&#19979;&#31639;&#27861;&#26469;&#37325;&#23450;&#21521;&#39029;&#38754;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn228&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn228&quot;&gt;Django &#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#25968;&#25454;&#20013;&#23547;&#25214;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#19979;&#19968;&#20010;&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn229&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn229&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;next&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#19981;&#23384;&#22312;&#25110;&#20026;&#31354;&#65292;Django&#23581;&#35797;&#37325;&#23450;&#21521;&#39029;&#38754;&#20026;HTML&#22836;&#37096;&#20449;&#24687;&#20013; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Referer&lt;/span&gt;&lt;/tt&gt; &#30340;&#20540;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn230&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn230&quot;&gt;&#22914;&#26524; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Referer&lt;/span&gt;&lt;/tt&gt; &#20063;&#26159;&#31354;&#30340;&#65292;&#21363;&#35813;&#29992;&#25143;&#30340;&#27983;&#35272;&#22120;&#24182;&#19981;&#21457;&#36865; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Referer&lt;/span&gt;&lt;/tt&gt; &#22836;&#20449;&#24687;&#65292;&#21017;&#39029;&#38754;&#23558;&#37325;&#23450;&#21521;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/&lt;/span&gt;&lt;/tt&gt; &#65288;&#39029;&#38754;&#26681;&#30446;&#24405;&#65289;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn231&quot;&gt;&#36825;&#26159;&#19968;&#20010;HTML&#27169;&#26495;&#20195;&#30721;&#30340;&#20363;&#23376;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn233&quot;&gt;&amp;lt;form action=&quot;/i18n/setlang/&quot; method=&quot;post&quot;&amp;gt;
&amp;lt;input name=&quot;next&quot; type=&quot;hidden&quot; value=&quot;/next/page/&quot; /&amp;gt;
&amp;lt;select name=&quot;language&quot;&amp;gt;
    {% for lang in LANGUAGES %}
    &amp;lt;option value=&quot;{{ lang.0 }}&quot;&amp;gt;{{ lang.1 }}&amp;lt;/option&amp;gt;
    {% endfor %}
&amp;lt;/select&amp;gt;
&amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot; /&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;javascript&quot;&gt;
&lt;span id=&quot;cn234&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn234&quot;&gt;&#32763;&#35793;&#19982;JavaScript&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn235&quot;&gt;&#23558;&#32763;&#35793;&#28155;&#21152;&#21040;JavaScript&#20250;&#24341;&#36215;&#19968;&#20123;&#38382;&#39064;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn236&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn236&quot;&gt;JavaScript&#20195;&#30721;&#26080;&#27861;&#35775;&#38382;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#30340;&#23454;&#29616;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn237&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn237&quot;&gt;JavaScript &#20195;&#30721;&#24182;&#19981;&#35775;&#38382; .po&#25110; .mo &#25991;&#20214;&#65307;&#23427;&#20204;&#38656;&#35201;&#30001;&#26381;&#21153;&#22120;&#20998;&#21457;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn238&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn238&quot;&gt;&#38024;&#23545;JavaScript&#30340;&#32763;&#35793;&#30446;&#24405;&#24212;&#23613;&#37327;&#23567;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn239&quot;&gt;Django&#24050;&#32463;&#25552;&#20379;&#20102;&#19968;&#20010;&#38598;&#25104;&#35299;&#20915;&#26041;&#26696;&#65306; &#23427;&#20250;&#23558;&#32763;&#35793;&#20256;&#36882;&#32473;JavaScript&#65292;&#22240;&#27492;&#23601;&#21487;&#20197;&#22312;JavaScript&#20013;&#35843;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#20043;&#31867;&#30340;&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;javascript-catalog&quot;&gt;
&lt;span id=&quot;cn240&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn240&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;javascript_catalog&lt;/span&gt;&lt;/tt&gt;&#35270;&#22270;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn241&quot;&gt;&#36825;&#20123;&#38382;&#39064;&#30340;&#20027;&#35201;&#35299;&#20915;&#26041;&#26696;&#23601;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;javascript_catalog&lt;/span&gt;&lt;/tt&gt; &#35270;&#22270;&#12290;&#35813;&#35270;&#22270;&#29983;&#25104;&#19968;&#20010;JavaScript&#20195;&#30721;&#24211;&#65292;&#21253;&#25324;&#27169;&#20223; gettext &#25509;&#21475;&#30340;&#20989;&#25968;&#65292;&#21644;&#32763;&#35793;&#23383;&#31526;&#20018;&#30340;&#25968;&#32452;&#12290; &#36825;&#20123;&#32763;&#35793;&#23383;&#31526;&#20018;&#26469;&#33258;&#20110;&#20320;&#22312;info_dict&#25110;URl&#20013;&#25351;&#23450;&#30340;&#24212;&#29992;&#65292;&#24037;&#31243;&#25110;Django&#20869;&#26680;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn242&quot;&gt;&#20687;&#36825;&#26679;&#20351;&#29992;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn244&quot;&gt;js_info_dict = {
    &apos;packages&apos;: (&apos;your.app.package&apos;,),
}

urlpatterns = patterns(&apos;&apos;,
    (r&apos;^jsi18n/$&apos;, &apos;django.views.i18n.javascript_catalog&apos;, js_info_dict),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn245&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;packages&lt;/span&gt;&lt;/tt&gt; &#37324;&#30340;&#27599;&#20010;&#23383;&#31526;&#20018;&#24212;&#35813;&#26159;Python&#20013;&#30340;&#28857;&#20998;&#21106;&#30340;&#21253;&#30340;&#34920;&#36798;&#24335;&#24418;&#24335;&#65288;&#21644;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340;&#23383;&#31526;&#20018;&#30456;&#21516;&#30340;&#26684;&#24335;&#65289;&#65292;&#32780;&#19988;&#24212;&#25351;&#21521;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;locale&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#30340;&#21253;&#12290; &#22914;&#26524;&#25351;&#23450;&#20102;&#22810;&#20010;&#21253;&#65292;&#25152;&#26377;&#30340;&#30446;&#24405;&#20250;&#21512;&#24182;&#25104;&#19968;&#20010;&#30446;&#24405;&#12290; &#22914;&#26524;&#26377;&#29992;&#21040;&#26469;&#33258;&#19981;&#21516;&#24212;&#29992;&#31243;&#24207;&#30340;&#23383;&#31526;&#20018;&#30340;JavaScript&#65292;&#36825;&#31181;&#26426;&#21046;&#20250;&#24456;&#26377;&#24110;&#21161;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn246&quot;&gt;&#20320;&#21487;&#20197;&#21160;&#24577;&#20351;&#29992;&#35270;&#22270;&#65292;&#23558;&#21253;&#25918;&#22312;urlpatterns&#37324;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn248&quot;&gt;urlpatterns = patterns(&apos;&apos;,
    (r&apos;^jsi18n/(?P&amp;lt;packages&amp;gt;\S+)/$&apos;, &apos;django.views.i18n.javascript_catalog&apos;),
)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn249&quot;&gt;&#36825;&#26679;&#30340;&#35805;&#65292;&#23601;&#21487;&#20197;&#22312;URL&#20013;&#25351;&#23450;&#30001;&#21152;&#21495;&#65288; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;+&lt;/span&gt;&lt;/tt&gt; &#65289;&#20998;&#38548;&#21253;&#21517;&#30340;&#21253;&#20102;&#12290; &#22914;&#26524;&#39029;&#38754;&#20351;&#29992;&#26469;&#33258;&#19981;&#21516;&#24212;&#29992;&#31243;&#24207;&#30340;&#20195;&#30721;&#65292;&#19988;&#32463;&#24120;&#25913;&#21464;&#65292;&#36824;&#19981;&#24819;&#23558;&#20854;&#25918;&#22312;&#19968;&#20010;&#22823;&#30340;&#30446;&#24405;&#25991;&#20214;&#20013;&#65292;&#23545;&#20110;&#36825;&#20123;&#24773;&#20917;&#65292;&#26174;&#28982;&#36825;&#26159;&#24456;&#26377;&#29992;&#30340;&#12290; &#20986;&#20110;&#23433;&#20840;&#32771;&#34385;&#65292;&#36825;&#20123;&#20540;&#21482;&#33021;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.conf&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;INSTALLED_APPS&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20013;&#30340;&#21253;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn250&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn250&quot;&gt;&#20351;&#29992;JavaScript&#32763;&#35793;&#30446;&#24405;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn251&quot;&gt;&#35201;&#20351;&#29992;&#36825;&#20010;&#30446;&#24405;&#65292;&#21482;&#35201;&#36825;&#26679;&#24341;&#20837;&#21160;&#24577;&#29983;&#25104;&#30340;&#33050;&#26412;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn253&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;/path/to/jsi18n/&quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn254&quot;&gt;&#36825;&#23601;&#26159;&#31649;&#29702;&#39029;&#38754;&#22914;&#20309;&#20174;&#26381;&#21153;&#22120;&#33719;&#21462;&#32763;&#35793;&#30446;&#24405;&#12290; &#24403;&#30446;&#24405;&#21152;&#36733;&#21518;&#65292;JavaScript&#20195;&#30721;&#23601;&#33021;&#36890;&#36807;&#26631;&#20934;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#25509;&#21475;&#36827;&#34892;&#35775;&#38382;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn256&quot;&gt;document.write(gettext(&apos;this is to be translated&apos;));
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn257&quot;&gt;&#20063;&#26377;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ngettext&lt;/span&gt;&lt;/tt&gt;&#25509;&#21475;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn259&quot;&gt;var object_cnt = 1 // or 0, or 2, or 3, ...
s = ngettext(&apos;literal for the singular case&apos;,
        &apos;literal for the plural case&apos;, object_cnt);
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn260&quot;&gt;&#29978;&#33267;&#26377;&#19968;&#20010;&#23383;&#31526;&#20018;&#25554;&#20837;&#20989;&#25968;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn262&quot;&gt;function interpolate(fmt, obj, named);
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn263&quot;&gt;&#25554;&#20837;&#21477;&#27861;&#26159;&#20174;Python&#20511;&#29992;&#30340;&#65292;&#25152;&#20197;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;interpolate&lt;/span&gt;&lt;/tt&gt;
&#20989;&#25968;&#23545;&#20301;&#32622;&#21644;&#21629;&#21517;&#25554;&#20837;&#22343;&#25552;&#20379;&#25903;&#25345;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn264&quot;&gt;&#20301;&#32622;&#25554;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;obj&lt;/span&gt;&lt;/tt&gt;&#21253;&#25324;&#19968;&#20010;JavaScript&#25968;&#32452;&#23545;&#35937;&#65292;&#20803;&#32032;&#20540;&#22312;&#23427;&#20204;&#23545;&#24212;&#20110;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;fmt&lt;/span&gt;&lt;/tt&gt;&#30340;&#21344;&#20301;&#31526;&#20013;&#20197;&#23427;&#20204;&#20986;&#29616;&#30340;&#30456;&#21516;&#27425;&#24207;&#39034;&#24207;&#25554;&#20540; &#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn266&quot;&gt;fmts = ngettext(&apos;There is %s object. Remaining: %s&apos;,
        &apos;There are %s objects. Remaining: %s&apos;, 11);
s = interpolate(fmts, [11, 20]);
// s is &apos;There are 11 objects. Remaining: 20&apos;
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn267&quot;&gt;&#21629;&#21517;&#25554;&#20837; &#36890;&#36807;&#20256;&#36865;&#20026;&#30495;&#65288;TRUE&#65289;&#30340;&#24067;&#23572;&#21442;&#25968;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;name&lt;/span&gt;&lt;/tt&gt;&#26469;&#36873;&#25321;&#36825;&#20010;&#27169;&#24335;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;obj&lt;/span&gt;&lt;/tt&gt;&#21253;&#25324;&#19968;&#20010; JavaScript &#23545;&#35937;&#25110;&#30456;&#20851;&#25968;&#32452;&#12290; &#20363;&#22914;&#65306;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn269&quot;&gt;d = {
    count: 10
    total: 50
};

fmts = ngettext(&apos;Total: %(total)s, there is %(count)s object&apos;,
&apos;there are %(count)s of a total of %(total)s objects&apos;, d.count);
s = interpolate(fmts, d, true);
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn270&quot;&gt;&#20294;&#26159;&#65292;&#20320;&#19981;&#24212;&#37325;&#22797;&#32534;&#20889;&#23383;&#31526;&#20018;&#25554;&#20540;&#65306; &#36825;&#36824;&#26159;JavaScript&#65292;&#25152;&#20197;&#36825;&#27573;&#20195;&#30721;&#19981;&#24471;&#19981;&#37325;&#22797;&#20570;&#27491;&#21017;&#34920;&#36798;&#24335;&#32622;&#25442;&#12290;
&#23427;&#19981;&#20250;&#21644;Python&#20013;&#30340;&#23383;&#31526;&#20018;&#25554;&#34917;&#19968;&#26679;&#24555;&#65292;&#22240;&#27492;&#21482;&#26377;&#30495;&#27491;&#38656;&#35201;&#30340;&#26102;&#20505;&#20877;&#20351;&#29992;&#23427;&#65288;&#20363;&#22914;&#65292;&#21033;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ngettext&lt;/span&gt;&lt;/tt&gt; &#29983;&#25104;&#21512;&#36866;&#30340;&#22797;&#25968;&#24418;&#24335;&#65289;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn271&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn271&quot;&gt;&#21019;&#24314;JavaScript&#32763;&#35793;&#30446;&#24405;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn272&quot;&gt;&#20320;&#21487;&#20197;&#21019;&#24314;&#21644;&#26356;&#25913;&#32763;&#35793;&#30446;&#24405;&#65292;&#23601;&#20687;&#20854;&#20182;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn273&quot;&gt;Django&#32763;&#35793;&#30446;&#24405;&#19968;&#26679;&#65292;&#20351;&#29992;django-admin.py makemessages  &#24037;&#20855;&#12290; &#21807;&#19968;&#30340;&#24046;&#21035;&#26159;&#38656;&#35201;&#25552;&#20379;&#19968;&#20010; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;djangojs&lt;/span&gt;&lt;/tt&gt; &#30340;&#21442;&#25968;&#65292;&#23601;&#20687;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn275&quot;&gt;django-admin.py makemessages -d djangojs -l de
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn276&quot;&gt;&#36825;&#26679;&#26469;&#21019;&#24314;&#25110;&#26356;&#26032;JavaScript&#30340;&#24503;&#35821;&#32763;&#35793;&#30446;&#24405;&#12290;
&#21644;&#26222;&#36890;&#30340;Django&#32763;&#35793;&#30446;&#24405;&#19968;&#26679;&#65292;&#26356;&#26032;&#20102;&#32763;&#35793;&#30446;&#24405;&#21518;&#65292;&#36816;&#34892; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;compile-messages.py&lt;/span&gt;&lt;/tt&gt; &#21363;&#21487;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;gettext&quot;&gt;
&lt;span id=&quot;cn277&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn277&quot;&gt;&#29087;&#24713; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#29992;&#25143;&#30340;&#27880;&#24847;&#20107;&#39033;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn278&quot;&gt;&#22914;&#26524;&#20320;&#20102;&#35299; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt; &#65292;&#20320;&#21487;&#33021;&#20250;&#21457;&#29616;Django&#36827;&#34892;&#32763;&#35793;&#26102;&#30340;&#19968;&#20123;&#29305;&#27530;&#30340;&#19996;&#35199;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn279&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn279&quot;&gt;&#23383;&#31526;&#20018;&#22495;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django&lt;/span&gt;&lt;/tt&gt; &#25110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;djangojs&lt;/span&gt;&lt;/tt&gt; &#12290;&#23383;&#31526;&#20018;&#22495;&#26159;&#29992;&#26469;&#21306;&#21035;&#23558;&#25968;&#25454;&#23384;&#20648;&#22312;&#21516;&#19968;&#20449;&#24687;&#25991;&#20214;&#24211;&#65288;&#19968;&#33324;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/usr/share/locale/&lt;/span&gt;&lt;/tt&gt; &#65289;&#30340;&#19981;&#21516;&#31243;&#24207;&#12290;django &#22495;&#26159;&#20026;Python&#21644;&#27169;&#26495;&#32763;&#35793;&#23383;&#31526;&#20018;&#26381;&#21153;&#30340;&#65292;&#34987;&#21152;&#36733;&#21040;&#20840;&#23616;&#32763;&#35793;&#30446;&#24405;&#12290; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;djangojs&lt;/span&gt;&lt;/tt&gt; &#22495;&#21482;&#26159;&#29992;&#26469;&#23613;&#21487;&#33021;&#32553;&#23567;JavaScript&#32763;&#35793;&#30340;&#20307;&#31215;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn280&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn280&quot;&gt;Django&#19981;&#21333;&#29420;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;xgettext&lt;/span&gt;&lt;/tt&gt; &#65292; &#32780;&#26159;&#32463;&#36807;Python&#21253;&#35013;&#21518;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;xgettext&lt;/span&gt;&lt;/tt&gt;&#21644;msgfmt&#12290;&#36825;&#20027;&#35201;&#26159;&#20026;&#20102;&#26041;&#20415;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;windows-gettext&quot;&gt;
&lt;span id=&quot;cn281&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn281&quot;&gt;Windows&#19979;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn282&quot;&gt;&#23545;&#20110;&#37027;&#20123;&#35201;&#25552;&#21462;&#28040;&#24687;&#25110;&#32534;&#35793;&#28040;&#24687;&#25991;&#20214;&#30340;&#20154;&#20204;&#26469;&#35828;&#65292;&#38656;&#35201;&#30340;&#21482;&#26377;&#36825;&#20040;&#22810;&#12290;&#32763;&#35793;&#24037;&#20316;&#26412;&#36523;&#20165;&#20165;&#21253;&#21547;&#32534;&#36753;&#36825;&#20010;&#31867;&#22411;&#30340;&#29616;&#23384;&#25991;&#20214;&#65292;&#20294;&#22914;&#26524;&#20320;&#35201;&#21019;&#24314;&#20320;&#33258;&#24049;&#30340;&#28040;&#24687;&#25991;&#20214;&#65292;&#25110;&#24819;&#35201;&#27979;&#35797;&#25110;&#32534;&#35793;&#19968;&#20010;&#26356;&#25913;&#36807;&#30340;&#28040;&#24687;&#25991;&#20214;&#65292;&#20320;&#23558;&#38656;&#35201;&#36825;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt;&#20844;&#29992;&#31243;&#24207;&#12290;&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn283&quot;&gt;&lt;blockquote class=&quot;first&quot;&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn283&quot;&gt;&#20174;&lt;a class=&quot;reference external&quot; href=&quot;http://sourceforge.net/projects/gettext&quot;&gt;http://sourceforge.net/projects/gettext&lt;/a&gt;&#19979;&#36733;&#20197;&#19979;zip&#25991;&#20214;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn284&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn284&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext-runtime-X.bin.woe32.zip&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn285&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn285&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext-tools-X.bin.woe32.zip&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn286&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn286&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;libiconv-X.bin.woe32.zip&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn287&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn287&quot;&gt;&#22312;&#21516;&#19968;&#25991;&#20214;&#22841;&#19979;&#23637;&#24320;&#36825;3&#20010;&#25991;&#20214;&#12290;&#65288;&#20063;&#23601;&#26159; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;C:\Program&lt;/span&gt;
&lt;span class=&quot;pre&quot;&gt;Files\gettext-utils&lt;/span&gt;&lt;/tt&gt; )&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn288&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn288&quot;&gt;&#26356;&#26032;&#31995;&#32479;&#36335;&#24452;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn289&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn289&quot;&gt;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#25511;&#21046;&#38754;&#26495;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&#31995;&#32479;&amp;gt;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&#39640;&#32423;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&#29615;&#22659;&#21464;&#37327;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn290&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn290&quot;&gt;&#22312;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#31995;&#32479;&#21464;&#37327;&lt;/span&gt;&lt;/tt&gt;&#21015;&#34920;&#20013;&#65292;&#28857;&#20987;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Path&lt;/span&gt;&lt;/tt&gt;&#65292;&#28857;&#20987;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Edit&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn291&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn291&quot;&gt;&#25226;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;;C:\Program&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Files\gettext-utils\bin&lt;/span&gt;&lt;/tt&gt;&#21152;&#21040;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&#21464;&#37327;&#20540;&lt;/span&gt;&lt;/tt&gt;&#23383;&#27573;&#30340;&#26411;&#23614;&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn292&quot;&gt;&#21482;&#35201;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;xgettext&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;--version&lt;/span&gt;&lt;/tt&gt;&#21629;&#20196;&#27491;&#24120;&#24037;&#20316;&#65292;&#20320;&#20134;&#21487;&#20351;&#29992;&#20174;&#21035;&#22788;&#33719;&#24471;&#30340;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt;&#30340;&#20108;&#36827;&#21046;&#20195;&#30721;&#12290; &#26377;&#20123;&#29256;&#26412;&#30340;0.14.4&#20108;&#36827;&#21046;&#20195;&#30721;&#34987;&#21457;&#29616;&#19981;&#25903;&#25345;&#36825;&#20010;&#21629;&#20196;&#12290; &#19981;&#35201;&#35797;&#22270;&#19982;Django&#20844;&#29992;&#31243;&#24207;&#19968;&#36215;&#20351;&#29992;&#19968;&#20010;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;gettext&lt;/span&gt;&lt;/tt&gt;&#12290;&#22312;&#19968;&#20010;windows&#21629;&#20196;&#25552;&#31034;&#31383;&#21475;&#36755;&#20837;&#21629;&#20196; `` xgettext &#8212;version &lt;a href=&quot;#id15&quot;&gt;&lt;span class=&quot;problematic&quot; id=&quot;id16&quot;&gt;``&lt;/span&gt;&lt;/a&gt;&#23558;&#23548;&#33268;&#20986;&#29616;&#19968;&#20010;&#38169;&#35823;&#24377;&#20986;&#31383;&#21475;&#8211;&#8220;xgettext.exe&#20135;&#29983;&#38169;&#35823;&#24182;&#19988;&#23558;&#34987;windows&#20851;&#38381;&#8221;&#12290;&lt;/p&gt;
&lt;div class=&quot;system-message&quot; id=&quot;id15&quot;&gt;
&lt;p class=&quot;system-message-title&quot;&gt;System Message: WARNING/2 (&lt;tt class=&quot;docutils&quot;&gt;&amp;lt;string&amp;gt;&lt;/tt&gt;, line 1346); &lt;em&gt;&lt;a href=&quot;#id16&quot;&gt;backlink&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn292&quot;&gt;Inline literal start-string without end-string.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id17&quot;&gt;
&lt;span id=&quot;cn293&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn293&quot;&gt;&#19979;&#19968;&#31456;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn294&quot;&gt;&lt;a class=&quot;reference external&quot; href=&quot;./chapter20&quot;&gt;&#26410;&#31456;&lt;/a&gt; &#23558;&#20851;&#27880;&#20110;&#23433;&#20840;&#65292;&#22914;&#20309;&#24110;&#21161;&#20320;&#30340;&#29992;&#25143;&#21644;&#32593;&#31449;&#36828;&#31163;&#24694;&#24847;&#36719;&#20214;&#30340;&#25915;&#20987;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/djangobooks/entry/chapter20</id>
        <title type="html">chapter20</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/djangobooks/entry/chapter20"/>
        <published>2015-02-26T20:37:51+08:00</published>
        <updated>2015-02-26T20:37:51+08:00</updated> 
        <category term="/General" label="General" />
        <content type="html">&lt;div id=&quot;chapter-body&quot;&gt;
    
    &lt;div class=&quot;document&quot; id=&quot;id1&quot;&gt;
&lt;h1 class=&quot;cn title&quot; id=&quot;cn0&quot;&gt;&#31532;&#20108;&#21313;&#31456;&#65306; &#23433;&#20840;&lt;/h1&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn1&quot;&gt;Internet&#24182;&#19981;&#23433;&#20840;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn2&quot;&gt;&#29616;&#22914;&#20170;&#65292;&#27599;&#22825;&#37117;&#20250;&#20986;&#29616;&#26032;&#30340;&#23433;&#20840;&#38382;&#39064;&#12290; &#25105;&#20204;&#30446;&#30585;&#36807;&#30149;&#27602;&#39134;&#36895;&#22320;&#34067;&#24310;&#65292;&#22823;&#37327;&#34987;&#25511;&#21046;&#30340;&#32905;&#40481;&#20316;&#20026;&#27494;&#22120;&#26469;&#25915;&#20987;&#20854;&#20182;&#20154;&#65292;&#19982;&#22403;&#22334;&#37038;&#20214;&#30340;&#27704;&#26080;&#27490;&#22659;&#30340;&#20891;&#22791;&#31454;&#36187;&#65292;&#20197;&#21450;&#35768;&#35768;&#22810;&#22810;&#31449;&#28857;&#34987;&#40657;&#30340;&#25253;&#21578;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn3&quot;&gt;&#20316;&#20026;Web&#24320;&#21457;&#20154;&#21592;&#65292;&#25105;&#20204;&#26377;&#36131;&#20219;&#26469;&#23545;&#25239;&#36825;&#20123;&#40657;&#26263;&#30340;&#21147;&#37327;&#12290;
&#27599;&#19968;&#20010;Web&#24320;&#21457;&#32773;&#37117;&#24212;&#35813;&#25226;&#23433;&#20840;&#30475;&#25104;&#26159;Web&#32534;&#31243;&#20013;&#30340;&#22522;&#30784;&#37096;&#20998;&#12290;
&#19981;&#24184;&#30340;&#26159;&#65292;&#35201;&#23454;&#29616;&#23433;&#20840;&#26159;&#22256;&#38590;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn4&quot;&gt;Django&#35797;&#22270;&#20943;&#36731;&#36825;&#31181;&#38590;&#24230;&#12290; &#23427;&#34987;&#35774;&#35745;&#20026;&#33258;&#21160;&#24110;&#20320;&#36991;&#20813;&#19968;&#20123;web&#24320;&#21457;&#26032;&#25163;&#65288;&#29978;&#33267;&#26159;&#32769;&#25163;&#65289;&#32463;&#24120;&#20250;&#29359;&#30340;&#38169;&#35823;&#12290; &#23613;&#31649;&#22914;&#27492;&#65292;&#38656;&#35201;&#24324;&#28165;&#26970;&#65292;Django&#22914;&#20309;&#20445;&#25252;&#25105;&#20204;&#65292;&#20197;&#21450;&#25105;&#20204;&#21487;&#20197;&#37319;&#21462;&#21738;&#20123;&#37325;&#35201;&#30340;&#26041;&#27861;&#26469;&#20351;&#24471;&#25105;&#20204;&#30340;&#20195;&#30721;&#26356;&#21152;&#23433;&#20840;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn5&quot;&gt;&#39318;&#20808;&#65292;&#19968;&#20010;&#37325;&#35201;&#30340;&#21069;&#25552;&#65306; &#25105;&#20204;&#24182;&#19981;&#25171;&#31639;&#32473;&#20986;web&#23433;&#20840;&#30340;&#19968;&#20010;&#35814;&#23613;&#30340;&#35828;&#26126;&#65292;&#22240;&#27492;&#25105;&#20204;&#20063;&#19981;&#20250;&#35814;&#32454;&#22320;&#35299;&#37322;&#27599;&#19968;&#20010;&#34180;&#24369;&#29615;&#33410;&#12290; &#22312;&#36825;&#37324;&#65292;&#25105;&#20204;&#20250;&#32473;&#20986;Django&#25152;&#38754;&#20020;&#30340;&#23433;&#20840;&#38382;&#39064;&#30340;&#19968;&#20010;&#22823;&#27010;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;web&quot;&gt;
&lt;span id=&quot;cn6&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn6&quot;&gt;Web&#23433;&#20840;&#29616;&#29366;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn7&quot;&gt;&#22914;&#26524;&#20320;&#20174;&#36825;&#31456;&#20013;&#21482;&#23398;&#21040;&#20102;&#19968;&#20214;&#20107;&#24773;&#65292;&#37027;&#20040;&#23427;&#20250;&#26159;&#65306;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn8&quot;&gt;&#22312;&#20219;&#20309;&#26465;&#20214;&#19979;&#37117;&#19981;&#35201;&#30456;&#20449;&#27983;&#35272;&#22120;&#31471;&#25552;&#20132;&#30340;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn9&quot;&gt;&#20320;&#20174;&#19981;&#20250;&#30693;&#36947;HTTP&#36830;&#25509;&#30340;&#21478;&#19968;&#31471;&#20250;&#26159;&#35841;&#12290; &#21487;&#33021;&#26159;&#19968;&#20010;&#27491;&#24120;&#30340;&#29992;&#25143;&#65292;&#20294;&#26159;&#21516;&#26679;&#21487;&#33021;&#26159;&#19968;&#20010;&#23547;&#25214;&#28431;&#27934;&#30340;&#37034;&#24694;&#30340;&#39559;&#23458;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn10&quot;&gt;&#20174;&#27983;&#35272;&#22120;&#20256;&#36807;&#26469;&#30340;&#20219;&#20309;&#24615;&#36136;&#30340;&#25968;&#25454;&#65292;&#37117;&#38656;&#35201;&#36817;&#20046;&#29378;&#28909;&#22320;&#25509;&#21463;&#26816;&#26597;&#12290; &#36825;&#21253;&#25324;&#29992;&#25143;&#25968;&#25454;&#65288;&#27604;&#22914;Web&#34920;&#21333;&#25552;&#20132;&#30340;&#20869;&#23481;&#65289;&#21644;&#24102;&#22806;&#25968;&#25454;&#65288;&#27604;&#22914;&#65292;HTTP&#22836;&#12289;cookies&#20197;&#21450;&#20854;&#20182;&#20449;&#24687;&#65289;&#12290; &#35201;&#20462;&#25913;&#37027;&#20123;&#27983;&#35272;&#22120;&#33258;&#21160;&#28155;&#21152;&#30340;&#20803;&#25968;&#25454;&#65292;&#26159;&#19968;&#20214;&#24456;&#23481;&#26131;&#30340;&#20107;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn11&quot;&gt;&#22312;&#36825;&#19968;&#31456;&#25152;&#25552;&#21040;&#30340;&#25152;&#26377;&#30340;&#23433;&#20840;&#38544;&#24739;&#37117;&#30452;&#25509;&#28304;&#33258;&#23545;&#20256;&#20837;&#25968;&#25454;&#30340;&#20449;&#20219;&#65292;&#24182;&#19988;&#22312;&#20351;&#29992;&#21069;&#19981;&#21152;&#22788;&#29702;&#12290; &#20320;&#38656;&#35201;&#19981;&#26029;&#22320;&#38382;&#33258;&#24049;&#65292;&#36825;&#20123;&#25968;&#25454;&#20174;&#20309;&#32780;&#26469;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;sql&quot;&gt;
&lt;span id=&quot;cn12&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn12&quot;&gt;SQL&#27880;&#20837;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn13&quot;&gt;SQL&#27880;&#20837; &#26159;&#19968;&#20010;&#24456;&#24120;&#35265;&#30340;&#24418;&#24335;&#65292;&#22312;SQL&#27880;&#20837;&#20013;&#65292;&#25915;&#20987;&#32773;&#25913;&#21464;web&#32593;&#39029;&#30340;&#21442;&#25968;&#65288;&#20363;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;GET&lt;/span&gt;&lt;/tt&gt; /&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#25968;&#25454;&#25110;&#32773;URL&#22320;&#22336;&#65289;&#65292;&#21152;&#20837;&#19968;&#20123;&#20854;&#20182;&#30340;SQL&#29255;&#27573;&#12290; &#26410;&#21152;&#22788;&#29702;&#30340;&#32593;&#31449;&#20250;&#23558;&#36825;&#20123;&#20449;&#24687;&#22312;&#21518;&#21488;&#25968;&#25454;&#24211;&#30452;&#25509;&#36816;&#34892;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn14&quot;&gt;&#36825;&#31181;&#21361;&#38505;&#36890;&#24120;&#22312;&#30001;&#29992;&#25143;&#36755;&#20837;&#26500;&#36896;SQL&#35821;&#21477;&#26102;&#20135;&#29983;&#12290;
&#20363;&#22914;&#65292;&#20551;&#35774;&#25105;&#20204;&#35201;&#20889;&#19968;&#20010;&#20989;&#25968;&#65292;&#29992;&#26469;&#20174;&#36890;&#20449;&#24405;&#25628;&#32034;&#39029;&#38754;&#25910;&#38598;&#19968;&#31995;&#21015;&#30340;&#32852;&#31995;&#20449;&#24687;&#12290; &#20026;&#38450;&#27490;&#22403;&#22334;&#37038;&#20214;&#21457;&#36865;&#22120;&#38405;&#35835;&#31995;&#32479;&#20013;&#30340;email&#65292;&#25105;&#20204;&#23558;&#22312;&#25552;&#20379;email&#22320;&#22336;&#20197;&#21069;&#65292;&#39318;&#20808;&#24378;&#21046;&#29992;&#25143;&#36755;&#20837;&#29992;&#25143;&#21517;&#12290;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn16&quot;&gt;def user_contacts(request):
    user = request.GET[&apos;username&apos;]
    sql = &quot;SELECT * FROM user_contacts WHERE username = &apos;%s&apos;;&quot; % username
    # execute the SQL here...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn17&quot;&gt;&#22791;&#27880;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn18&quot;&gt;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#20197;&#21450;&#22312;&#20197;&#19979;&#25152;&#26377;&#30340;&#8220;&#19981;&#35201;&#36825;&#26679;&#20570;&#8221;&#30340;&#20363;&#23376;&#37324;&#65292;&#25105;&#20204;&#37117;&#21435;&#38500;&#20102;&#22823;&#37327;&#30340;&#20195;&#30721;&#65292;&#36991;&#20813;&#36825;&#20123;&#20989;&#25968;&#21487;&#20197;&#27491;&#24120;&#24037;&#20316;&#12290; &#25105;&#20204;&#21487;&#19981;&#24819;&#36825;&#20123;&#20363;&#23376;&#34987;&#25343;&#20986;&#21435;&#20351;&#29992;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn19&quot;&gt;&#23613;&#31649;&#65292;&#19968;&#30524;&#30475;&#19978;&#21435;&#65292;&#36825;&#19968;&#28857;&#37117;&#19981;&#21361;&#38505;&#65292;&#23454;&#38469;&#19978;&#21364;&#19981;&#23613;&#28982;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn20&quot;&gt;&#39318;&#20808;&#65292;&#25105;&#20204;&#23545;&#20110;&#20445;&#25252;email&#21015;&#34920;&#25152;&#37319;&#21462;&#30340;&#25514;&#26045;&#65292;&#36935;&#21040;&#31934;&#24515;&#26500;&#36896;&#30340;&#26597;&#35810;&#35821;&#21477;&#23601;&#20250;&#22833;&#25928;&#12290; &#24819;&#35937;&#19968;&#19979;&#65292;&#22914;&#26524;&#25915;&#20987;&#32773;&#22312;&#26597;&#35810;&#26694;&#20013;&#36755;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;&apos;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;OR&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&apos;a&apos;=&apos;a&quot;&lt;/span&gt;&lt;/tt&gt; &#12290; &#27492;&#26102;&#65292;&#26597;&#35810;&#30340;&#23383;&#31526;&#20018;&#20250;&#26500;&#36896;&#22914;&#19979;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn22&quot;&gt;SELECT * FROM user_contacts WHERE username = &apos;&apos; OR &apos;a&apos; = &apos;a&apos;;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn23&quot;&gt;&#30001;&#20110;&#25105;&#20204;&#20801;&#35768;&#19981;&#23433;&#20840;&#30340;SQL&#35821;&#21477;&#20986;&#29616;&#22312;&#23383;&#31526;&#20018;&#20013;&#65292;&#25915;&#20987;&#32773;&#21152;&#20837; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;OR&lt;/span&gt;&lt;/tt&gt; &#23376;&#21477;&#65292;&#20351;&#24471;&#27599;&#19968;&#34892;&#25968;&#25454;&#37117;&#34987;&#36820;&#22238;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn24&quot;&gt;&#20107;&#23454;&#19978;&#65292;&#36825;&#26159;&#26368;&#28201;&#21644;&#30340;&#25915;&#20987;&#26041;&#24335;&#12290; &#22914;&#26524;&#25915;&#20987;&#32773;&#25552;&#20132;&#20102; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;&apos;;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;DELETE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;user_contacts&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&apos;a&apos;&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;&apos;a&apos;&quot;&lt;/span&gt;&lt;/tt&gt; &#65292;&#25105;&#20204;&#26368;&#32456;&#23558;&#24471;&#21040;&#36825;&#26679;&#30340;&#26597;&#35810;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn26&quot;&gt;SELECT * FROM user_contacts WHERE username = &apos;&apos;; DELETE FROM user_contacts WHERE &apos;a&apos; = &apos;a&apos;;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn27&quot;&gt;&#21734;&#65281;&#25105;&#20204;&#25972;&#20010;&#36890;&#20449;&#24405;&#21517;&#21333;&#21435;&#21738;&#20799;&#20102;&#65311; &#25105;&#20204;&#25972;&#20010;&#36890;&#35759;&#24405;&#20250;&#34987;&#31435;&#21363;&#21024;&#38500;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id2&quot;&gt;
&lt;span id=&quot;cn28&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn28&quot;&gt;&#35299;&#20915;&#26041;&#26696;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn29&quot;&gt;&#23613;&#31649;&#36825;&#20010;&#38382;&#39064;&#24456;&#38452;&#38505;&#65292;&#24182;&#19988;&#26377;&#26102;&#24456;&#38590;&#21457;&#29616;&#65292;&#35299;&#20915;&#26041;&#27861;&#21364;&#24456;&#31616;&#21333;&#65306;
&#32477;&#19981;&#20449;&#20219;&#29992;&#25143;&#25552;&#20132;&#30340;&#25968;&#25454;&#65292;&#24182;&#19988;&#22312;&#20256;&#36882;&#32473;SQL&#35821;&#21477;&#26102;&#65292;&#24635;&#26159;&#36716;&#20041;&#23427;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn30&quot;&gt;Django&#30340;&#25968;&#25454;&#24211;API&#24110;&#20320;&#20570;&#20102;&#12290; &#23427;&#20250;&#26681;&#25454;&#20320;&#25152;&#20351;&#29992;&#30340;&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;&#65288;&#20363;&#22914;PostSQL&#25110;&#32773;MySQL&#65289;&#30340;&#36716;&#25442;&#35268;&#21017;&#65292;&#33258;&#21160;&#36716;&#20041;&#29305;&#27530;&#30340;SQL&#21442;&#25968;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn31&quot;&gt;&#20030;&#20010;&#20363;&#23376;&#65292;&#22312;&#19979;&#38754;&#36825;&#20010;API&#35843;&#29992;&#20013;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn33&quot;&gt;foo.get_list(bar__exact=&quot;&apos; OR 1=1&quot;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn34&quot;&gt;Django&#20250;&#33258;&#21160;&#36827;&#34892;&#36716;&#20041;&#65292;&#24471;&#21040;&#22914;&#19979;&#34920;&#36798;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn36&quot;&gt;SELECT * FROM foos WHERE bar = &apos;\&apos; OR 1=1&apos;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn37&quot;&gt;&#23436;&#20840;&#26080;&#23475;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn38&quot;&gt;&#36825;&#34987;&#36816;&#29992;&#21040;&#20102;&#25972;&#20010;Django&#30340;&#25968;&#25454;&#24211;API&#20013;&#65292;&#21482;&#26377;&#19968;&#20123;&#20363;&#22806;&#65306;&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn39&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn39&quot;&gt;&#20256;&#32473; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;extra()&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;where&lt;/span&gt;&lt;/tt&gt; &#21442;&#25968;&#12290; (&#21442;&#32771; &#38468;&#24405; C&#12290;) &#36825;&#20010;&#21442;&#25968;&#25925;&#24847;&#35774;&#35745;&#25104;&#21487;&#20197;&#25509;&#21463;&#21407;&#22987;&#30340;SQL&#12290;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li class=&quot;cn&quot; id=&quot;cn40&quot;&gt;&lt;p class=&quot;first cn&quot; id=&quot;cn40&quot;&gt;&#20351;&#29992;&#24213;&#23618;&#25968;&#25454;&#24211;API&#30340;&#26597;&#35810;&#12290; (&#35814;&#35265;&#31532;&#21313;&#31456;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn41&quot;&gt;&#20197;&#19978;&#21015;&#20030;&#30340;&#27599;&#19968;&#20010;&#31034;&#20363;&#37117;&#33021;&#22815;&#24456;&#23481;&#26131;&#30340;&#35753;&#24744;&#30340;&#24212;&#29992;&#24471;&#21040;&#20445;&#25252;&#12290; &#22312;&#27599;&#19968;&#20010;&#31034;&#20363;&#20013;&#65292;&#20026;&#20102;&#36991;&#20813;&#23383;&#31526;&#20018;&#34987;&#31713;&#25913;&#32780;&#20351;&#29992; &lt;em&gt;&#32465;&#23450;&#21442;&#25968;&lt;/em&gt; &#26469;&#20195;&#26367;&#12290;&#36825;&#26679;&#65292;&#26412;&#33410;&#24320;&#22987;&#30340;&#20363;&#23376;&#24212;&#35813;&#20889;&#25104;&#36825;&#26679;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn43&quot;&gt;from django.db import connection

def user_contacts(request):
    user = request.GET[&apos;username&apos;]
    sql = &quot;SELECT * FROM user_contacts WHERE username = %s&quot;
    cursor = connection.cursor()
    cursor.execute(sql, [user])
    # ... do something with the results
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn44&quot;&gt;&#24213;&#23618; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;execute&lt;/span&gt;&lt;/tt&gt; &#26041;&#27861;&#37319;&#29992;&#20102;&#19968;&#20010;SQL&#23383;&#31526;&#20018;&#20316;&#20026;&#20854;&#31532;&#20108;&#20010;&#21442;&#25968;&#65292;&#36825;&#20010;SQL&#23383;&#31526;&#20018;&#21253;&#21547;&#33509;&#24178;&#8217;%s&#8217;&#21344;&#20301;&#31526;&#65292;execute&#26041;&#27861;&#33021;&#22815;&#33258;&#21160;&#23545;&#20256;&#20837;&#21015;&#34920;&#20013;&#30340;&#21442;&#25968;&#36827;&#34892;&#36716;&#20041;&#21644;&#25554;&#20837;&#12290;
&#20320;&#24212;&#35813;&#29992;* always* &#36825;&#31181;&#26041;&#24335;&#26500;&#36896;&#33258;&#23450;&#20041;&#30340;SQL&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn45&quot;&gt;&#19981;&#24184;&#30340;&#26159;&#65292;&#24744;&#24182;&#19981;&#26159;&#22312;SQL&#20013;&#33021;&#22815;&#22788;&#22788;&#37117;&#20351;&#29992;&#32465;&#23450;&#21442;&#25968;&#65292;&#32465;&#23450;&#21442;&#25968;&#19981;&#33021;&#22815;&#20316;&#20026;&#26631;&#35782;&#31526;&#65288;&#22914;&#34920;&#25110;&#21015;&#21517;&#31561;&#65289;&#12290; &#22240;&#27492;&#65292;&#22914;&#26524;&#24744;&#38656;&#35201;&#36825;&#26679;&#20570;&#8212;&#25105;&#26159;&#35828;&#8212;&#21160;&#24577;&#26500;&#24314; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;POST&lt;/span&gt;&lt;/tt&gt; &#21464;&#37327;&#20013;&#30340;&#25968;&#25454;&#24211;&#34920;&#30340;&#21015;&#34920;&#30340;&#35805;&#65292;&#24744;&#38656;&#35201;&#22312;&#24744;&#30340;&#20195;&#30721;&#20013;&#26469;&#23545;&#36825;&#20123;&#25968;&#25454;&#24211;&#34920;&#30340;&#21517;&#23383;&#36827;&#34892;&#36716;&#20041;&#12290;
Django&#25552;&#20379;&#20102;&#19968;&#20010;&#20989;&#25968;&#65292; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.db.backend.quote_name&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#20010;&#20989;&#25968;&#33021;&#22815;&#26681;&#25454;&#24403;&#21069;&#25968;&#25454;&#24211;&#24341;&#29992;&#32467;&#26500;&#23545;&#36825;&#20123;&#26631;&#35782;&#31526;&#36827;&#34892;&#36716;&#20041;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;xss&quot;&gt;
&lt;span id=&quot;cn46&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn46&quot;&gt;&#36328;&#31449;&#28857;&#33050;&#26412; (XSS)&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn47&quot;&gt;&#22312;Web&#24212;&#29992;&#20013;&#65292; &lt;em&gt;&#36328;&#31449;&#28857;&#33050;&#26412;&lt;/em&gt; (XSS)&#26377;&#26102;&#22312;&#34987;&#28210;&#26579;&#25104;HTML&#20043;&#21069;&#65292;&#19981;&#33021;&#24688;&#24403;&#22320;&#23545;&#29992;&#25143;&#25552;&#20132;&#30340;&#20869;&#23481;&#36827;&#34892;&#36716;&#20041;&#12290; &#36825;&#20351;&#24471;&#25915;&#20987;&#32773;&#33021;&#22815;&#21521;&#20320;&#30340;&#32593;&#31449;&#39029;&#38754;&#25554;&#20837;&#36890;&#24120;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#26631;&#31614;&#24418;&#24335;&#30340;&#20219;&#24847;HTML&#20195;&#30721;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn48&quot;&gt;&#25915;&#20987;&#32773;&#36890;&#24120;&#21033;&#29992;XSS&#25915;&#20987;&#26469;&#31363;&#21462;cookie&#21644;&#20250;&#35805;&#20449;&#24687;&#65292;&#25110;&#32773;&#35825;&#39575;&#29992;&#25143;&#23558;&#20854;&#31169;&#23494;&#20449;&#24687;&#36879;&#28431;&#32473;&#34987;&#20154;&#65288;&#21448;&#31216; &lt;em&gt;&#38035;&#40060;&lt;/em&gt; &#65289;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn49&quot;&gt;&#36825;&#31181;&#31867;&#22411;&#30340;&#25915;&#20987;&#33021;&#22815;&#37319;&#29992;&#22810;&#31181;&#19981;&#21516;&#30340;&#26041;&#24335;&#65292;&#24182;&#19988;&#25317;&#26377;&#20960;&#20046;&#26080;&#38480;&#30340;&#21464;&#20307;&#65292;&#22240;&#27492;&#25105;&#20204;&#36824;&#26159;&#21482;&#20851;&#27880;&#26576;&#20010;&#20856;&#22411;&#30340;&#20363;&#23376;&#21543;&#12290; &#35753;&#25105;&#20204;&#26469;&#24819;&#24819;&#36825;&#26679;&#19968;&#20010;&#26497;&#24230;&#31616;&#21333;&#30340;Hello World&#35270;&#22270;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn51&quot;&gt;from django.http import HttpResponse

def say_hello(request):
    name = request.GET.get(&apos;name&apos;, &apos;world&apos;)
    return HttpResponse(&apos;&amp;lt;h1&amp;gt;Hello, %s!&amp;lt;/h1&amp;gt;&apos; % name)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn52&quot;&gt;&#36825;&#20010;&#35270;&#22270;&#21482;&#26159;&#31616;&#21333;&#30340;&#20174;GET&#21442;&#25968;&#20013;&#35835;&#21462;&#22995;&#21517;&#28982;&#21518;&#23558;&#22995;&#21517;&#20256;&#36882;&#32473;hello.html&#27169;&#26495;&#12290; &#22240;&#27492;&#65292;&#22914;&#26524;&#25105;&#20204;&#35775;&#38382; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://example.com/hello/?name=Jacob&lt;/span&gt;&lt;/tt&gt; &#65292;&#34987;&#21576;&#29616;&#30340;&#39029;&#38754;&#23558;&#20250;&#21253;&#21547;&#19968;&#20197;&#19979;&#36825;&#20123;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn54&quot;&gt;&amp;lt;h1&amp;gt;Hello, Jacob!&amp;lt;/h1&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn55&quot;&gt;&#20294;&#26159;&#65292;&#31561;&#31561;&#65292;&#22914;&#26524;&#25105;&#20204;&#35775;&#38382; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://example.com/hello/?name=&amp;lt;i&amp;gt;Jacob&amp;lt;/i&amp;gt;&lt;/span&gt;&lt;/tt&gt; &#26102;&#21448;&#20250;&#21457;&#29983;&#20160;&#20040;&#21602;&#65311;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn57&quot;&gt;&amp;lt;h1&amp;gt;Hello, &amp;lt;i&amp;gt;Jacob&amp;lt;/i&amp;gt;!&amp;lt;/h1&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn58&quot;&gt;&#24403;&#28982;&#65292;&#19968;&#20010;&#25915;&#20987;&#32773;&#19981;&#20250;&#20351;&#29992;&amp;lt;i&amp;gt;&#26631;&#31614;&#24320;&#22987;&#30340;&#31867;&#20284;&#20195;&#30721;&#65292;&#20182;&#21487;&#33021;&#20250;&#29992;&#20219;&#24847;&#20869;&#23481;&#21435;&#21253;&#21547;&#19968;&#20010;&#23436;&#25972;&#30340;HTML&#38598;&#26469;&#21163;&#25345;&#24744;&#30340;&#39029;&#38754;&#12290; &#36825;&#31181;&#31867;&#22411;&#30340;&#25915;&#20987;&#24050;&#32463;&#36816;&#29992;&#20110;&#34394;&#20551;&#38134;&#34892;&#31449;&#28857;&#20197;&#35825;&#39575;&#29992;&#25143;&#36755;&#20837;&#20010;&#20154;&#20449;&#24687;&#65292;&#20107;&#23454;&#19978;&#36825;&#23601;&#26159;&#19968;&#31181;&#21163;&#25345;XSS&#30340;&#24418;&#24335;&#65292;&#29992;&#20197;&#20351;&#29992;&#25143;&#21521;&#25915;&#20987;&#32773;&#25552;&#20379;&#20182;&#20204;&#30340;&#38134;&#34892;&#24080;&#25143;&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn59&quot;&gt;&#22914;&#26524;&#24744;&#23558;&#36825;&#20123;&#25968;&#25454;&#20445;&#23384;&#22312;&#25968;&#25454;&#24211;&#20013;&#65292;&#28982;&#21518;&#23558;&#20854;&#26174;&#31034;&#22312;&#24744;&#30340;&#31449;&#28857;&#19978;&#65292;&#37027;&#20040;&#38382;&#39064;&#23601;&#21464;&#24471;&#26356;&#20005;&#37325;&#20102;&#12290; &#20363;&#22914;&#65292;&#19968;&#26086;MySpace&#34987;&#21457;&#29616;&#36825;&#26679;&#30340;&#29305;&#28857;&#32780;&#33021;&#22815;&#36731;&#26131;&#30340;&#34987;XSS&#25915;&#20987;&#65292;&#21518;&#26524;&#19981;&#22570;&#35774;&#24819;&#12290; &#26576;&#20010;&#29992;&#25143;&#21521;&#20182;&#30340;&#31616;&#20171;&#20013;&#25554;&#20837;JavaScript&#65292;&#20351;&#24471;&#24744;&#22312;&#35775;&#38382;&#20182;&#30340;&#31616;&#20171;&#39029;&#38754;&#26102;&#33258;&#21160;&#23558;&#20854;&#21152;&#20026;&#24744;&#30340;&#22909;&#21451;&#65292;&#36825;&#26679;&#22312;&#20960;&#22825;&#20043;&#20869;&#65292;&#36825;&#20010;&#20154;&#23601;&#33021;&#25317;&#26377;&#19978;&#30334;&#19975;&#30340;&#22909;&#21451;&#12290; &#22312;&#20960;&#22825;&#30340;&#26102;&#38388;&#37324;&#65292;&#20182;&#25317;&#26377;&#20102;&#25968;&#20197;&#30334;&#19975;&#30340;&#26379;&#21451;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn60&quot;&gt;&#29616;&#22312;&#65292;&#36825;&#31181;&#21518;&#26524;&#21548;&#36215;&#26469;&#36824;&#19981;&#37027;&#20040;&#24694;&#21155;&#65292;&#20294;&#26159;&#24744;&#35201;&#28165;&#26970;&#8212;&#8212;&#36825;&#20010;&#25915;&#20987;&#32773;&#27491;&#35774;&#27861;&#23558; &lt;em&gt;&#20182;&lt;/em&gt; &#30340;&#20195;&#30721;&#32780;&#19981;&#26159;MySpace&#30340;&#20195;&#30721;&#36816;&#34892;&#22312; &lt;em&gt;&#24744;&lt;/em&gt; &#30340;&#35745;&#31639;&#26426;&#19978;&#12290; &#36825;&#26174;&#28982;&#36829;&#32972;&#20102;&#20551;&#23450;&#20449;&#20219;&#8212;&#8212;&#25152;&#26377;&#36816;&#34892;&#22312;MySpace&#19978;&#30340;&#20195;&#30721;&#24212;&#35813;&#37117;&#26159;MySpace&#32534;&#20889;&#30340;&#65292;&#32780;&#20107;&#23454;&#19978;&#21364;&#19981;&#22914;&#27492;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn61&quot;&gt;MySpace&#26159;&#26497;&#24230;&#24184;&#36816;&#30340;&#65292;&#22240;&#20026;&#36825;&#20123;&#24694;&#24847;&#20195;&#30721;&#24182;&#27809;&#26377;&#33258;&#21160;&#21024;&#38500;&#35775;&#38382;&#32773;&#30340;&#24080;&#25143;&#65292;&#27809;&#26377;&#20462;&#25913;&#20182;&#20204;&#30340;&#23494;&#30721;&#65292;&#20063;&#24182;&#27809;&#26377;&#20351;&#25972;&#20010;&#31449;&#28857;&#19968;&#22242;&#31967;&#65292;&#25110;&#32773;&#20986;&#29616;&#20854;&#20182;&#22240;&#20026;&#36825;&#20010;&#24369;&#28857;&#32780;&#23548;&#33268;&#30340;&#20854;&#20182;&#22121;&#26790;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id3&quot;&gt;
&lt;span id=&quot;cn62&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn62&quot;&gt;&#35299;&#20915;&#26041;&#26696;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn63&quot;&gt;&#35299;&#20915;&#26041;&#26696;&#26159;&#31616;&#21333;&#30340;&#65306; &#24635;&#26159;&#36716;&#20041;&#21487;&#33021;&#26469;&#33258;&#26576;&#20010;&#29992;&#25143;&#30340;&#20219;&#20309;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn64&quot;&gt;&#20026;&#20102;&#38450;&#27490;&#36825;&#31181;&#24773;&#20917;&#65292;Django&#30340;&#27169;&#26495;&#31995;&#32479;&#33258;&#21160;&#36716;&#20041;&#25152;&#26377;&#30340;&#21464;&#37327;&#20540;&#12290;
&#35753;&#25105;&#20204;&#26469;&#30475;&#30475;&#22914;&#26524;&#25105;&#20204;&#20351;&#29992;&#27169;&#26495;&#31995;&#32479;&#37325;&#20889;&#25105;&#20204;&#30340;&#20363;&#23376;&#20250;&#21457;&#29983;&#20160;&#20040;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn66&quot;&gt;# views.py

from django.shortcuts import render_to_response

def say_hello(request):
    name = request.GET.get(&apos;name&apos;, &apos;world&apos;)
    return render_to_response(&apos;hello.html&apos;, {&apos;name&apos;: name})

# hello.html

&amp;lt;h1&amp;gt;Hello, {{ name }}!&amp;lt;/h1&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn67&quot;&gt;&#36825;&#26679;&#65292;&#19968;&#20010;&#21040;`` &lt;a class=&quot;reference external&quot; href=&quot;http://example.com/hello&quot;&gt;http://example.com/hello&lt;/a&gt;/name=Jacob`` &#30340;&#35831;&#27714;&#23558;&#23548;&#33268;&#19979;&#38754;&#30340;&#39029;&#38754;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn69&quot;&gt;&amp;lt;h1&amp;gt;Hello, &amp;amp;lt;i&amp;amp;gt;Jacob&amp;amp;lt;/i&amp;amp;gt;!&amp;lt;/h1&amp;gt;
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn70&quot;&gt;&#25105;&#20204;&#22312;&#31532;&#22235;&#31456;&#28085;&#30422;&#20102;Django&#30340;&#33258;&#21160;&#36716;&#20041;&#65292;&#19968;&#36215;&#24819;&#21150;&#27861;&#23558;&#20854;&#20851;&#38381;&#12290; &#29978;&#33267;&#65292;&#22914;&#26524;Django&#30495;&#30340;&#26032;&#22686;&#20102;&#36825;&#20123;&#29305;&#24615;&#65292;&#24744;&#20063;&#24212;&#35813;&#20064;&#24815;&#24615;&#30340;&#38382;&#33258;&#24049;&#65292;&#19968;&#30452;&#20197;&#26469;&#65292;&#36825;&#20123;&#25968;&#25454;&#37117;&#26469;&#33258;&#20110;&#21738;&#37324;&#21602;&#65311; &#27809;&#26377;&#21738;&#20010;&#33258;&#21160;&#35299;&#20915;&#26041;&#26696;&#33021;&#22815;&#27704;&#36828;&#20445;&#25252;&#24744;&#30340;&#31449;&#28857;&#30334;&#20998;&#20043;&#30334;&#30340;&#19981;&#20250;&#21463;&#21040;XSS&#25915;&#20987;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id4&quot;&gt;
&lt;span id=&quot;cn71&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn71&quot;&gt;&#20266;&#36896;&#36328;&#31449;&#28857;&#35831;&#27714;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn72&quot;&gt;&#20266;&#36896;&#36328;&#31449;&#28857;&#35831;&#27714;(CSRF)&#21457;&#29983;&#22312;&#24403;&#26576;&#20010;&#24694;&#24847;Web&#31449;&#28857;&#35825;&#39575;&#29992;&#25143;&#19981;&#30693;&#19981;&#35273;&#30340;&#20174;&#19968;&#20010;&#20449;&#20219;&#31449;&#28857;&#19979;&#36733;&#26576;&#20010;URL&#20043;&#26102;&#65292;&#36825;&#20010;&#20449;&#20219;&#31449;&#28857;&#24050;&#32463;&#34987;&#36890;&#36807;&#20449;&#20219;&#39564;&#35777;&#65292;&#22240;&#27492;&#24694;&#24847;&#31449;&#28857;&#23601;&#21033;&#29992;&#20102;&#36825;&#20010;&#34987;&#20449;&#20219;&#29366;&#24577;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn73&quot;&gt;Django&#25317;&#26377;&#20869;&#24314;&#24037;&#20855;&#26469;&#38450;&#27490;&#36825;&#31181;&#25915;&#20987;&#12290; &#21253;&#25324;&#25915;&#20987;&#26412;&#36523;&#21450;&#20854;&#20351;&#29992;&#30340;&#24037;&#20855;&#37117;&#22312;&#26377;&#35814;&#32454;&#20171;&#32461;&#12290;&lt;a class=&quot;reference external&quot; href=&quot;../chapter16/&quot;&gt;16&#31456;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id5&quot;&gt;
&lt;span id=&quot;cn74&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn74&quot;&gt;&#20250;&#35805;&#20266;&#36896;/&#21163;&#25345;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn75&quot;&gt;&#36825;&#19981;&#26159;&#26576;&#20010;&#29305;&#23450;&#30340;&#25915;&#20987;&#65292;&#32780;&#26159;&#23545;&#29992;&#25143;&#20250;&#35805;&#25968;&#25454;&#30340;&#36890;&#29992;&#31867;&#25915;&#20987;&#12290; &#36825;&#31181;&#25915;&#20987;&#21487;&#20197;&#37319;&#21462;&#22810;&#31181;&#24418;&#24335;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn76&quot;&gt;&lt;em&gt;&#20013;&#38388;&#20154;&lt;/em&gt; &#25915;&#20987;&#65306;&#26816;&#32034;&#25152;&#22312;&#26377;&#32447;&#65288;&#26080;&#32447;&#65289;&#32593;&#32476;&#65292;&#30417;&#21548;&#20250;&#35805;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn77&quot;&gt;&lt;em&gt;&#20266;&#36896;&#20250;&#35805;&lt;/em&gt; &#65306;&#25915;&#20987;&#32773;&#21033;&#29992;&#20250;&#35805;ID&#65288;&#21487;&#33021;&#26159;&#36890;&#36807;&#20013;&#38388;&#20154;&#25915;&#20987;&#26469;&#33719;&#24471;&#65289;&#23558;&#33258;&#24049;&#20266;&#35013;&#25104;&#21478;&#19968;&#20010;&#29992;&#25143;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn78&quot;&gt;&#36825;&#20004;&#31181;&#25915;&#20987;&#30340;&#19968;&#20010;&#20363;&#23376;&#21487;&#20197;&#26159;&#22312;&#19968;&#38388;&#21654;&#21857;&#24215;&#37324;&#30340;&#26576;&#20010;&#25915;&#20987;&#32773;&#21033;&#29992;&#24215;&#20869;&#30340;&#26080;&#32447;&#32593;&#32476;&#26469;&#25429;&#33719;&#26576;&#20010;&#20250;&#35805;cookie&#65292;&#28982;&#21518;&#22905;&#23601;&#21487;&#20197;&#21033;&#29992;&#37027;&#20010;cookie&#26469;&#20551;&#20882;&#21407;&#22987;&#29992;&#25143;&#12290; &#22905;&#20415;&#21487;&#20197;&#20351;&#35813;cookie&#26469;&#27169;&#25311;&#21407;&#22987;&#29992;&#25143;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn79&quot;&gt;&lt;em&gt;&#20266;&#36896;cookie&lt;/em&gt; &#65306;&#23601;&#26159;&#25351;&#26576;&#20010;&#25915;&#20987;&#32773;&#35206;&#30422;&#20102;&#22312;&#26576;&#20010;cookie&#20013;&#26412;&#24212;&#35813;&#26159;&#21482;&#35835;&#30340;&#25968;&#25454;&#12290; ` &#31532;&#21313;&#22235;&#31456; &amp;lt;../chapter14/&amp;gt;`__ &#35814;&#32454;&#20171;&#32461;&#20102;cookies&#22914;&#20309;&#24037;&#20316;&#65292;&#20197;&#21450;&#35201;&#28857;&#20043;&#19968;&#30340;&#26159;&#65292;&#23427;&#22312;&#20320;&#19981;&#30693;&#36947;&#30340;&#24773;&#20917;&#19979;&#26080;&#35270;&#27983;&#35272;&#22120;&#21644;&#24694;&#24847;&#29992;&#25143;&#31169;&#33258;&#25913;&#21464;cookies&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn80&quot;&gt;Web&#31449;&#28857;&#20197; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;IsLoggedIn=1&lt;/span&gt;&lt;/tt&gt; &#25110;&#32773; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;LoggedInAsUser=jacob&lt;/span&gt;&lt;/tt&gt; &#36825;&#26679;&#30340;&#26041;&#24335;&#26469;&#20445;&#23384;cookie&#30001;&#26469;&#24050;&#20037;&#65292;&#20351;&#29992;&#36825;&#26679;&#30340;cookie&#26159;&#20877;&#31616;&#21333;&#19981;&#36807;&#30340;&#20102;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn81&quot;&gt;&#19968;&#20010;&#26356;&#24494;&#22937;&#30340;&#23618;&#38754;&#19978;&#65292;&#28982;&#32780;&#65292;&#30456;&#20449;&#22312;cookies&#20013;&#23384;&#20648;&#30340;&#20219;&#24847;&#20449;&#24687;&#32477;&#23545;&#19981;&#26159;&#19968;&#20010;&#22909;&#20027;&#24847;&#12290; &#20320;&#27704;&#36828;&#19981;&#30693;&#36947;&#35841;&#19968;&#30452;&#22312;&#20316;&#24618;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn82&quot;&gt;&lt;em&gt;&#20250;&#35805;&#28382;&#30041;&lt;/em&gt; &#65306;&#25915;&#20987;&#32773;&#35825;&#39575;&#29992;&#25143;&#35774;&#32622;&#25110;&#32773;&#37325;&#35774;&#32622;&#35813;&#29992;&#25143;&#30340;&#20250;&#35805;ID&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn83&quot;&gt;&#20363;&#22914;&#65292;PHP&#20801;&#35768;&#22312;URL&#65288;&#22914; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://example.com/?PHPSESSID=fa90197ca25f6ab40bb1374c510d7a32&lt;/span&gt;&lt;/tt&gt; &#31561;&#65289;&#20013;&#20256;&#36882;&#20250;&#35805;&#26631;&#35782;&#31526;&#12290;&#25915;&#20987;&#32773;&#27450;&#39575;&#29992;&#25143;&#28857;&#20987;&#19968;&#20010;&#30828;&#32534;&#30721;&#20250;&#35805;ID&#30340;&#38142;&#25509;&#65292;&#36825;&#22238;&#23548;&#33268;&#29992;&#25143;&#36716;&#21040;&#37027;&#20010;&#20250;&#35805;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn84&quot;&gt;&#20250;&#35805;&#28382;&#30041;&#24050;&#32463;&#36816;&#29992;&#22312;&#38035;&#40060;&#25915;&#20987;&#20013;&#65292;&#20197;&#35825;&#39575;&#29992;&#25143;&#22312;&#25915;&#20987;&#32773;&#25317;&#26377;&#30340;&#36134;&#21495;&#37324;&#36755;&#20837;&#20854;&#20010;&#20154;&#20449;&#24687;&#12290; &#20182;&#21487;&#20197;&#31245;&#21518;&#30331;&#38470;&#36134;&#25143;&#24182;&#19988;&#26816;&#32034;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn85&quot;&gt;&lt;em&gt;&#20250;&#35805;&#20013;&#27602;&lt;/em&gt; &#65306;&#25915;&#20987;&#32773;&#36890;&#36807;&#29992;&#25143;&#25552;&#20132;&#35774;&#32622;&#20250;&#35805;&#25968;&#25454;&#30340;Web&#34920;&#21333;&#21521;&#35813;&#29992;&#25143;&#20250;&#35805;&#20013;&#27880;&#20837;&#28508;&#22312;&#21361;&#38505;&#25968;&#25454;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn86&quot;&gt;&#19968;&#20010;&#32463;&#20856;&#30340;&#20363;&#23376;&#23601;&#26159;&#19968;&#20010;&#31449;&#28857;&#22312;&#26576;&#20010;cookie&#20013;&#23384;&#20648;&#20102;&#31616;&#21333;&#30340;&#29992;&#25143;&#20559;&#22909;&#65288;&#27604;&#22914;&#19968;&#20010;&#39029;&#38754;&#32972;&#26223;&#39068;&#33394;&#65289;&#12290; &#25915;&#20987;&#32773;&#21487;&#20197;&#35825;&#39575;&#29992;&#25143;&#28857;&#20987;&#19968;&#20010;&#38142;&#25509;&#26469;&#25552;&#20132;&#32972;&#26223;&#39068;&#33394;&#65292;&#23454;&#38469;&#19978;&#21253;&#21547;&#20102;&#19968;&#20010;XSS&#25915;&#20987;&#12290; &#22914;&#26524;&#39068;&#33394;&#27809;&#26377;&#36716;&#20041;&#65292;&#37027;&#20040;&#23601;&#21487;&#20197;&#20877;&#25226;&#24694;&#24847;&#20195;&#30721;&#27880;&#20837;&#21040;&#29992;&#25143;&#29615;&#22659;&#20013;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;section&quot; id=&quot;id6&quot;&gt;
&lt;span id=&quot;cn87&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn87&quot;&gt;&#35299;&#20915;&#26041;&#26696;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn88&quot;&gt;&#26377;&#35768;&#22810;&#22522;&#26412;&#20934;&#21017;&#33021;&#22815;&#20445;&#25252;&#24744;&#19981;&#21463;&#21040;&#36825;&#20123;&#25915;&#20987;&#65306;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn89&quot;&gt;&#19981;&#35201;&#22312;URL&#20013;&#21253;&#21547;&#20219;&#20309;session&#20449;&#24687;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn90&quot;&gt;Django&#30340;session&#26694;&#26550;&#65288;&#21442;&#35265;` &#31532;&#21313;&#22235;&#31456; &amp;lt;../chapter14/&amp;gt;`__ &#65289;&#26681;&#26412;&#19981;&#20250;&#23481;&#35768;session&#21253;&#21547;&#22312;URL&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn91&quot;&gt;&#19981;&#35201;&#30452;&#25509;&#22312;cookie&#20013;&#20445;&#23384;&#25968;&#25454;&#12290; &#30456;&#21453;&#65292;&#23384;&#20648;&#19968;&#20010;&#22312;&#21518;&#21488;&#26144;&#23556;&#21040;session&#25968;&#25454;&#23384;&#20648;&#30340;session ID&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn92&quot;&gt;&#22914;&#26524;&#20351;&#29992;Django&#20869;&#32622;&#30340;session&#26694;&#26550;&#65288;&#21363; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;request.session&lt;/span&gt;&lt;/tt&gt; &#65289;&#65292;&#23427;&#20250;&#33258;&#21160;&#36827;&#34892;&#22788;&#29702;&#12290; &#36825;&#20010;session&#26694;&#26550;&#20165;&#22312;cookie&#20013;&#23384;&#20648;&#19968;&#20010;session ID&#65292;&#25152;&#26377;&#30340;session&#25968;&#25454;&#23558;&#20250;&#34987;&#23384;&#20648;&#22312;&#25968;&#25454;&#24211;&#20013;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn93&quot;&gt;&#22914;&#26524;&#38656;&#35201;&#22312;&#27169;&#26495;&#20013;&#26174;&#31034;session&#25968;&#25454;&#65292;&#35201;&#35760;&#24471;&#23545;&#20854;&#36827;&#34892;&#36716;&#20041;&#12290; &#21487;&#21442;&#32771;&#20043;&#21069;&#30340;XSS&#37096;&#20998;&#65292;&#23545;&#25152;&#26377;&#29992;&#25143;&#25552;&#20132;&#30340;&#25968;&#25454;&#21644;&#27983;&#35272;&#22120;&#25552;&#20132;&#30340;&#25968;&#25454;&#36827;&#34892;&#36716;&#20041;&#12290; &#23545;&#20110;session&#20449;&#24687;&#65292;&#24212;&#35813;&#20687;&#29992;&#25143;&#25552;&#20132;&#30340;&#25968;&#25454;&#19968;&#26679;&#23545;&#20854;&#36827;&#34892;&#22788;&#29702;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn94&quot;&gt;&#20219;&#20309;&#21487;&#33021;&#30340;&#22320;&#26041;&#37117;&#35201;&#38450;&#27490;&#25915;&#20987;&#32773;&#36827;&#34892;session&#27450;&#39575;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn95&quot;&gt;&#23613;&#31649;&#21435;&#25506;&#27979;&#31350;&#31455;&#26159;&#35841;&#21163;&#25345;&#20102;&#20250;&#35805;ID&#26159;&#20960;&#20046;&#19981;&#21487;&#33021;&#30340;&#20107;&#20799;&#65292;Django&#36824;&#26159;&#20869;&#32622;&#20102;&#20445;&#25252;&#25514;&#26045;&#26469;&#25269;&#24481;&#26292;&#21147;&#20250;&#35805;&#25915;&#20987;&#12290; &#20250;&#35805;ID&#34987;&#23384;&#22312;&#21704;&#24076;&#34920;&#37324;&#65288;&#21462;&#20195;&#20102;&#24207;&#21015;&#25968;&#23383;&#65289;&#65292;&#36825;&#26679;&#23601;&#38459;&#27490;&#20102;&#26292;&#21147;&#25915;&#20987;&#65292;&#24182;&#19988;&#22914;&#26524;&#19968;&#20010;&#29992;&#25143;&#21435;&#23581;&#35797;&#19968;&#20010;&#19981;&#23384;&#22312;&#30340;&#20250;&#35805;&#37027;&#20040;&#22905;&#24635;&#26159;&#20250;&#24471;&#21040;&#19968;&#20010;&#26032;&#30340;&#20250;&#35805;ID&#65292;&#36825;&#26679;&#23601;&#38459;&#27490;&#20102;&#20250;&#35805;&#28382;&#30041;&#12290;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn96&quot;&gt;&#35831;&#27880;&#24847;&#65292;&#20197;&#19978;&#27809;&#26377;&#19968;&#31181;&#20934;&#21017;&#21644;&#24037;&#20855;&#33021;&#22815;&#38459;&#27490;&#20013;&#38388;&#20154;&#25915;&#20987;&#12290; &#36825;&#20123;&#31867;&#22411;&#30340;&#25915;&#20987;&#26159;&#20960;&#20046;&#19981;&#21487;&#33021;&#34987;&#25506;&#27979;&#30340;&#12290; &#22914;&#26524;&#20320;&#30340;&#31449;&#28857;&#20801;&#35768;&#30331;&#38470;&#29992;&#25143;&#21435;&#26597;&#30475;&#20219;&#24847;&#25935;&#24863;&#25968;&#25454;&#30340;&#35805;&#65292;&#20320;&#24212;&#35813; &lt;em&gt;&#24635;&#26159;&lt;/em&gt; &#36890;&#36807;HTTPS&#26469;&#25552;&#20379;&#32593;&#31449;&#26381;&#21153;&#12290;
&#27492;&#22806;&#65292;&#22914;&#26524;&#20320;&#30340;&#31449;&#28857;&#20351;&#29992;SSL&#65292;&#20320;&#24212;&#35813;&#23558; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SESSION_COOKIE_SECURE&lt;/span&gt;&lt;/tt&gt; &#35774;&#32622;&#20026; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;True&lt;/span&gt;&lt;/tt&gt; &#65292;&#36825;&#26679;&#23601;&#33021;&#22815;&#20351;Django&#21482;&#36890;&#36807;HTTPS&#21457;&#36865;&#20250;&#35805;cookie&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id7&quot;&gt;
&lt;span id=&quot;cn97&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn97&quot;&gt;&#37038;&#20214;&#22836;&#37096;&#27880;&#20837;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn98&quot;&gt;&lt;em&gt;&#37038;&#20214;&#22836;&#37096;&#27880;&#20837;&lt;/em&gt; &#65306;SQL&#27880;&#20837;&#30340;&#20804;&#24351;&#65292;&#26159;&#19968;&#31181;&#36890;&#36807;&#21163;&#25345;&#21457;&#36865;&#37038;&#20214;&#30340;Web&#34920;&#21333;&#30340;&#25915;&#20987;&#26041;&#24335;&#12290; &#25915;&#20987;&#32773;&#33021;&#22815;&#21033;&#29992;&#36825;&#31181;&#25216;&#26415;&#26469;&#36890;&#36807;&#20320;&#30340;&#37038;&#20214;&#26381;&#21153;&#22120;&#21457;&#36865;&#22403;&#22334;&#37038;&#20214;&#12290; &#22312;&#36825;&#31181;&#25915;&#20987;&#38754;&#21069;&#65292;&#20219;&#20309;&#26041;&#24335;&#30340;&#26469;&#33258;Web&#34920;&#21333;&#25968;&#25454;&#30340;&#37038;&#20214;&#22836;&#37096;&#26500;&#31569;&#37117;&#26159;&#38750;&#24120;&#33030;&#24369;&#30340;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn99&quot;&gt;&#35753;&#25105;&#20204;&#30475;&#30475;&#22312;&#25105;&#20204;&#35768;&#22810;&#32593;&#31449;&#20013;&#21457;&#29616;&#30340;&#36825;&#31181;&#25915;&#20987;&#30340;&#24418;&#24335;&#12290; &#36890;&#24120;&#36825;&#31181;&#25915;&#20987;&#20250;&#21521;&#30828;&#32534;&#30721;&#37038;&#20214;&#22320;&#22336;&#21457;&#36865;&#19968;&#20010;&#28040;&#24687;&#65292;&#22240;&#27492;&#65292;&#31532;&#19968;&#30524;&#30475;&#19978;&#21435;&#24182;&#19981;&#26174;&#24471;&#20687;&#38754;&#23545;&#22403;&#22334;&#37038;&#20214;&#37027;&#20040;&#33030;&#24369;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn100&quot;&gt;&#20294;&#26159;&#65292;&#22823;&#22810;&#25968;&#34920;&#21333;&#37117;&#20801;&#35768;&#29992;&#25143;&#36755;&#20837;&#33258;&#24049;&#30340;&#37038;&#20214;&#20027;&#39064;&#65288;&#21516;&#26102;&#36824;&#26377;from&#22320;&#22336;&#65292;&#37038;&#20214;&#20307;&#65292;&#26377;&#26102;&#36824;&#26377;&#37096;&#20998;&#20854;&#20182;&#23383;&#27573;&#65289;&#12290; &#36825;&#20010;&#20027;&#39064;&#23383;&#27573;&#34987;&#29992;&#26469;&#26500;&#24314;&#37038;&#20214;&#28040;&#24687;&#30340;&#20027;&#39064;&#22836;&#37096;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn101&quot;&gt;&#22914;&#26524;&#37027;&#20010;&#37038;&#20214;&#22836;&#37096;&#22312;&#26500;&#24314;&#37038;&#20214;&#20449;&#24687;&#26102;&#27809;&#26377;&#34987;&#36716;&#20041;&#65292;&#37027;&#20040;&#25915;&#20987;&#32773;&#21487;&#20197;&#25552;&#20132;&#31867;&#20284; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;hello\ncc:spamvictim@example.com&quot;&lt;/span&gt;&lt;/tt&gt; &#65288;&#36825;&#37324;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;/tt&gt; &#26159;&#25442;&#34892;&#31526;&#65289;&#30340;&#19996;&#35199;&#12290; &#36825;&#26377;&#21487;&#33021;&#20351;&#24471;&#25152;&#26500;&#24314;&#30340;&#37038;&#20214;&#22836;&#37096;&#21464;&#25104;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn103&quot;&gt;To: hardcoded@example.com
Subject: hello
cc: spamvictim@example.com
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn104&quot;&gt;&#23601;&#20687;SQL&#27880;&#20837;&#37027;&#26679;&#65292;&#22914;&#26524;&#25105;&#20204;&#20449;&#20219;&#20102;&#29992;&#25143;&#25552;&#20379;&#30340;&#20027;&#39064;&#34892;&#65292;&#37027;&#26679;&#21516;&#26679;&#20063;&#20250;&#20801;&#35768;&#20182;&#26500;&#24314;&#19968;&#20010;&#22836;&#37096;&#24694;&#24847;&#38598;&#65292;&#20182;&#20063;&#23601;&#33021;&#22815;&#21033;&#29992;&#32852;&#31995;&#20154;&#34920;&#21333;&#26469;&#21457;&#36865;&#22403;&#22334;&#37038;&#20214;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id8&quot;&gt;
&lt;span id=&quot;cn105&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn105&quot;&gt;&#35299;&#20915;&#26041;&#26696;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn106&quot;&gt;&#25105;&#20204;&#33021;&#22815;&#37319;&#29992;&#19982;&#38459;&#27490;SQL&#27880;&#20837;&#30456;&#21516;&#30340;&#26041;&#24335;&#26469;&#38459;&#27490;&#36825;&#31181;&#25915;&#20987;&#65306; &#24635;&#26159;&#26657;&#39564;&#25110;&#32773;&#36716;&#20041;&#29992;&#25143;&#25552;&#20132;&#30340;&#20869;&#23481;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn107&quot;&gt;Django&#20869;&#24314;&#37038;&#20214;&#21151;&#33021;&#65288;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.core.mail&lt;/span&gt;&lt;/tt&gt; &#20013;&#65289;&#26681;&#26412;&#19981;&#20801;&#35768;&#22312;&#29992;&#26469;&#26500;&#24314;&#37038;&#20214;&#22836;&#37096;&#30340;&#23383;&#27573;&#20013;&#23384;&#22312;&#25442;&#34892;&#31526;&#65288;&#34920;&#21333;&#65292;&#25910;&#20214;&#22320;&#22336;&#65292;&#36824;&#26377;&#20027;&#39064;&#65289;&#12290; &#22914;&#26524;&#24744;&#35797;&#22270;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.core.mail.send_mail&lt;/span&gt;&lt;/tt&gt; &#26469;&#22788;&#29702;&#21253;&#21547;&#25442;&#34892;&#31526;&#30340;&#20027;&#39064;&#26102;&#65292;Django&#23558;&#20250;&#25243;&#20986;BadHeaderError&#24322;&#24120;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn108&quot;&gt;&#22914;&#26524;&#20320;&#27809;&#26377;&#20351;&#29992;Django&#20869;&#24314;&#37038;&#20214;&#21151;&#33021;&#26469;&#21457;&#36865;&#37038;&#20214;&#65292;&#37027;&#20040;&#20320;&#38656;&#35201;&#30830;&#20445;&#21253;&#21547;&#22312;&#37038;&#20214;&#22836;&#37096;&#30340;&#25442;&#34892;&#31526;&#33021;&#22815;&#24341;&#21457;&#38169;&#35823;&#25110;&#32773;&#34987;&#21435;&#25481;&#12290; &#20320;&#25110;&#35768;&#24819;&#20180;&#32454;&#38405;&#35835; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.core.mail&lt;/span&gt;&lt;/tt&gt; &#20013;&#30340; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SateMIMEText&lt;/span&gt;&lt;/tt&gt; &#31867;&#26469;&#30475;&#30475;Django&#26159;&#22914;&#20309;&#20570;&#21040;&#36825;&#19968;&#28857;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id9&quot;&gt;
&lt;span id=&quot;cn109&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn109&quot;&gt;&#30446;&#24405;&#36941;&#21382;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn110&quot;&gt;&lt;em&gt;&#30446;&#24405;&#36941;&#21382;&lt;/em&gt; &#65306;&#26159;&#21478;&#22806;&#19968;&#31181;&#27880;&#20837;&#26041;&#24335;&#30340;&#25915;&#20987;&#65292;&#22312;&#36825;&#31181;&#25915;&#20987;&#20013;&#65292;&#24694;&#24847;&#29992;&#25143;&#35825;&#39575;&#25991;&#20214;&#31995;&#32479;&#20195;&#30721;&#23545;Web&#26381;&#21153;&#22120;&#19981;&#24212;&#35813;&#35775;&#38382;&#30340;&#25991;&#20214;&#36827;&#34892;&#35835;&#21462;&#21644;/&#25110;&#20889;&#20837;&#25805;&#20316;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn111&quot;&gt;&#20363;&#23376;&#21487;&#20197;&#26159;&#36825;&#26679;&#30340;&#65292;&#26576;&#20010;&#35270;&#22270;&#35797;&#22270;&#22312;&#27809;&#26377;&#20180;&#32454;&#23545;&#25991;&#20214;&#36827;&#34892;&#38450;&#27602;&#22788;&#29702;&#30340;&#24773;&#20917;&#19979;&#20174;&#30913;&#30424;&#19978;&#35835;&#21462;&#25991;&#20214;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn113&quot;&gt;def dump_file(request):
    filename = request.GET[&quot;filename&quot;]
    filename = os.path.join(BASE_PATH, filename)
    content = open(filename).read()

    # ...
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn114&quot;&gt;&#23613;&#31649;&#19968;&#30524;&#30475;&#19978;&#21435;&#65292;&#35270;&#22270;&#36890;&#36807; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BASE_PATH&lt;/span&gt;&lt;/tt&gt; &#65288;&#36890;&#36807;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;os.path.join&lt;/span&gt;&lt;/tt&gt; &#65289;&#38480;&#21046;&#20102;&#23545;&#20110;&#25991;&#20214;&#30340;&#35775;&#38382;&#65292;&#20294;&#22914;&#26524;&#25915;&#20987;&#32773;&#20351;&#29992;&#20102;&#21253;&#21547; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;..&lt;/span&gt;&lt;/tt&gt; &#65288;&#20004;&#20010;&#21477;&#21495;&#65292;&#29238;&#30446;&#24405;&#30340;&#19968;&#31181;&#31616;&#20889;&#24418;&#24335;&#65289;&#30340;&#25991;&#20214;&#21517;&#65292;&#22905;&#23601;&#33021;&#22815;&#35775;&#38382;&#21040; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;BASE_PATH&lt;/span&gt;&lt;/tt&gt; &#30446;&#24405;&#32467;&#26500;&#20197;&#19978;&#30340;&#25991;&#20214;&#12290;&#23545;&#22905;&#26469;&#35828;&#65292;&#21457;&#29616;&#31350;&#31455;&#20351;&#29992;&#20960;&#20010;&#28857;&#21495;&#21482;&#26159;&#26102;&#38388;&#38382;&#39064;&#65292;&#27604;&#22914;&#36825;&#26679;&#65306;&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;../../../../../etc/passwd&lt;/span&gt;&lt;/tt&gt;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn115&quot;&gt;&#20219;&#20309;&#19981;&#20570;&#36866;&#24403;&#36716;&#20041;&#22320;&#35835;&#21462;&#25991;&#20214;&#25805;&#20316;&#65292;&#37117;&#21487;&#33021;&#23548;&#33268;&#36825;&#26679;&#30340;&#38382;&#39064;&#12290; &#20801;&#35768; &lt;em&gt;&#20889;&lt;/em&gt; &#25805;&#20316;&#30340;&#35270;&#22270;&#21516;&#26679;&#23481;&#26131;&#21457;&#29983;&#38382;&#39064;&#65292;&#32780;&#19988;&#32467;&#26524;&#24448;&#24448;&#26356;&#21152;&#21487;&#24597;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn116&quot;&gt;&#36825;&#20010;&#38382;&#39064;&#30340;&#21478;&#19968;&#31181;&#34920;&#29616;&#24418;&#24335;&#65292;&#20986;&#29616;&#22312;&#26681;&#25454;URL&#21644;&#20854;&#20182;&#30340;&#35831;&#27714;&#20449;&#24687;&#21160;&#24577;&#22320;&#21152;&#36733;&#27169;&#22359;&#12290; &#19968;&#20010;&#20247;&#25152;&#21608;&#30693;&#30340;&#20363;&#23376;&#26469;&#33258;&#20110;Ruby on Rails&#12290; &#22312;2006&#24180;&#19978;&#21322;&#24180;&#20043;&#21069;&#65292;Rails&#20351;&#29992;&#31867;&#20284;&#20110; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;http://example.com/person/poke/1&lt;/span&gt;&lt;/tt&gt; &#36825;&#26679;&#30340;URL&#30452;&#25509;&#21152;&#36733;&#27169;&#22359;&#21644;&#35843;&#29992;&#20989;&#25968;&#12290; &#32467;&#26524;&#26159;&#65292;&#31934;&#24515;&#26500;&#36896;&#30340;URL&#65292;&#21487;&#20197;&#33258;&#21160;&#22320;&#35843;&#29992;&#20219;&#24847;&#30340;&#20195;&#30721;&#65292;&#21253;&#25324;&#25968;&#25454;&#24211;&#30340;&#28165;&#31354;&#33050;&#26412;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id10&quot;&gt;
&lt;span id=&quot;cn117&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn117&quot;&gt;&#35299;&#20915;&#26041;&#26696;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn118&quot;&gt;&#22914;&#26524;&#20320;&#30340;&#20195;&#30721;&#38656;&#35201;&#26681;&#25454;&#29992;&#25143;&#30340;&#36755;&#20837;&#26469;&#35835;&#20889;&#25991;&#20214;&#65292;&#20320;&#23601;&#38656;&#35201;&#30830;&#20445;&#65292;&#25915;&#20987;&#32773;&#19981;&#33021;&#35775;&#38382;&#20320;&#25152;&#31105;&#27490;&#35775;&#38382;&#30340;&#30446;&#24405;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn119&quot;&gt;&#22791;&#27880;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn120&quot;&gt;&#19981;&#29992;&#22810;&#35828;&#65292;&#20320; &lt;em&gt;&#27704;&#36828;&lt;/em&gt; &#19981;&#35201;&#22312;&#32534;&#20889;&#21487;&#20197;&#35835;&#21462;&#20219;&#20309;&#20301;&#32622;&#19978;&#30340;&#25991;&#20214;&#30340;&#20195;&#30721;&#65281;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn121&quot;&gt;Django&#20869;&#32622;&#30340;&#38745;&#24577;&#20869;&#23481;&#35270;&#22270;&#26159;&#20570;&#36716;&#20041;&#30340;&#19968;&#20010;&#22909;&#30340;&#31034;&#20363;&#65288;&#22312; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;django.views.static&lt;/span&gt;&lt;/tt&gt; &#20013;&#65289;&#12290;&#36825;&#26159;&#30456;&#20851;&#20195;&#30721;&#65306;&lt;/p&gt;
&lt;pre class=&quot;cn literal-block&quot; id=&quot;cn123&quot;&gt;import os
import posixpath

# ...

path = posixpath.normpath(urllib.unquote(path))
newpath = &apos;&apos;
for part in path.split(&apos;/&apos;):
    if not part:
        # strip empty path components
        continue

    drive, part = os.path.splitdrive(part)
    head, part = os.path.split(part)
    if part in (os.curdir, os.pardir):
        # strip &apos;.&apos; and &apos;..&apos; in path
        continue

    newpath = os.path.join(newpath, part).replace(&apos;\\&apos;, &apos;/&apos;)
&lt;/pre&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn124&quot;&gt;Django&#19981;&#35835;&#21462;&#25991;&#20214;&#65288;&#38500;&#38750;&#20320;&#20351;&#29992; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;static.serve&lt;/span&gt;&lt;/tt&gt; &#20989;&#25968;&#65292;&#20294;&#20063;&#21463;&#21040;&#20102;&#19978;&#38754;&#36825;&#27573;&#20195;&#30721;&#30340;&#20445;&#25252;&#65289;&#65292;&#22240;&#27492;&#36825;&#31181;&#21361;&#38505;&#23545;&#20110;&#26680;&#24515;&#20195;&#30721;&#30340;&#24433;&#21709;&#23601;&#35201;&#23567;&#24471;&#22810;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn125&quot;&gt;&#26356;&#36827;&#19968;&#27493;&#65292;URLconf&#25277;&#35937;&#23618;&#30340;&#20351;&#29992;&#65292;&#24847;&#21619;&#30528;&#19981;&#32463;&#36807;&#20320;&#26126;&#30830;&#30340;&#25351;&#23450;&#65292;Django &lt;em&gt;&#20915;&#19981;&#20250;&lt;/em&gt; &#35013;&#36733;&#20195;&#30721;&#12290; &#36890;&#36807;&#21019;&#24314;&#19968;&#20010;URL&#26469;&#35753;Django&#35013;&#36733;&#27809;&#26377;&#22312;URLconf&#20013;&#20986;&#29616;&#30340;&#19996;&#35199;&#65292;&#26159;&#19981;&#21487;&#33021;&#21457;&#29983;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id11&quot;&gt;
&lt;span id=&quot;cn126&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn126&quot;&gt;&#26292;&#38706;&#38169;&#35823;&#28040;&#24687;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn127&quot;&gt;&#22312;&#24320;&#21457;&#36807;&#31243;&#20013;&#65292;&#36890;&#36807;&#27983;&#35272;&#22120;&#26816;&#26597;&#38169;&#35823;&#21644;&#36319;&#36394;&#24322;&#24120;&#26159;&#38750;&#24120;&#26377;&#29992;&#30340;&#12290; Django&#25552;&#20379;&#20102;&#28418;&#20142;&#19988;&#35814;&#32454;&#30340;debug&#20449;&#24687;&#65292;&#20351;&#24471;&#35843;&#35797;&#36807;&#31243;&#26356;&#21152;&#23481;&#26131;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn128&quot;&gt;&#28982;&#32780;&#65292;&#19968;&#26086;&#22312;&#31449;&#28857;&#19978;&#32447;&#20197;&#21518;&#65292;&#36825;&#20123;&#28040;&#24687;&#20173;&#28982;&#34987;&#26174;&#31034;&#65292;&#23427;&#20204;&#23601;&#21487;&#33021;&#26292;&#38706;&#20320;&#30340;&#20195;&#30721;&#25110;&#32773;&#26159;&#37197;&#32622;&#25991;&#20214;&#20869;&#23481;&#32473;&#25915;&#20987;&#32773;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn129&quot;&gt;&#36824;&#26377;&#65292;&#38169;&#35823;&#21644;&#35843;&#35797;&#28040;&#24687;&#23545;&#20110;&#26368;&#32456;&#29992;&#25143;&#32780;&#35328;&#26159;&#27627;&#26080;&#29992;&#22788;&#30340;&#12290; Django&#30340;&#29702;&#24565;&#26159;&#65292;&#31449;&#28857;&#30340;&#35775;&#38382;&#32773;&#27704;&#36828;&#19981;&#24212;&#35813;&#30475;&#21040;&#19982;&#24212;&#29992;&#30456;&#20851;&#30340;&#20986;&#38169;&#28040;&#24687;&#12290; &#22914;&#26524;&#20320;&#30340;&#20195;&#30721;&#25243;&#20986;&#20102;&#19968;&#20010;&#27809;&#26377;&#22788;&#29702;&#30340;&#24322;&#24120;&#65292;&#32593;&#31449;&#35775;&#38382;&#32773;&#19981;&#24212;&#35813;&#30475;&#21040;&#35843;&#35797;&#20449;&#24687;&#25110;&#32773; &lt;em&gt;&#20219;&#20309;&lt;/em&gt; &#20195;&#30721;&#29255;&#27573;&#25110;&#32773;Python&#65288;&#38754;&#21521;&#24320;&#21457;&#32773;&#65289;&#20986;&#38169;&#28040;&#24687;&#12290; &#35775;&#38382;&#32773;&#24212;&#35813;&#21482;&#30475;&#21040;&#21451;&#22909;&#30340;&#26080;&#27861;&#35775;&#38382;&#30340;&#39029;&#38754;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn130&quot;&gt;&#24403;&#28982;&#65292;&#24320;&#21457;&#32773;&#38656;&#35201;&#22312;debug&#26102;&#30475;&#21040;&#35843;&#35797;&#20449;&#24687;&#12290; &#22240;&#27492;&#65292;&#26694;&#26550;&#23601;&#35201;&#23558;&#36825;&#20123;&#20986;&#38169;&#28040;&#24687;&#26174;&#31034;&#32473;&#21463;&#20449;&#20219;&#30340;&#32593;&#31449;&#24320;&#21457;&#32773;&#65292;&#32780;&#35201;&#21521;&#20844;&#20247;&#38544;&#34255;&#12290;&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;id12&quot;&gt;
&lt;span id=&quot;cn131&quot;&gt;&lt;/span&gt;&lt;h3 class=&quot;cn&quot; id=&quot;cn131&quot;&gt;&#35299;&#20915;&#26041;&#26696;&lt;/h3&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn132&quot;&gt;&#27491;&#22914;&#25105;&#20204;&#22312;&#31532;12&#31456;&#25152;&#25552;&#21040;&#30340;&#65292;Django&#30340;`` DEBUG`` &#35774;&#32622;&#25511;&#21046;&#36825;&#20123;&#38169;&#35823;&#20449;&#24687;&#30340;&#26174;&#31034;&#12290; &#24403;&#20320;&#20934;&#22791;&#37096;&#32626;&#26102;&#35831;&#30830;&#35748;&#25226;&#36825;&#20010;&#35774;&#32622;&#20026;&#65306;`` False`` &#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn133&quot;&gt;&#22312;Apache&#21644;mod_python&#19979;&#24320;&#21457;&#30340;&#20154;&#21592;&#65292;&#36824;&#35201;&#20445;&#35777;&#22312;Apache&#30340;&#37197;&#32622;&#25991;&#20214;&#20013;&#20851;&#38381; &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PythonDebug&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;Off&lt;/span&gt;&lt;/tt&gt; &#36873;&#39033;&#65292;&#36825;&#20010;&#20250;&#22312;Django&#34987;&#21152;&#36733;&#20197;&#21069;&#21435;&#38500;&#20986;&#38169;&#28040;&#24687;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id13&quot;&gt;
&lt;span id=&quot;cn134&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn134&quot;&gt;&#23433;&#20840;&#39046;&#22495;&#30340;&#24635;&#32467;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn135&quot;&gt;&#25105;&#20204;&#24076;&#26395;&#20851;&#20110;&#23433;&#20840;&#38382;&#39064;&#30340;&#35752;&#35770;&#65292;&#19981;&#20250;&#22826;&#35753;&#20320;&#24863;&#21040;&#24656;&#24908;&#12290; Web&#26159;&#19968;&#20010;&#22788;&#22788;&#24067;&#28385;&#38519;&#38449;&#30340;&#19990;&#30028;&#65292;&#20294;&#26159;&#21482;&#35201;&#26377;&#19968;&#20123;&#36828;&#35265;&#65292;&#20320;&#23601;&#33021;&#25317;&#26377;&#23433;&#20840;&#30340;&#31449;&#28857;&#12290;&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn136&quot;&gt;&#27704;&#36828;&#35760;&#20303;&#65292;Web&#23433;&#20840;&#26159;&#19968;&#20010;&#19981;&#26029;&#21457;&#23637;&#30340;&#39046;&#22495;&#12290;&#22914;&#26524;&#20320;&#27491;&#22312;&#38405;&#35835;&#36825;&#26412;&#20070;&#30340;&#20572;&#27490;&#32500;&#25252;&#30340;&#37027;&#20123;&#29256;&#26412;&#65292;&#35831;&#38405;&#35835;&#26368;&#26032;&#29256;&#26412;&#30340;&#36825;&#20010;&#37096;&#20998;&#26469;&#26816;&#26597;&#26368;&#26032;&#21457;&#29616;&#30340;&#28431;&#27934;&#12290; &#20107;&#23454;&#19978;&#65292;&#27599;&#21608;&#25110;&#32773;&#27599;&#26376;&#33457;&#28857;&#26102;&#38388;&#25366;&#25496;Web&#24212;&#29992;&#23433;&#20840;&#65292;&#24182;&#19988;&#36319;&#19978;&#26368;&#26032;&#30340;&#21160;&#24577;&#26159;&#19968;&#20010;&#24456;&#22909;&#30340;&#20027;&#24847;&#12290; &#33457;&#36153;&#24456;&#23569;&#65292;&#20294;&#26159;&#23545;&#20320;&#32593;&#31449;&#21644;&#29992;&#25143;&#30340;&#20445;&#25252;&#30830;&#26159;&#26080;&#20215;&#30340;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;id14&quot;&gt;
&lt;span id=&quot;cn137&quot;&gt;&lt;/span&gt;&lt;h2 class=&quot;cn&quot; id=&quot;cn137&quot;&gt;&#25509;&#19979;&#26469;&#65311;&lt;/h2&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn138&quot;&gt;&#20320;&#24050;&#32463;&#23436;&#25104;&#20102;&#25105;&#20204;&#23433;&#25490;&#30340;&#31243;&#24207;&#12290; &#20197;&#19979;&#30340;&#38468;&#24405;&#20869;&#23481;&#20013;&#21253;&#21547;&#20102;&#21487;&#33021;&#22312;&#20320;&#30340;Djang&#39033;&#30446;&#20013;&#29992;&#24471;&#19978;&#30340;&#24341;&#29992;&#36164;&#28304;.&lt;/p&gt;
&lt;p class=&quot;cn&quot; id=&quot;cn139&quot;&gt;&#22312;&#36816;&#34892;&#20320;&#30340;Django&#32593;&#31449;&#26102;&#65292;&#26080;&#35770;&#26159;&#20026;&#20320;&#25110;&#20960;&#20010;&#26379;&#21451;&#30340;&#23567;&#32593;&#31449;&#65292;&#25110;&#32773;&#26159;&#19979;&#19968;&#20010;google&#65292;&#25105;&#20204;&#31069;&#20320;&#22909;&#36816;&#12290;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    
    &lt;/div&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/bxjdental/entry/1405085311347</id>
        <title type="html">1405085311347</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/bxjdental/entry/1405085311347"/>
        <published>2014-07-11T21:30:18+08:00</published>
        <updated>2014-07-11T21:30:18+08:00</updated> 
        <category term="/Services" label="services" />
        <summary type="html">&#27927;&#29273;&#65306;&#26159;&#25351;&#29992;&#27905;&#27835;&#22120;&#26800;&#21435;&#38500;&#29273;&#32467;&#30707;&#12289;&#33740;&#26001;&#21644;&#29273;&#38754;&#19978;&#27785;&#31215;&#30340;&#33394;&#32032;&#65292;&#24182;&#25243;&#20809;&#29273;&#38754;&#65292;&#20197;&#24310;&#36831;&#33740;&#26001;&#21644;&#29273;&#30707;&#20877;&#27785;&#31215;&#12290;
&#36229;&#22768;&#27905;&#29273;&#26426;&#30001;&#36229;&#22768;&#27874;&#21457;&#29983;&#22120;&#21644;&#25442;&#33021;&#22120;&#32452;&#25104;&#65292;&#21457;&#29983;&#22120;&#21457;&#20986;&#30005;&#30913;&#25391;&#33633;&#65292;&#24182;&#23558;&#21151;&#29575;&#25918;&#22823;&#65292;&#25442;&#33021;&#22120;&#23558;&#39640;&#39057;&#30005;&#33021;&#36716;&#25442;&#20026;&#36229;&#22768;&#25391;&#21160;&#65292;&#25391;&#21160;&#39057;&#29575;&#36798;2&#19975;&#33267;4.5&#19975;&#36203;&#20857;&#65292;&#36890;&#36807;&#25442;&#33021;&#22120;&#19978;&#24037;&#20316;&#22836;&#30340;&#39640;&#39057;&#25391;&#33633;&#23558;&#38468;&#30528;&#20110;&#29273;&#38754;&#19978;&#30340;&#29273;&#30707;&#21435;&#38500;&#12290;&#27492;&#22806;&#65292;&#36229;&#22768;&#27905;&#29273;&#26426;&#19978;&#36824;&#24102;&#26377;&#21943;&#27700;&#31995;&#32479;&#65292;&#22312;&#21551;&#21160;&#24037;&#20316;&#22836;&#36229;&#22768;&#25391;&#21160;&#26102;&#65292;&#21943;&#27700;&#31995;&#32479;&#21516;&#26102;&#21521;&#24037;&#20316;&#22836;&#21943;&#27700;&#65292;&#24418;&#25104;&#27668;&#38654;&#65292;&#19968;&#26041;&#38754;&#36215;&#21040;&#20919;&#21364;&#24037;&#20316;&#22836;&#30340;&#20316;&#29992;&#12290;&#12290;&#12290;&#12290;</summary>
        <content type="html">&lt;p&gt;&lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/52d6b90f-07eb-419c-b31d-a2dc0cfab197&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/52d6b90f-07eb-419c-b31d-a2dc0cfab197?t=true&quot; alt=&quot;945.jpeg&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
  &lt;p&gt;
&#27927;&#29273;&#65306;&#26159;&#25351;&#29992;&#27905;&#27835;&#22120;&#26800;&#21435;&#38500;&#29273;&#32467;&#30707;&#12289;&#33740;&#26001;&#21644;&#29273;&#38754;&#19978;&#27785;&#31215;&#30340;&#33394;&#32032;&#65292;&#24182;&#25243;&#20809;&#29273;&#38754;&#65292;&#20197;&#24310;&#36831;&#33740;&#26001;&#21644;&#29273;&#30707;&#20877;&#27785;&#31215;&#12290;
&#36229;&#22768;&#27905;&#29273;&#26426;&#30001;&#36229;&#22768;&#27874;&#21457;&#29983;&#22120;&#21644;&#25442;&#33021;&#22120;&#32452;&#25104;&#65292;&#21457;&#29983;&#22120;&#21457;&#20986;&#30005;&#30913;&#25391;&#33633;&#65292;&#24182;&#23558;&#21151;&#29575;&#25918;&#22823;&#65292;&#25442;&#33021;&#22120;&#23558;&#39640;&#39057;&#30005;&#33021;&#36716;&#25442;&#20026;&#36229;&#22768;&#25391;&#21160;&#65292;&#25391;&#21160;&#39057;&#29575;&#36798;2&#19975;&#33267;4.5&#19975;&#36203;&#20857;&#65292;&#36890;&#36807;&#25442;&#33021;&#22120;&#19978;&#24037;&#20316;&#22836;&#30340;&#39640;&#39057;&#25391;&#33633;&#23558;&#38468;&#30528;&#20110;&#29273;&#38754;&#19978;&#30340;&#29273;&#30707;&#21435;&#38500;&#12290;&#27492;&#22806;&#65292;&#36229;&#22768;&#27905;&#29273;&#26426;&#19978;&#36824;&#24102;&#26377;&#21943;&#27700;&#31995;&#32479;&#65292;&#22312;&#21551;&#21160;&#24037;&#20316;&#22836;&#36229;&#22768;&#25391;&#21160;&#26102;&#65292;&#21943;&#27700;&#31995;&#32479;&#21516;&#26102;&#21521;&#24037;&#20316;&#22836;&#21943;&#27700;&#65292;&#24418;&#25104;&#27668;&#38654;&#65292;&#19968;&#26041;&#38754;&#36215;&#21040;&#20919;&#21364;&#24037;&#20316;&#22836;&#30340;&#20316;&#29992;&#65292;&#21478;&#19968;&#37325;&#35201;&#26041;&#38754;&#26159;&#24418;&#25104;&#31354;&#31348;&#20316;&#29992;&#65292;&#21363;&#22312;&#21943;&#38654;&#30340;&#27700;&#28404;&#20869;&#26377;&#32454;&#24494;&#30340;&#30495;&#31354;&#27873;&#36805;&#36895;&#22604;&#38519;&#32780;&#20135;&#29983;&#33021;&#37327;&#65292;&#23545;&#29273;&#30707;&#12289;&#33740;&#26001;&#31561;&#20135;&#29983;&#20914;&#21047;&#20316;&#29992;&#65292;&#24182;&#23558;&#38663;&#30862;&#30340;&#29273;&#30707;&#21644;&#34880;&#27745;&#20914;&#36208;&#12290;
&#26377;&#20123;&#30149;&#20154;&#19981;&#36866;&#21512;&#24212;&#29992;&#36229;&#22768;&#27905;&#27835;&#12290;&#26377;&#20256;&#26579;&#24615;&#30142;&#30149;&#30340;&#24739;&#32773;&#22914;&#32467;&#26680;&#12289;&#20057;&#32925;&#25239;&#21407;&#38451;&#24615;&#12289;HIV&#24863;&#26579;&#31561;&#24739;&#32773;&#31105;&#29992;&#36229;&#22768;&#27905;&#29273;&#26426;&#65292;&#22240;&#20026;&#23427;&#25152;&#20135;&#29983;&#30340;&#21943;&#38654;&#20250;&#27745;&#26579;&#25805;&#20316;&#21306;&#21450;&#21608;&#22260;&#30340;&#29615;&#22659;&#12290;&#26377;&#21628;&#21560;&#31995;&#32479;&#30142;&#30149;&#30340;&#24739;&#32773;&#19981;&#24212;&#20351;&#29992;&#36229;&#22768;&#27905;&#29273;&#26426;&#12290;&#19968;&#33324;&#25140;&#24515;&#33039;&#36215;&#25615;&#22120;&#30340;&#24739;&#32773;&#31105;&#29992;&#36229;&#22768;&#27905;&#29273;&#26426;&#65292;&#20197;&#36991;&#20813;&#22240;&#24178;&#25200;&#36215;&#25615;&#22120;&#30340;&#24037;&#20316;&#32780;&#36896;&#25104;&#24739;&#32773;&#24515;&#24459;&#32010;&#20081;&#31561;&#30151;&#29366;&#12290;
&#27927;&#29273;&#19982;&#29273;&#40831;&#33073;&#33394;&#19981;&#21516;&#65292;&#27927;&#29273;&#24182;&#19981;&#33021;&#20351;&#29273;&#40831;&#26412;&#36523;&#21464;&#30333;&#65292;&#32780;&#26159;&#32500;&#25252;&#29273;&#21608;&#20581;&#24247;&#30340;&#19968;&#31181;&#20445;&#20581;&#27835;&#30103;&#25514;&#26045;&#12290;&#20294;&#27927;&#29273;&#21518;&#65292;&#30001;&#20110;&#38500;&#25481;&#20102;&#29273;&#40831;&#19978;&#30340;&#27745;&#22434;&#65292;&#30475;&#36215;&#26469;&#29273;&#40831;&#28165;&#27905;&#24178;&#20928;&#65292;&#21475;&#33108;&#24863;&#35273;&#20063;&#20250;&#36731;&#26494;&#33298;&#36866;&#12290;&#27927;&#29273;&#20250;&#23545;&#29273;&#40831;&#36896;&#25104;&#30005;&#38236;&#19979;&#21487;&#30475;&#21040;&#30340;&#32454;&#23567;&#30340;&#21010;&#30165;&#65292;&#20294;&#36825;&#26159;&#24456;&#36731;&#24494;&#30340;&#65292;&#23545;&#20110;&#29273;&#32467;&#30707;&#23548;&#33268;&#30340;&#23545;&#20154;&#20307;&#30340;&#21361;&#23475;&#26469;&#35828;&#36825;&#26159;&#24494;&#19981;&#36275;&#36947;&#30340;&#65292;&#32780;&#19988;&#19987;&#19994;&#30340;&#25163;&#27861;&#21644;&#36866;&#24403;&#30340;&#38663;&#21160;&#39057;&#29575;&#20250;&#25226;&#36825;&#31181;&#21361;&#23475;&#38477;&#21040;&#26368;&#20302;&#12290;&#25152;&#20197;&#65292;&#23545;&#27927;&#29273;&#30340;&#22330;&#25152;&#35201;&#24910;&#37325;&#36873;&#25321;&#65292;&#24212;&#35813;&#21040;&#27491;&#35268;&#21307;&#38498;&#25214;&#32463;&#36807;&#20005;&#26684;&#22521;&#35757;&#30340;&#21307;&#21153;&#20154;&#21592;&#26469;&#20026;&#24744;&#27927;&#29273;&#12290;&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/bxjdental/entry/1405085171367</id>
        <title type="html">1405085171367</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/bxjdental/entry/1405085171367"/>
        <published>2014-07-11T21:27:07+08:00</published>
        <updated>2014-07-11T21:27:07+08:00</updated> 
        <category term="/Services" label="services" />
        <summary type="html">&#29273;&#40831;&#26159;&#20154;&#20307;&#20013;&#26368;&#22362;&#30828;&#30340;&#22120;&#23448;&#65292;&#20998;&#20026;&#29273;&#20896;&#12289;&#29273;&#39048;&#21644;&#29273;&#26681;&#19977;&#37096;&#20998;&#12290;&#20174;&#22806;&#21521;&#20869;&#21448;&#20998;&#20026;&#29273;&#37321;&#36136;&#12289;&#29273;&#26412;&#36136;&#29273;&#39635;&#33108;&#12290;&#29273;&#39635;&#33108;&#65292;&#19979;&#37096;&#26377;&#31649;&#29366;&#30340;&#26681;&#31649;&#65292;&#30001;&#20043;&#23548;&#20986;&#29273;&#31070;&#32463;&#21644;&#33829;&#20859;&#31070;&#32463;&#30340;&#34880;&#31649;&#12290;&#20154;&#31867;&#19968;&#33324;&#27599;&#39063;&#29273;&#40831;&#26377;1-4&#20010;&#26681;&#31649;&#65292;&#21518;&#37096;&#30340;&#29273;&#40831;&#26681;&#31649;&#26368;&#22810;&#12290; &#29273;&#39635;&#21457;&#29983;&#24863;&#26579;&#26102;&#65292;&#20250;&#36896;&#25104;&#30140;&#30171;&#12289;&#39052;&#39592;&#24863;&#26579;&#31561;&#19968;&#31995;&#21015;&#24182;&#21457;&#30151;&#65292;&#24182;&#26368;&#32456;&#29273;&#40831;&#22240;&#20026;&#29273;&#31070;&#32463;&#30340;&#27515;&#20129;&#32780;&#21464;&#24471;&#33030;&#24369;&#12290; &#26681;&#31649;&#27835;&#30103;&#26415;&#65292;&#21448;&#31216;&#29273;&#39635;&#27835;&#30103;&#65292; &#26159;&#29273;&#21307;&#23398;&#20013;&#27835;&#30103;&#29273;&#39635;&#22351;&#27515;&#21644;&#29273;&#26681;&#24863;&#26579;&#30340;&#19968;&#31181;&#25163;&#26415;&#12290;&#35813;&#25163;&#26415;&#22312;&#35299;&#38500;&#24739;&#32773;&#30171;&#33510;&#30340;&#21516;&#26102;&#20445;&#30041;&#20102;&#29273;&#40831;&#65292;&#22240;&#32780;&#19982;&#25300;&#29273;&#26415;&#20114;&#34917;&#12290;</summary>
        <content type="html">&lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/c07f717e-69fd-402a-a043-a17df2fea3c3&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/c07f717e-69fd-402a-a043-a17df2fea3c3?t=true&quot; alt=&quot;122.jpeg&quot; /&gt;&lt;/a&gt;&#29273;&#40831;&#26159;&#20154;&#20307;&#20013;&#26368;&#22362;&#30828;&#30340;&#22120;&#23448;&#65292;&#20998;&#20026;&#29273;&#20896;&#12289;&#29273;&#39048;&#21644;&#29273;&#26681;&#19977;&#37096;&#20998;&#12290;&#20174;&#22806;&#21521;&#20869;&#21448;&#20998;&#20026;&#29273;&#37321;&#36136;&#12289;&#29273;&#26412;&#36136;&#29273;&#39635;&#33108;&#12290;&#29273;&#39635;&#33108;&#65292;&#19979;&#37096;&#26377;&#31649;&#29366;&#30340;&#26681;&#31649;&#65292;&#30001;&#20043;&#23548;&#20986;&#29273;&#31070;&#32463;&#21644;&#33829;&#20859;&#31070;&#32463;&#30340;&#34880;&#31649;&#12290;&#20154;&#31867;&#19968;&#33324;&#27599;&#39063;&#29273;&#40831;&#26377;1-4&#20010;&#26681;&#31649;&#65292;&#21518;&#37096;&#30340;&#29273;&#40831;&#26681;&#31649;&#26368;&#22810;&#12290; &#29273;&#39635;&#21457;&#29983;&#24863;&#26579;&#26102;&#65292;&#20250;&#36896;&#25104;&#30140;&#30171;&#12289;&#39052;&#39592;&#24863;&#26579;&#31561;&#19968;&#31995;&#21015;&#24182;&#21457;&#30151;&#65292;&#24182;&#26368;&#32456;&#29273;&#40831;&#22240;&#20026;&#29273;&#31070;&#32463;&#30340;&#27515;&#20129;&#32780;&#21464;&#24471;&#33030;&#24369;&#12290; &#26681;&#31649;&#27835;&#30103;&#26415;&#65292;&#21448;&#31216;&#29273;&#39635;&#27835;&#30103;&#65292; &#26159;&#29273;&#21307;&#23398;&#20013;&#27835;&#30103;&#29273;&#39635;&#22351;&#27515;&#21644;&#29273;&#26681;&#24863;&#26579;&#30340;&#19968;&#31181;&#25163;&#26415;&#12290;&#35813;&#25163;&#26415;&#22312;&#35299;&#38500;&#24739;&#32773;&#30171;&#33510;&#30340;&#21516;&#26102;&#20445;&#30041;&#20102;&#29273;&#40831;&#65292;&#22240;&#32780;&#19982;&#25300;&#29273;&#26415;&#20114;&#34917;&#12290;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/bxjdental/entry/1405085075462</id>
        <title type="html">1405085075462</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/bxjdental/entry/1405085075462"/>
        <published>2014-07-11T21:25:33+08:00</published>
        <updated>2014-07-11T21:25:33+08:00</updated> 
        <category term="/Services" label="services" />
        <content type="html">&lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/6399dc2d-28af-41e3-aec1-2ed7c5e46e80&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/6399dc2d-28af-41e3-aec1-2ed7c5e46e80?t=true&quot; alt=&quot;111.jpeg&quot; /&gt;&lt;/a&gt;
&#27963;&#21160;&#20041;&#40831;&#20854;&#19987;&#19994;&#21517;&#31216;&#26159;&#21487;&#25688;&#20041;&#40831;&#65292;&#21253;&#25324;&#21487;&#25688;&#23616;&#37096;&#20041;&#40831;&#21644;&#20840;&#21475;&#20041;&#40831;&#12290;&#26159;&#21033;&#29992;&#21097;&#20313;&#22825;&#28982;&#29273;&#12289;&#22522;&#25176;&#19979;&#30340;&#40655;&#33180;&#21644;&#39592;&#32452;&#32455;&#20316;&#20026;&#25903;&#25345;&#65292;&#20381;&#38752;&#20041;&#40831;&#30340;&#22266;&#20301;&#20307;&#21644;&#22522;&#25176;&#26469;&#22266;&#20301;&#65292;&#29992;&#20154;&#24037;&#29273;&#24674;&#22797;&#32570;&#22833;&#29273;&#30340;&#24418;&#24577;&#21644;&#21151;&#33021;&#65292;&#29992;&#22522;&#25176;&#26448;&#26009;&#24674;&#22797;&#32570;&#25439;&#30340;&#29273;&#27133;&#23924;&#12289;&#39052;&#39592;&#21450;&#20854;&#21608;&#22260;&#30340;&#36719;&#32452;&#32455;&#24418;&#24577;&#65292;&#24739;&#32773;&#21487;&#20197;&#33258;&#34892;&#25688;&#25140;&#30340;&#19968;&#31181;&#20462;&#22797;&#20307;&#12290;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/bxjdental/entry/1405084601949</id>
        <title type="html">1405084601949</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/bxjdental/entry/1405084601949"/>
        <published>2014-07-11T21:24:08+08:00</published>
        <updated>2014-07-11T21:24:08+08:00</updated> 
        <category term="/Services" label="services" />
        <summary type="html">&#38544;&#24418;&#20041;&#40831;&#26159;&#27963;&#21160;&#20041;&#40831;&#30340;&#19968;&#31181;&#65292;&#22240;&#20854;&#37319;&#29992;&#24377;&#24615;&#26641;&#33026;&#21345;&#29615;&#65292;&#20301;&#20110;&#22825;&#28982;&#29273;&#40840;&#32536;&#65292;&#20223;&#30495;&#24615;&#22909;&#65292;&#25925;&#24471;&#27492;&#32654;&#35465;&#12290;&#20854;&#29305;&#28857;&#26159;&#24378;&#24230;&#39640;&#12289;&#26377;&#36866;&#23452;&#30340;&#24377;&#24615;&#12289;&#36739;&#22909;&#30340;&#26580;&#38887;&#24615;&#21644;&#21322;&#36879;&#26126;&#24615;&#65292;&#20854;&#33394;&#27901;&#25509;&#36817;&#22825;&#28982;&#29273;&#40840;&#32452;&#32455;&#65292;&#20855;&#26377;&#33391;&#22909;&#30340;&#20223;&#29983;&#25928;&#26524;&#21644;&#24456;&#22909;&#30340;&#38544;&#34109;&#24615;&#12290;</summary>
        <content type="html">&lt;p&gt; &lt;/p&gt; 
  &lt;p&gt; &lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/e6b015f4-c14f-42ce-86ea-42e96129368b&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/e6b015f4-c14f-42ce-86ea-42e96129368b?t=true&quot; alt=&quot;332.jpeg&quot; /&gt;&lt;/a&gt;&lt;/p&gt; 
  &lt;p&gt;&#38544;&#24418;&#20041;&#40831;&#26159;&#27963;&#21160;&#20041;&#40831;&#30340;&#19968;&#31181;&#65292;&#22240;&#20854;&#37319;&#29992;&#24377;&#24615;&#26641;&#33026;&#21345;&#29615;&#65292;&#20301;&#20110;&#22825;&#28982;&#29273;&#40840;&#32536;&#65292;&#20223;&#30495;&#24615;&#22909;&#65292;&#25925;&#24471;&#27492;&#32654;&#35465;&#12290;&#20854;&#29305;&#28857;&#26159;&#24378;&#24230;&#39640;&#12289;&#26377;&#36866;&#23452;&#30340;&#24377;&#24615;&#12289;&#36739;&#22909;&#30340;&#26580;&#38887;&#24615;&#21644;&#21322;&#36879;&#26126;&#24615;&#65292;&#20854;&#33394;&#27901;&#25509;&#36817;&#22825;&#28982;&#29273;&#40840;&#32452;&#32455;&#65292;&#20855;&#26377;&#33391;&#22909;&#30340;&#20223;&#29983;&#25928;&#26524;&#21644;&#24456;&#22909;&#30340;&#38544;&#34109;&#24615;&#12290; &#38544;&#24418;&#20041;&#40831;&#20855;&#26377;&#39640;&#24377;&#24615;&#25239;&#25240;&#26029;&#65292;&#22522;&#25176;&#38544;&#24418;&#12289;&#32654;&#35266;&#65292;&#25805;&#20316;&#31616;&#20415;&#24555;&#25463;&#65292;&#23569;&#30952;&#29273;&#25110;&#19981;&#30952;&#29273;&#31561;&#20248;&#28857;&#12290;&#23588;&#20854;&#26159;&#21069;&#29273;&#21450;&#21069;&#30952;&#29273;&#32570;&#25439;&#65292;&#20256;&#32479;&#30340;&#21487;&#25688;&#20041;&#40831;&#30001;&#20110;&#26292;&#38706;&#37329;&#23646;&#21345;&#29615;&#24433;&#21709;&#32654;&#35266;&#65292;&#32780;&#38544;&#24418;&#20041;&#40831;&#22522;&#25176;&#38544;&#24418;&#65292;&#26448;&#26009;&#20855;&#26377;&#36739;&#39640;&#30340;&#25239;&#25240;&#24615;&#65292;&#21487;&#20197;&#20570;&#24471;&#34180;&#32780;&#33298;&#36866;&#65292;&#32780;&#19988;&#24377;&#24615;&#26448;&#26009;&#33021;&#36827;&#20837;&#22522;&#29273;&#20498;&#20985;&#21306;&#19982;&#31896;&#33180;&#23494;&#21512;&#24230;&#22909;&#65292;&#22266;&#20301;&#24615;&#22909;&#65292;&#21462;&#25140;&#26041;&#20415;&#12290;&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/bxjdental/entry/1405083797891</id>
        <title type="html">1405083797891</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/bxjdental/entry/1405083797891"/>
        <published>2014-07-11T21:05:08+08:00</published>
        <updated>2014-07-11T21:05:08+08:00</updated> 
        <category term="/Services" label="services" />
        <summary type="html">&#22266;&#23450;&#20041;&#40831;&#26159;&#20462;&#22797;&#29273;&#21015;&#20013;&#19968;&#20010;&#25110;&#20960;&#20010;&#32570;&#22833;&#29273;&#30340;&#20462;&#22797;&#20307;&#12290;&#38752;&#31896;&#32467;&#21058;&#25110;&#22266;&#23450;&#35013;&#32622;&#19982;&#32570;&#29273;&#20004;&#20391;&#39044;&#22791;&#22909;&#30340;&#22522;&#29273;&#25110;&#32773;&#31181;&#26893;&#20307;&#36830;&#22312;&#19968;&#36215;&#65292;&#20174;&#32780;&#24674;&#22797;&#32570;&#22833;&#29273;&#30340;&#35299;&#21078;&#24418;&#24577;&#19982;&#29983;&#29702;&#21151;&#33021;&#12290;&#30001;&#20110;&#36825;&#31181;&#20462;&#22797;&#20307;&#24739;&#32773;&#19981;&#33021;&#33258;&#34892;&#21462;&#25140;&#65292;&#22266;&#31616;&#31216;&#20026;&#22266;&#23450;&#20041;&#40831;&#12290;</summary>
        <content type="html">&lt;p&gt;&lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/668ca217-06fd-49aa-9401-e519391ab311&quot;&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/668ca217-06fd-49aa-9401-e519391ab311?t=true&quot; alt=&quot;yatao.jpeg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span style=&quot;font-size: 10.5pt; font-family: &#23435;&#20307;; color: #333333;&quot;&gt;&#22266;&#23450;&#20041;&#40831;&#26159;&#20462;&#22797;&#29273;&#21015;&#20013;&#19968;&#20010;&#25110;&#20960;&#20010;&#32570;&#22833;&#29273;&#30340;&#20462;&#22797;&#20307;&#12290;&#38752;&#31896;&#32467;&#21058;&#25110;&#22266;&#23450;&#35013;&#32622;&#19982;&lt;/span&gt;&lt;span style=&quot;font-size: 10.5pt; font-family: &#23435;&#20307;;&quot;&gt;&#32570;&#29273;&lt;/span&gt;&lt;span style=&quot;font-size: 10.5pt; font-family: &#23435;&#20307;; color: #333333;&quot;&gt;&#20004;&#20391;&#39044;&#22791;&#22909;&#30340;&#22522;&#29273;&#25110;&#32773;&#31181;&#26893;&#20307;&#36830;&#22312;&#19968;&#36215;&#65292;&#20174;&#32780;&#24674;&#22797;&#32570;&#22833;&#29273;&#30340;&#35299;&#21078;&#24418;&#24577;&#19982;&#29983;&#29702;&#21151;&#33021;&#12290;&#30001;&#20110;&#36825;&#31181;&#20462;&#22797;&#20307;&#24739;&#32773;&#19981;&#33021;&#33258;&#34892;&#21462;&#25140;&#65292;&#22266;&#31616;&#31216;&#20026;&#22266;&#23450;&#20041;&#40831;&#12290;&#21448;&#30001;&#20110;&#20854;&#32467;&#26500;&#19982;&#26725;&#26753;&#30456;&#20284;&#65292;&#25925;&#21448;&#31216;&#22266;&#23450;&#26725;&#12290;&lt;/span&gt;&lt;span style=&quot;font-size: 10.5pt; font-family: &#23435;&#20307;; color: #333333;&quot;&gt;&#23427;&#19981;&#20165;&#33021;&#24674;&#22797;&#21632;&#22204;&#22120;&#23448;&#30340;&#35299;&#21078;&#24418;&#24577;&#21644;&#29983;&#29702;&#21151;&#33021;&#65292;&#36824;&#33021;&#36739;&#38271;&#19968;&#27573;&#26102;&#26399;&#32500;&#25345;&#35813;&#22120;&#23448;&#30340;&#20581;&#24247;&#21644;&#39044;&#38450;&#29273;&#39052;&#30142;&#30149;&#30340;&#21457;&#29983;&#65292;&#20363;&#22914;&#38450;&#27490;&#23545;&#39052;&#30340;&#29273;&#40831;&#20280;&#38271;&#65292;&#20197;&#21450;&#30456;&#37051;&#30340;&#29273;&#40831;&#20542;&#26012;&#12290;&#24182;&#21487;&#20351;&#24739;&#32773;&#24863;&#35273;&#21040;&#36817;&#20284;&#20110;&#30495;&#29273;&#30340;&#32654;&#35266;&#65292;&#33298;&#36866;&#21644;&#21632;&#22204;&#24863;&#21463;&#12290;&lt;/span&gt;&lt;a href=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/bxjdental/668ca217-06fd-49aa-9401-e519391ab311&quot;&gt; &lt;/a&gt;&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/longxingxiang/entry/sliderliteimages</id>
        <title type="html">sliderliteimages</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/longxingxiang/entry/sliderliteimages"/>
        <published>2014-07-03T22:30:32+08:00</published>
        <updated>2014-07-03T22:30:32+08:00</updated> 
        <category term="/general" label="general" />
        <content type="html">&lt;li&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/longxingxiang/50bce174-f349-493c-9ebd-368e79588a7a&quot; alt=&quot;&quot;  /&gt;&lt;/li&gt;
                                                &lt;li&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/longxingxiang/186dfba0-29b4-4227-87d9-327b15403888&quot; alt=&quot;&quot;  /&gt;&lt;/li&gt;
                                                &lt;li&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/longxingxiang/49186ecc-43cd-4e56-9dcc-3143409d7ea1&quot; alt=&quot;&quot;  /&gt;&lt;/li&gt; 
                                                &lt;li&gt;&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/longxingxiang/7758551b-40dd-4c2e-a215-a6aa02d5baae&quot; alt=&quot;&quot;  /&gt;&lt;/li&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/longxingxiang/entry/1404395764271</id>
        <title type="html">1404395764271</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/longxingxiang/entry/1404395764271"/>
        <published>2014-07-03T21:56:38+08:00</published>
        <updated>2014-07-03T21:57:26+08:00</updated> 
        <category term="/news" label="news" />
        <summary type="html">&lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#19968;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#20027;&#21150;&#21333;&#20301;&lt;/b&gt;&#65306;&#23041;&#33251;&#40857;&#20852;&#32724;&#32701;&#27611;&#29699;&#39302;&lt;/span&gt;&lt;/p&gt;
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#20108;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#21327;&#21150;&#21333;&#20301;&#65306;&lt;/b&gt;&#28145;&#22323;&#24066;&#40857;&#20852;&#32724;&#24191;&#21578;&#20256;&#23186;&#26377;&#38480;&#20844;&#21496;&lt;/span&gt;&lt;/p&gt;
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#28145;&#22323;&#24066;&#26032;&#26085;&#25196;&#25237;&#36164;&#26377;&#38480;&#20844;&#21496;&lt;/span&gt;&lt;/p&gt;
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#19977;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#36190;&#21161;&#21333;&#20301;&lt;/b&gt;&#65306;&#28145;&#22323;&#24066;&#40857;&#20852;&#32724;&#20307;&#32946;&#21457;&#23637;&#26377;&#38480;&#20844;&#21496;&lt;/span&gt;&lt;/p&gt;
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#28145;&#22323;&#24066;&#36125;&#26031;&#29305;&#29627;&#29827;&#21046;&#21697;&#26377;&#38480;&#20844;&#21496;&lt;/span&gt;&lt;/p&gt;
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#22235;&#12289;&#27604;&#36187;&#26102;&#38388;&#12289;&#27604;&#36187;&#22320;&#28857;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#27604;&#36187;&#26102;&#38388;&#65306;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;2014&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#24180;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;7&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#26376;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt; 26&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt; &#26085;&#19978;&#21320;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;9&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#28857;&#31614;&#21040;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#27604;&#36187;&#22320;&#28857;&#65306;&lt;/b&gt;&#23041;&#33251;&#40857;&#20852;&#32724;&#32701;&#27611;&#29699;&#39302;&lt;/span&gt;&lt;/p&gt;
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#20116;&#12289;&#27604;&#36187;&#39033;&#30446;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#28151;&#21512;&#22242;&#20307;&#36187;&#65288;&#20986;&#22330;&#39034;&#24207;&#65306;&#30007;&#23376;&#21452;&#25171;1&#65292;&#28151;&#21512;&#21452;&#25171;1&#65292;&#30007;&#23376;&#21333;&#25171;&#65292;&#21442;&#36187;&#36816;&#21160;&#21592;&#19981;&#21487;&#20197;&#20860;&#39033;&#65289;&#21487;&#20197;&#26368;&#22810;&#25253;7&#21517;&#38431;&#21592;&lt;/span&gt;&lt;/p&gt;</summary>
        <content type="html">&lt;p class=&quot;p1&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#28145;&#22323;&#24066;&#40857;&#20852;&#32724;&#12298;&#36125;&#26031;&#29305;&#12299;&#26479;&#19994;&#20313;&#32701;&#27611;&#29699;&#28151;&#21512;&#22242;&#20307;&#36187;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#19968;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#20027;&#21150;&#21333;&#20301;&lt;/b&gt;&#65306;&#23041;&#33251;&#40857;&#20852;&#32724;&#32701;&#27611;&#29699;&#39302;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#20108;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#21327;&#21150;&#21333;&#20301;&#65306;&lt;/b&gt;&#28145;&#22323;&#24066;&#40857;&#20852;&#32724;&#24191;&#21578;&#20256;&#23186;&#26377;&#38480;&#20844;&#21496;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt; &#28145;&#22323;&#24066;&#26032;&#26085;&#25196;&#25237;&#36164;&#26377;&#38480;&#20844;&#21496;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#19977;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#36190;&#21161;&#21333;&#20301;&lt;/b&gt;&#65306;&#28145;&#22323;&#24066;&#40857;&#20852;&#32724;&#20307;&#32946;&#21457;&#23637;&#26377;&#38480;&#20844;&#21496;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt; &#28145;&#22323;&#24066;&#36125;&#26031;&#29305;&#29627;&#29827;&#21046;&#21697;&#26377;&#38480;&#20844;&#21496;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#22235;&#12289;&#27604;&#36187;&#26102;&#38388;&#12289;&#27604;&#36187;&#22320;&#28857;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#27604;&#36187;&#26102;&#38388;&#65306;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;2014&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#24180;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;7&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#26376;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;  26&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt; &#26085;&#19978;&#21320;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;9&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#28857;&#31614;&#21040;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#27604;&#36187;&#22320;&#28857;&#65306;&lt;/b&gt;&#23041;&#33251;&#40857;&#20852;&#32724;&#32701;&#27611;&#29699;&#39302;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#20116;&#12289;&#27604;&#36187;&#39033;&#30446;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#28151;&#21512;&#22242;&#20307;&#36187;&#65288;&#20986;&#22330;&#39034;&#24207;&#65306;&#30007;&#23376;&#21452;&#25171;1&#65292;&#28151;&#21512;&#21452;&#25171;1&#65292;&#30007;&#23376;&#21333;&#25171;&#65292;&#21442;&#36187;&#36816;&#21160;&#21592;&#19981;&#21487;&#20197;&#20860;&#39033;&#65289;&#21487;&#20197;&#26368;&#22810;&#25253;7&#21517;&#38431;&#21592;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#20845;&#12289;&lt;b&gt;&#21442;&#36187;&#36164;&#26684;&#65306;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p4&quot;&gt;&lt;span class=&quot;s2&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#12289;&#24180;&#28385;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;18&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#21608;&#23681;&#65292;&#36523;&#20307;&#20581;&#24247;&#65292;&#26080;&#24515;&#33039;&#30149;&#12289;&#39640;&#34880;&#21387;&#31561;&#30149;&#21490;&#65307;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p4&quot;&gt;&lt;span class=&quot;s1&quot;&gt;2&#12289;&#22312;&#28145;&#22323;&#24066;&#23621;&#20303;&#30340;&#23621;&#27665;&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p4&quot;&gt;&lt;span class=&quot;s1&quot;&gt;3&#12289;&#22312;&#22269;&#23478;&#20307;&#32946;&#24635;&#23616;&#20050;&#20051;&#29699;&#32701;&#27611;&#29699;&#36816;&#21160;&#31649;&#29702;&#20013;&#24515;&#27880;&#20876;&#36807;&#30340;&#19987;&#19994;&#36816;&#21160;&#21592;&#65288;&#21253;&#25324;&#22269;&#23478;&#38431;&#12289;&#20843;&#19968;&#20307;&#24037;&#38431;&#12289;&#21508;&#30465;&#24066;&#20307;&#24037;&#38431;&#12289;&#21508;&#32844;&#19994;&#20465;&#20048;&#37096;&#36816;&#21160;&#21592;&#65292;&#20307;&#26657;&#36816;&#21160;&#21592;&#65289;&#65292;&#19981;&#33021;&#25253;&#21517;&#21442;&#36187;&#65307;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p4&quot;&gt;&lt;span class=&quot;s1&quot;&gt;4&#12289;&#36816;&#21160;&#21592;&#25253;&#21517;&#21442;&#36187;&#21069;&#35831;&#36141;&#20080;&#20154;&#36523;&#24847;&#22806;&#20260;&#23475;&#20445;&#38505;&#65307;&#27604;&#36187;&#36807;&#31243;&#20013; &#19968;&#20999;&#24847;&#22806;&#22343;&#19982;&#29699;&#39302;&#21644;&#32452;&#22996;&#20250;&#26080;&#20851;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#19971;&#12289;&#31454;&#36187;&#35268;&#21017;&#65306;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&lt;b&gt;1&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#12289;&#25191;&#34892;&#22269;&#23478;&#20307;&#32946;&#24635;&#23616;&#23457;&#23450;&#30340;&#26368;&#26032;&#12298;&#32701;&#27611;&#29699;&#31454;&#36187;&#35268;&#21017;&#12299;&#20197;&#21450;&#21442;&#29031;&#30456;&#20851;&#30340;&#34917;&#20805;&#35268;&#23450;&#12290;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s1&quot;&gt;2&#12289;&#27604;&#36187;&#20998;&#20004;&#20010;&#38454;&#27573;&#36827;&#34892;&#65292;&#31532;&#19968;&#38454;&#27573;&#65306;&#25277;&#31614;&#36827;&#20301;&#65288;6&#26376; &#26202;8&#28857;&#21495;&#25277;&#31614;&#65289;&#65292;&#37319;&#29992;&#20998;&#32452;&#24490;&#29615;&#36187;&#65292;&#27599;&#21333;&#39033;31&#20998;&#19968;&#23616;&#21046;&#65292;&#25171;&#28385;&#19977;&#39033;&#12290;&#23567;&#32452;&#21069;&#20004;&#21517;&#20986;&#32447;&#65292;&#36827;&#20837;&#31532;&#20108;&#38454;&#27573;&#12290;&#31532;&#20108;&#38454;&#27573;&#37319;&#29992;&#21333;&#28120;&#27760;&#36187;&#65292;&#27599;&#23616;15&#20998;&#65292;&#19977;&#23616;&#20004;&#32988;&#65292;&#20116;&#30424;&#19977;&#32988;&#21046;&#65292;&#35265;&#19977;&#23601;&#25910;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s1&quot;&gt;4&#12289;&#22312;&#23567;&#32452;&#24490;&#29615;&#36187;&#20013;&#65292;&#22914;&#36935;&#23567;&#32452;&#31215;&#20998;&#30456;&#21516;&#65292;&#20108;&#38431;&#31215;&#20998;&#30456;&#21516;&#20197;&#32988;&#36127;&#20851;&#31995;&#26469;&#30830;&#23450;&#65292;&#22914;&#19977;&#38431;&#20197;&#19978;&#31215;&#20998;&#65292;&#20381;&#27425;&#20197;&#20928;&#32988;&#22330;&#25968;&#12289;&#23616;&#25968;&#12289;&#20998;&#25968;&#35745;&#31639;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s1&quot;&gt;5&#12289;&#27599;&#22330;&#27604;&#36187;&#24320;&#36187;&#21069;20&#20998;&#38047;&#30001;&#21508;&#39046;&#38431;&#21040;&#35760;&#24405;&#32452;&#39046;&#21462;&#21450;&#20132;&#25442;&#20986;&#22330;&#21517;&#21333;&#65292;&#21517;&#21333;&#19968;&#32463;&#20132;&#25442;&#21518;&#65292;&#19981;&#24471;&#26356;&#25913;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#20843;&#12289;&#25253;&#21517;&#39035;&#30693;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;1.&#21442;&#36187;&#21333;&#20301;&#65306;&#30001;&#21508;&#21442;&#36187;&#20154;&#21592;&#33258;&#34892;&#32452;&#38431;&#65288;&#31616;&#31216;&#8220;&#21442;&#36187;&#21333;&#20301;&#8221;&#65289;&#65292;&#26412;&#27425;&#27963;&#21160;&#19981;&#25509;&#21463;&#20010;&#20154;&#30452;&#25509;&#25253;&#21517;&#65292;&#26368;&#20302;20&#25903;&#21442;&#36187;&#38431;&#26368;&#39640;64&#25903;&#21442;&#36187;&#38431;&#65292;&#20302;&#20110;24&#25903;&#36890;&#30693;&#21508;&#21442;&#36187;&#38431;&#39046;&#38431;&#27604;&#36187;&#21462;&#28040;&#65292;&#36864;&#36824;&#25253;&#21517;&#36153;&#12290;24&#25903;&#21442;&#36187;&#38431;&#21462;&#21069;3&#21517;&#65292;32&#25903;&#21442;&#36187;&#38431;&#21462;&#21069;6&#21517;&#65292;64&#25903;&#21442;&#36187;&#38431;&#21462;&#21069;8&#21517;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;2.&#21442;&#36187;&#20154;&#25968;&#65306;&#27599;&#38431;&#21442;&#36187;&#21333;&#20301;&#21487;&#25253;&#39046;&#38431;1&#21517;&#65292;&#36816;&#21160;&#21592;&#19981;&#24471;&#36229;&#36807;7&#20154;&#65288;&#39046;&#38431;&#21487;&#20860;&#36816;&#21160;&#21592;&#65289;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p4&quot;&gt;&lt;span class=&quot;s1&quot;&gt;3&#12289;&#27599;&#21517;&#36816;&#21160;&#21592;&#21482;&#33021;&#21442;&#21152;&#19968;&#25903;&#20195;&#34920;&#38431;&#65292;&#19981;&#24471;&#37325;&#22797;&#25253;&#21517;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;3.&#25253;&#21517;&#26041;&#24335;&#65306;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#65288;1&#65289;&#21442;&#36187;&#36816;&#21160;&#21592;&#21487;&#20197;&#20197;&#24494;&#20449;&#30340;&#26041;&#24335;&#25552;&#20132;&#26377;&#25928;&#35777;&#20214;&#65288;&#36523;&#20221;&#35777;&#65292;&#23621;&#20303;&#35777;&#65292;&#28145;&#22323;&#31038;&#20445;&#21345;&#31561;&#65289;&#31561;&#30456;&#20851;&#36164;&#26009;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p4&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#65288;2&#65289;QQ&#37038;&#31665;&#25253;&#21517;2271192579@qq.com 1250061383@qq.com &lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p4&quot;&gt;&lt;span class=&quot;s1&quot;&gt; &#24494;&#20449;13714094586&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#65288;3&#65289;&#25253;&#21517;&#19968;&#32463;&#23457;&#26680;&#36890;&#36807;&#35270;&#20026;&#25253;&#21517;&#25104;&#21151;&#65292;&#26410;&#32463;&#21516;&#24847;&#19981;&#24471;&#26356;&#25913;&#21644;&#34917;&#20805;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p6&quot;&gt;&lt;span class=&quot;s1&quot;&gt;4.&#25253;&#21517;&#26102;&#38388;&#65306;2014&#24180;6&#26376; 30 &#26085;&#33267;2014&#24180;7&#26376; 20 &#26085;&#65292;&#36926;&#26399;&#19981;&#21463;&#29702;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;5.&#25253;&#21517;&#36153;&#29992;&#65306;&#27599;&#20010;&#21442;&#36187;&#21333;&#20301;&#39035;&#32564;&#20132;&#21442;&#36187;&#36153;300&#20803;/&#38431;&#65288;&#27599;&#25903;&#38431;&#20237;&#36865;7&#20214;T&#24676;&#65289;&#65292;&#20197;&#25910;&#21040;&#25253;&#21517;&#34920;&#21450;&#25253;&#21517;&#36153;&#20026;&#20934;&#12290;&#25253;&#21517;&#25130;&#27490;&#21518;&#65292;&#19981;&#33021;&#21442;&#36187;&#30340;&#65292;&#19981;&#36864;&#36824;&#25253;&#21517;&#36153;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;6.&#25253;&#21517;&#21450;&#21672;&#35810;&#30005;&#35805;&#65306;&#21016;&#23567;&#23453;&#65306;13714094586&#65292;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;7.&#25253;&#21517;&#36153;&#36716;&#36134;&#36134;&#21495;&#65306;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#36134;&#21495;&#65306;621626 0000015135 990&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#24320;&#25143;&#34892;&#65306;&#24179;&#23433;&#38134;&#34892;&#22338;&#30000;&#25903;&#34892;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#25143;&#21517;&#65306;&#21016;&#27874;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#20061;&#12289;&#36164;&#26684;&#23457;&#26684;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s1&quot;&gt;1&#12289;&#36816;&#21160;&#21592;&#25253;&#21517;&#21518;&#30001;&#32452;&#22996;&#20250;&#36827;&#34892;&#36164;&#26684;&#23457;&#26597;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s1&quot;&gt;2&#12289;&#21442;&#36187;&#36816;&#21160;&#21592;&#36187;&#21069;&#24517;&#39035;&#20986;&#31034;&#26412;&#20154;&#26377;&#25928;&#35777;&#20214;&#21407;&#20214;&#65288;&#22914;&#65306;&#36523;&#20221;&#35777;&#12289;&#25252;&#29031;&#12289;&#28207;&#28595;&#36890;&#34892;&#35777;&#12289;&#39550;&#39542;&#35777;&#65289;&#32467;&#20104;&#20020;&#22330;&#35009;&#21028;&#21592;&#26816;&#26597;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p7&quot;&gt;&lt;span class=&quot;s4&quot;&gt;&#21313;&#12289;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#29992;&#29699;&#65292;&#26381;&#35013;&#65306;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#27604;&#36187;&#29992;&#29699;&#65306;&#23567;&#32452;&#36187;&#29992; &#65306;  &lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p8&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#28120;&#27760;&#36187;&#29992; &#65306; &lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p9&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#27604;&#36187;&#26381;&#35013;&#65306;&#21442;&#36187;&#21333;&#20301;&#23613;&#37327;&#32479;&#19968;&#26381;&#35013;&#21442;&#21152;&#27604;&#36187;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p7&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#21313;&#19968;&#12289;&#24323;&#26435;&#21644;&#32610;&#36187;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s5&quot;&gt;&lt;b&gt;&#24323;&#26435;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s6&quot;&gt;&#65306;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#22312;&#19968;&#22330;&#27604;&#36187;&#36827;&#34892;&#20013;&#20961;&#22240;&#20260;&#30149;&#25110;&#20854;&#23427;&#21407;&#22240;&#19981;&#33021;&#32487;&#32493;&#27604;&#36187;&#32773;&#25353;&#26412;&#22330;&#27604;&#36187;&#24323;&#26435;&#35770;&#12290;&#27604;&#36187;&#20013;&#36816;&#21160;&#21592;&#36831;&#21040;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#20998;&#38047;&#32773;&#65292;&#21028;&#35813;&#36816;&#21160;&#21592;&#35813;&#21333;&#22330;&#27604;&#36187;&#24323;&#26435;&#12290;&#19978;&#19968;&#20010;&#22242;&#20307;&#32467;&#26463;&#21518;&#65292;&#19979;&#19968;&#20010;&#22242;&#20307;&#24517;&#39035;&#22312;10&#20998;&#38047;&#20869;&#21040;&#22330;&#36827;&#34892;&#27604;&#36187;&#65292;&#21542;&#21017;&#20570;&#24323;&#26435;&#22788;&#29702;&#12290;&lt;/span&gt;&lt;span class=&quot;s7&quot;&gt;&#27604;&#36187;&#36827;&#34892;&#20013;&#65292;&#22914;&#36935;&#25277;&#31563;&#12289;&#25197;&#20260;&#12289;&#36300;&#20260;&#31561;&#65292;&#21487;&#26242;&#20572;&#20801;&#35768;&#19981;&#36229;&#36807;5&#20998;&#38047;&#30340;&#20260;&#30149;&#22788;&#29702;&#12290;&#36229;&#36807;2&#27425;&#26242;&#20572;&#20260;&#30149;&#22788;&#29702;&#30340;&#65292;&#20316;&#24323;&#26435;&#22788;&#29702;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s5&quot;&gt;&lt;b&gt;&#32610;&#36187;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#65306;&#27604;&#36187;&#20013;&#36816;&#21160;&#21592;&#24212;&#26381;&#20174;&#35009;&#21028;&#65292;&#26377;&#24322;&#35758;&#26102;&#65292;&#21487;&#36890;&#36807;&#20020;&#22330;&#35009;&#21028;&#21592;&#21521;&#35009;&#21028;&#38271;&#21453;&#26144;&#65292;&#23545;&#35009;&#21028;&#38271;&#30340;&#35009;&#20915;&#20173;&#26377;&#24322;&#35758;&#32773;&#65292;&#21487;&#30001;&#39046;&#38431;&#21521;&#32452;&#22996;&#20250;&#25552;&#20986;&#21475;&#22836;&#21644;&#20070;&#38754;&#30003;&#35785;&#65292;&#36816;&#21160;&#21592;&#25110;&#21442;&#36187;&#21333;&#20301;&#19981;&#35770;&#20160;&#20040;&#21407;&#22240;&#36896;&#25104;&#27604;&#36187;&#19981;&#33021;&#36827;&#34892;&#25110;&#20013;&#26029;&#27604;&#36187;&#65292;&#25110;&#20020;&#36187;&#21069;&#25298;&#32477;&#20986;&#22330;&#65292;&#36187;&#21518;&#25298;&#32477;&#39046;&#22870;&#31561;&#65292;&#36229;&#36807;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#20998;&#38047;&#32773;&#65288;&#32463;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&#21149;&#35299;&#35828;&#26381;&#25945;&#32946;&#21518;&#35745;&#31639;&#26102;&#38388;&#65289;&#20026;&#32610;&#36187;&#12290;&#36187;&#22330;&#19968;&#26086;&#20986;&#29616;&#32610;&#36187;&#36816;&#21160;&#21592;&#25110;&#21442;&#36187;&#21333;&#20301;&#65292;&#32452;&#22996;&#20250;&#26377;&#26435;&#26681;&#25454;&#24773;&#20917;&#36827;&#34892;&#22788;&#32602;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p10&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#21313;&#20108;&#12289;&#22870;&#39033;&#35774;&#32622;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s8&quot;&gt;&lt;b&gt;&#65306; &lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p3&quot;&gt;&lt;span class=&quot;s2&quot;&gt;24-64&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#25903;&#38431;&#20237;&#65292;&#22870;&#21697;&#24635;&#20215;&#20540;&#26368;&#39640;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;45000&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#20803;&#30340;&#22870;&#21697;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p11&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p12&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#21313;&#19977;&#12289;&#20210;&#35009;&#22996;&#21592;&#20250;&#19982;&#35009;&#21028;&#21592;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;1.&#20210;&#35009;&#22996;&#21592;&#20250;&#65306;&#36187;&#21306;&#35774;&#20210;&#35009;&#22996;&#21592;&#20250;&#65292;&#20854;&#32452;&#25104;&#21644;&#32844;&#36131;&#33539;&#22260;&#25353;&#12298;&#20210;&#35009;&#21734;&#22996;&#21592;&#20250;&#26465;&#20363;&#12299;&#35268;&#23450;&#25191;&#34892;&#65292;&#20154;&#21592;&#30001;&#32452;&#22996;&#20250;&#21644;&#35009;&#21028;&#32452;&#36873;&#27966;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;2.&#35009;&#21028;&#38271;&#20026;&#32701;&#21327;&#27880;&#20876;&#35009;&#21028;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p12&quot;&gt;&lt;span class=&quot;s9&quot;&gt;&lt;b&gt;&#21313;&#22235;&#12289;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#20854;&#20182;&#20107;&#39033;&#65306;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p13&quot;&gt;&lt;span class=&quot;s1&quot;&gt;1&#12289;&#21442;&#36187;&#38431;&#21592;&#27604;&#36187;&#26399;&#38388;&#39035;&#25658;&#24102;&#26377;&#25928;&#36523;&#20221;&#35777;&#20214;&#65292;&#20197;&#22791;&#35009;&#21028;&#21592;&#26680;&#23454;&#36816;&#21160;&#21592;&#36523;&#20221;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p13&quot;&gt;&lt;span class=&quot;s1&quot;&gt;2&#12289;&#27604;&#36187;&#20013;&#36816;&#21160;&#21592;&#24212;&#26381;&#20174;&#35009;&#21028;&#65292;&#26377;&#24322;&#35758;&#21487;&#36890;&#36807;&#35009;&#21028;&#21592;&#21521;&#35009;&#21028;&#38271;&#21453;&#26144;&#65292;&#35009;&#21028;&#38271;&#30340;&#35009;&#21028;&#20026;&#26368;&#32456;&#35009;&#20915;&#12290;&#23545;&#35009;&#21028;&#38271;&#30340;&#35009;&#20915;&#26377;&#24322;&#35758;&#32773;&#65292;&#21487;&#21521;&#20210;&#35009;&#22996;&#21592;&#20250;&#25552;&#20986;&#30003;&#35785;&#12290;&#26080;&#35770;&#20160;&#20040;&#21407;&#22240;&#36896;&#25104;&#27604;&#36187;&#20013;&#26029;5&#20998;&#38047;&#65288;&#32463;&#35843;&#35299;&#21149;&#35828;&#21518;&#35745;&#31639;&#65289;&#20197;&#19978;&#32773;&#65292;&#25353;&#32610;&#36187;&#22788;&#29702;&#65292;&#21462;&#28040;&#35813;&#22330;&#27604;&#36187;&#36164;&#26684;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s5&quot;&gt;&lt;b&gt;3&#12289;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#21442;&#21152;&#27604;&#36187;&#36816;&#21160;&#21592;&#33258;&#34892;&#36127;&#25285;&#39135;&#23487;&#65292;&#20132;&#36890;&#31561;&#36153;&#29992;&#12290;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#21313;&#20116;&#12289;&#26410;&#23613;&#20107;&#23452;&#32452;&#22996;&#20250;&#21478;&#34892;&#36890;&#30693;&#12290;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p5&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#21313;&#20845;&#12289;&#26412;&#35268;&#31243;&#35299;&#37322;&#26435;&#23646;&#20110;&#20027;&#21150;&#26041;&#12290;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p14&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#36187;&#20107;&#32452;&#22996;&#20250;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; 
  &lt;p class=&quot;p15&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;&#20108;0&#19968;&#22235;&#24180;&#22235;&#26376;&#20108;&#21313;&#19968;&#26085;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sixiangxiaochu/entry/headimages</id>
        <title type="html">headimages</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sixiangxiaochu/entry/headimages"/>
        <published>2014-06-10T21:59:39+08:00</published>
        <updated>2014-06-10T22:23:03+08:00</updated> 
        <category term="/General" label="general" />
        <content type="html">&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/1240b704-d3b4-4d12-8503-59970cfa8c1c&quot;/&gt;
&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/75d6629c-3671-41df-836a-2337b9400da2&quot;/&gt;
&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/e981d230-5253-4c24-b3fa-4da7fa9ecc7e&quot;/&gt;
&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/42946c69-56c3-4d36-906f-e5de9d18fc83&quot;/&gt;
&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/ae76fb7d-520e-4d46-9f0c-74b03e9af0ea&quot;/&gt;
&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/7ad30cea-e94b-477c-be8f-e60e70ca7672&quot;/&gt;
&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/0073c5d9-fe57-4232-ae5a-5ace214bf074&quot;/&gt;
&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/565afce3-7fa7-4f80-a371-b44bb3173d80&quot;/&gt;
&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/ecd09a15-45ff-4e7b-8bd8-0d25348c1d4b&quot;/&gt;
&lt;img src=&quot;http://miniws.oss-cn-qingdao.aliyuncs.com/sixiangxiaochu/9d70b609-04ac-448b-8381-e77690a75f48&quot;/&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sixiangxiaochu/entry/callinfo</id>
        <title type="html">callinfo</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sixiangxiaochu/entry/callinfo"/>
        <published>2014-06-10T00:06:09+08:00</published>
        <updated>2014-06-10T21:48:21+08:00</updated> 
        <category term="/General" label="general" />
        <content type="html">&lt;h2&gt;&#30005;&#35805;:&amp;nbsp;0951-6036**&lt;/h2&gt;
  &lt;h2&gt;&#30005;&#35805;: 133 09590**&lt;/h2&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sixiangxiaochu/entry/home</id>
        <title type="html">home</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sixiangxiaochu/entry/home"/>
        <published>2014-06-10T00:04:57+08:00</published>
        <updated>2014-06-10T21:47:12+08:00</updated> 
        <category term="/General" label="general" />
        <content type="html">&lt;h1&gt;&#27426;&#36814;&#20809;&#20020;&#31169;&#39321;&#23567;&#21416;!&lt;/h1&gt;
  &lt;p&gt;&#25105;&#20204;&#31177;&#25215;&#8220;&#21892;&#24453;&#33258;&#24049;&#12289;&#21892;&#24453;&#20182;&#20154;&#12289;&#21892;&#24453;&#29983;&#21629;&#8221;&#30340;&#23447;&#26088;&#65292;&#31469;&#35802;&#20026;&#20851;&#27880;&#25105;&#20204;&#30340;&#26379;&#21451;&#25552;&#20379;&#20248;&#36136;&#26381;&#21153;&#65281;&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/sixiangxiaochu/entry/aboutme</id>
        <title type="html">aboutme</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/sixiangxiaochu/entry/aboutme"/>
        <published>2014-05-24T12:05:11+08:00</published>
        <updated>2014-05-24T12:05:11+08:00</updated> 
        <category term="/General" label="general" />
        <content type="html">&#31169;&#39321;&#23567;&#21416;&#65292;&#24314;&#31435;&#20110;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;


&#25105;&#20204;&#30340;&#30446;&#26631;&#65306;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;

&#25105;&#20204;&#30340;&#26381;&#21153;&#65306;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;&#12290;
</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/longxingxiang/entry/1398578678881</id>
        <title type="html">1398578678881</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/longxingxiang/entry/1398578678881"/>
        <published>2014-04-27T14:04:38+08:00</published>
        <updated>2014-04-27T14:05:37+08:00</updated> 
        <category term="/news" label="news" />
        <summary type="html">&lt;p&gt;3:2&lt;/p&gt;
  &lt;p&gt;4:2&lt;/p&gt;
  &lt;p&gt;4:3&lt;/p&gt;
  &lt;p&gt;5:&lt;/p&gt;
  &lt;p&gt;3&lt;/p&gt;
  &lt;p&gt;6:3&lt;/p&gt;
  &lt;p&gt;7:&lt;/p&gt;
  &lt;p&gt;7:3&lt;/p&gt;
  &lt;p&gt;8:3&lt;/p&gt;
  &lt;p&gt;9:3&lt;/p&gt;
  &lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTcibYghSurjlcicgj4P5TXiaCnoVTpep6xdXf6BFI8vfrkfrJO0kELgG7A/0&quot; /&gt;&lt;/p&gt;
  &lt;p&gt;10:5&lt;/p&gt;
  &lt;p&gt;10:6&lt;/p&gt;
  &lt;p&gt;11:6&lt;/p&gt;
  &lt;p&gt;11:7&lt;/p&gt;
  &lt;p&gt;11:8&lt;/p&gt;
  &lt;p&gt;&#25187;&#29699;&#30028;&#22806;&lt;/p&gt;
  &lt;p&gt;12:8&lt;/p&gt;
  &lt;p&gt;13:8&lt;/p&gt;
  &lt;p&gt;14:8&lt;/p&gt;
  &lt;p&gt;&#28378;&#32593;&#65292;14:9&lt;/p&gt;
  &lt;p&gt;16:9&lt;/p&gt;
  &lt;p&gt;18:12&lt;/p&gt;
  &lt;p&gt;18:15&lt;/p&gt;
  &lt;p&gt;18:16&lt;/p&gt;
  &lt;p&gt;19:16&lt;/p&gt;
  &lt;p&gt;19:17&lt;/p&gt;
  &lt;p&gt;20:17&lt;/p&gt;
  &lt;p&gt;20:18&lt;/p&gt;
  &lt;p&gt;21:18&lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;3:2&lt;/p&gt;
  &lt;p&gt;4:2&lt;/p&gt;
  &lt;p&gt;4:3&lt;/p&gt;
  &lt;p&gt;5:&lt;/p&gt;
  &lt;p&gt;3&lt;/p&gt;
  &lt;p&gt;6:3&lt;/p&gt;
  &lt;p&gt;7:&lt;/p&gt;
  &lt;p&gt;7:3&lt;/p&gt;
  &lt;p&gt;8:3&lt;/p&gt;
  &lt;p&gt;9:3&lt;/p&gt;
  &lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTcibYghSurjlcicgj4P5TXiaCnoVTpep6xdXf6BFI8vfrkfrJO0kELgG7A/0&quot; /&gt;&lt;/p&gt;
  &lt;p&gt;10:5&lt;/p&gt;
  &lt;p&gt;10:6&lt;/p&gt;
  &lt;p&gt;11:6&lt;/p&gt;
  &lt;p&gt;11:7&lt;/p&gt;
  &lt;p&gt;11:8&lt;/p&gt;
  &lt;p&gt;&#25187;&#29699;&#30028;&#22806;&lt;/p&gt;
  &lt;p&gt;12:8&lt;/p&gt;
  &lt;p&gt;13:8&lt;/p&gt;
  &lt;p&gt;14:8&lt;/p&gt;
  &lt;p&gt;&#28378;&#32593;&#65292;14:9&lt;/p&gt;
  &lt;p&gt;16:9&lt;/p&gt;
  &lt;p&gt;18:12&lt;/p&gt;
  &lt;p&gt;18:15&lt;/p&gt;
  &lt;p&gt;18:16&lt;/p&gt;
  &lt;p&gt;19:16&lt;/p&gt;
  &lt;p&gt;19:17&lt;/p&gt;
  &lt;p&gt;20:17&lt;/p&gt;
  &lt;p&gt;20:18&lt;/p&gt;
  &lt;p&gt;21:18&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/longxingxiang/entry/1398578097355</id>
        <title type="html">1398578097355</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/longxingxiang/entry/1398578097355"/>
        <published>2014-04-27T13:54:57+08:00</published>
        <updated>2014-04-27T14:09:45+08:00</updated> 
        <category term="/news" label="news" />
        <summary type="html">&lt;p&gt;14:4
&lt;/p&gt;
&lt;p&gt;&#27809;&#36807;&#32593;
&lt;/p&gt;
&lt;p&gt;6:6
&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTK6QeG8dSmR7DaibldW350SEBffuOevGqN4SuicYP3VTxtDNMn601gXdg/0&quot; /&gt;&lt;/img&gt;
&lt;/p&gt;
&lt;p&gt;&#25187;&#29699;&#24471;&#20844;
&lt;/p&gt;
&lt;p&gt;&#21514;&#29699;&#22833;&#35823;
&lt;/p&gt;
&lt;p&gt;3&#26377;&#20105;&#35758;
&lt;/p&gt;
&lt;p&gt;&#34013;&#26041;&#22311;&#32418;&#26041;&#21453;&#25163;&#65292;&#24471;&#20998;
&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTic57T4Pn8rjR4ibxyxcVRBLNe9ibBH1HMo2gRC5n9ZwJZ3PKDYoKxqYpA/0&quot; /&gt;&lt;/img&gt;
&lt;/p&gt;
&lt;p&gt;&#27604;&#36187;&#32467;&#26463;&#65292;&#32418;&#26041;&#32988;
&lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;14:4
&lt;/p&gt;
&lt;p&gt;&#27809;&#36807;&#32593;
&lt;/p&gt;
&lt;p&gt;6:6
&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTK6QeG8dSmR7DaibldW350SEBffuOevGqN4SuicYP3VTxtDNMn601gXdg/0&quot; /&gt;&lt;/img&gt;
&lt;/p&gt;
&lt;p&gt;&#25187;&#29699;&#24471;&#20844;
&lt;/p&gt;
&lt;p&gt;&#21514;&#29699;&#22833;&#35823;
&lt;/p&gt;
&lt;p&gt;3&#26377;&#20105;&#35758;
&lt;/p&gt;
&lt;p&gt;&#34013;&#26041;&#22311;&#32418;&#26041;&#21453;&#25163;&#65292;&#24471;&#20998;
&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTic57T4Pn8rjR4ibxyxcVRBLNe9ibBH1HMo2gRC5n9ZwJZ3PKDYoKxqYpA/0&quot; /&gt;&lt;/img&gt;
&lt;/p&gt;
&lt;p&gt;&#27604;&#36187;&#32467;&#26463;&#65292;&#32418;&#26041;&#32988;
&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/longxingxiang/entry/1398577595904</id>
        <title type="html">1398577595904</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/longxingxiang/entry/1398577595904"/>
        <published>2014-04-27T13:46:35+08:00</published>
        <updated>2014-04-27T13:47:18+08:00</updated> 
        <category term="/news" label="news" />
        <summary type="html">&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTIjib96s83pBhzcg0UeHZTE7aQicGibiaZcc6dQ6PgBpeVQYySFvHkGORgA/0&quot; /&gt;&lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTIjib96s83pBhzcg0UeHZTE7aQicGibiaZcc6dQ6PgBpeVQYySFvHkGORgA/0&quot; /&gt;&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/longxingxiang/entry/1398577318231</id>
        <title type="html">1398577318231</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/longxingxiang/entry/1398577318231"/>
        <published>2014-04-27T13:41:58+08:00</published>
        <updated>2014-04-27T13:45:12+08:00</updated> 
        <category term="/news" label="news" />
        <summary type="html">&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFT1kbsybpHQ0VeqCoSrG5ITDkNxLb2iafhFicsNpKHSavD524bFC9t5KOA/0&quot; /&gt;&lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFT1kbsybpHQ0VeqCoSrG5ITDkNxLb2iafhFicsNpKHSavD524bFC9t5KOA/0&quot; /&gt;&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/longxingxiang/entry/1398577246892</id>
        <title type="html">1398577246892</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/longxingxiang/entry/1398577246892"/>
        <published>2014-04-27T13:40:46+08:00</published>
        <updated>2014-04-27T13:44:59+08:00</updated> 
        <category term="/news" label="news" />
        <summary type="html">&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTPI9VEgkg3Bl6UInJ3LfgxedwRoQcnbUXAsnSwloXqEogwVtDib26g1Q/0&quot; /&gt;&lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTPI9VEgkg3Bl6UInJ3LfgxedwRoQcnbUXAsnSwloXqEogwVtDib26g1Q/0&quot; /&gt;&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>http://www.miniws.cn/longxingxiang/entry/1398577183533</id>
        <title type="html">1398577183533</title>
        <author><name>admin</name></author>
        <link rel="alternate" type="text/html" href="http://www.miniws.cn/longxingxiang/entry/1398577183533"/>
        <published>2014-04-27T13:39:43+08:00</published>
        <updated>2014-04-27T13:44:42+08:00</updated> 
        <category term="/news" label="news" />
        <summary type="html">&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTk14icYYrPPX9tpLOL60lb5kKWyjicxuXQ018ytEfo4DqaKbY037Kmh8w/0&quot; /&gt;&lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;&lt;img src=&quot;http://mmbiz.qpic.cn/mmbiz/YeC7QRsnH5zTD7N3mBUsVJ2IHiazAKfFTk14icYYrPPX9tpLOL60lb5kKWyjicxuXQ018ytEfo4DqaKbY037Kmh8w/0&quot; /&gt;&lt;/p&gt;</content>
    </entry>
</feed>



