{"id":63,"date":"2021-07-04T23:29:22","date_gmt":"2021-07-04T15:29:22","guid":{"rendered":"https:\/\/www.tysql.com\/?p=63"},"modified":"2024-07-14T11:32:36","modified_gmt":"2024-07-14T03:32:36","slug":"django-%e5%ae%89%e8%a3%85%e5%b9%b6%e5%88%9b%e5%bb%ba%e7%a9%ba%e9%a1%b9%e7%9b%ae","status":"publish","type":"post","link":"https:\/\/www.tysql.com\/index.php\/2021\/07\/04\/django-%e5%ae%89%e8%a3%85%e5%b9%b6%e5%88%9b%e5%bb%ba%e7%a9%ba%e9%a1%b9%e7%9b%ae\/","title":{"rendered":"Django \u5b89\u88c5\u5e76\u521b\u5efa\u7a7a\u9879\u76ee"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">1.pip\u5b89\u88c5Django<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">pip install django==2.2.4<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">2.\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a welcome \u7684Django\u9879\u76ee<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">django-admin startproject welcome<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u8fdb\u5165 welcome \u6587\u4ef6\u5939 \u542f\u52a8\u9879\u76ee<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">cd welcome # \u8fdb\u5165welcome\u6587\u4ef6\u5939\npython manage.py runserver  # \u542f\u52a8\u670d\u52a1\u5668\u9ed8\u8ba4\u76d1\u542c8000\u7aef\u53e3\npython manage.py runserver 5000 # \u542f\u52a8\u670d\u52a1\u5668\u5e76\u624b\u52a8\u6307\u5b9a\u76d1\u542c5000\u7aef\u53e3<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">4.\u6253\u5f00 127.0.0.1:8000 \u51fa\u73b0\u5c0f\u706b\u7bad\u8bf4\u660e\u9879\u76ee\u521b\u5efa\u6210\u529f<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"522\" height=\"312\" src=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2021\/07\/4EQ7CHX5VK@YCNIT-1.png\" alt=\"\" class=\"wp-image-65\" style=\"width:283px;height:169px\" srcset=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2021\/07\/4EQ7CHX5VK@YCNIT-1.png 522w, https:\/\/www.tysql.com\/wp-content\/uploads\/2021\/07\/4EQ7CHX5VK@YCNIT-1-300x179.png 300w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">5.\u9879\u76ee\u76ee\u5f55\u7ed3\u6784<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"664\" height=\"149\" src=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/3ef9330c3cd129e037c94d68a93f423.png\" alt=\"\" class=\"wp-image-275\" srcset=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/3ef9330c3cd129e037c94d68a93f423.png 664w, https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/3ef9330c3cd129e037c94d68a93f423-300x67.png 300w\" sizes=\"auto, (max-width: 664px) 100vw, 664px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">6.\u9879\u76ee\u521b\u5efa\u6210\u529f\u7684\u51c6\u5907\u5de5\u4f5c<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u65b0\u5efa\u9879\u76ee\u5220\u9664templates\u6587\u4ef6\u5939,\u5e76\u4e14\u4fee\u6539setting\u8fd9\u91cc\u7684\u8bbe\u7f6e\u4e3a[]<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"355\" src=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/7fc80e2a3fc62aa056c99762c199132.png\" alt=\"\" class=\"wp-image-274\" style=\"width:693px;height:auto\" srcset=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/7fc80e2a3fc62aa056c99762c199132.png 644w, https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/7fc80e2a3fc62aa056c99762c199132-300x165.png 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\"><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">7.\u521b\u5efa\u4e00\u4e2a\u7a7a\u7684APP<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\"> # \u521b\u5efa\u4e00\u4e2a\u53ebapp\u7684APP,\u4e0b\u56fe\u4e2d\u521b\u5efa\u7684\u662f\u53ebapp01,\u4e0d\u91cd\u8981\n py manage.py startapp app<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"662\" height=\"346\" src=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/c406e45a12c0919a478bb6edcdf4f26.png\" alt=\"\" class=\"wp-image-276\" srcset=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/c406e45a12c0919a478bb6edcdf4f26.png 662w, https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/c406e45a12c0919a478bb6edcdf4f26-300x157.png 300w\" sizes=\"auto, (max-width: 662px) 100vw, 662px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">8.\u53bbsettings\u6ce8\u518c\u8fd9\u4e2aapp<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"667\" height=\"310\" src=\"http:\/\/www.tysql.com\/wp-content\/uploads\/2021\/07\/38378e1f5889d921a8198d2646cb923.png\" alt=\"\" class=\"wp-image-277\" srcset=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2021\/07\/38378e1f5889d921a8198d2646cb923.png 667w, https:\/\/www.tysql.com\/wp-content\/uploads\/2021\/07\/38378e1f5889d921a8198d2646cb923-300x139.png 300w\" sizes=\"auto, (max-width: 667px) 100vw, 667px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">9.\u542f\u52a8django\u547d\u4ee4<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">py manage.py runserver 8000<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">10.\u7f16\u5199\u4e00\u4e2a\u666e\u901a\u7684\u8bf7\u6c42<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"457\" src=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/ebdf030bc66d0656bc02eb7cd47f955-1024x457.png\" alt=\"\" class=\"wp-image-278\" srcset=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/ebdf030bc66d0656bc02eb7cd47f955-1024x457.png 1024w, https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/ebdf030bc66d0656bc02eb7cd47f955-300x134.png 300w, https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/ebdf030bc66d0656bc02eb7cd47f955-768x343.png 768w, https:\/\/www.tysql.com\/wp-content\/uploads\/2024\/07\/ebdf030bc66d0656bc02eb7cd47f955.png 1228w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>1.pip\u5b89\u88c5Django 2.\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a welcome \u7684Django\u9879\u76ee 3. \u8fdb\u5165 welcome  &hellip; <a href=\"https:\/\/www.tysql.com\/index.php\/2021\/07\/04\/django-%e5%ae%89%e8%a3%85%e5%b9%b6%e5%88%9b%e5%bb%ba%e7%a9%ba%e9%a1%b9%e7%9b%ae\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Django \u5b89\u88c5\u5e76\u521b\u5efa\u7a7a\u9879\u76ee<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,3],"tags":[],"class_list":["post-63","post","type-post","status-publish","format-standard","hentry","category-django","category-python"],"_links":{"self":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts\/63","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/comments?post=63"}],"version-history":[{"count":4,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts\/63\/revisions"}],"predecessor-version":[{"id":279,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts\/63\/revisions\/279"}],"wp:attachment":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/media?parent=63"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/categories?post=63"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/tags?post=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}