{"id":7626,"date":"2024-11-14T09:40:39","date_gmt":"2024-11-14T01:40:39","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7626\/"},"modified":"2024-11-14T09:40:39","modified_gmt":"2024-11-14T01:40:39","slug":"python-django-%e6%95%b0%e6%8d%ae%e5%ba%93%e8%bf%81%e7%a7%bb%e5%a4%b1%e8%b4%a5%ef%bc%9a%e4%b8%ba%e4%bb%80%e4%b9%88-python3-manage-py-makemigrations-%e5%9c%a8-windows-%e4%b8%8a%e6%97%a0%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7626\/","title":{"rendered":"Python Django \u6570\u636e\u5e93\u8fc1\u79fb\u5931\u8d25\uff1a\u4e3a\u4ec0\u4e48 `python3 manage.py makemigrations` \u5728 Windows \u4e0a\u65e0\u6cd5\u521b\u5efa MySQL \u6570\u636e\u8868\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173106288882885.jpg\" class=\"aligncenter\" title=\"Python Django \u6570\u636e\u5e93\u8fc1\u79fb\u5931\u8d25\uff1a\u4e3a\u4ec0\u4e48 `python3 manage.py makemigrations` \u5728 Windows \u4e0a\u65e0\u6cd5\u521b\u5efa MySQL \u6570\u636e\u8868\uff1f\u63d2\u56fe\" alt=\"Python Django \u6570\u636e\u5e93\u8fc1\u79fb\u5931\u8d25\uff1a\u4e3a\u4ec0\u4e48 `python3 manage.py makemigrations` \u5728 Windows \u4e0a\u65e0\u6cd5\u521b\u5efa MySQL \u6570\u636e\u8868\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>Python Django \u6570\u636e\u5e93\u8fc1\u79fb\u5931\u8d25<\/strong><\/p>\n<p>\u5728\u6267\u884c 3 manage.py makemigrations \u547d\u4ee4\u65f6\uff0c\u9047\u5230\u4e86 MySQL \u6570\u636e\u8868\u521b\u5efa\u5931\u8d25\u7684\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u95ee\u9898\u8be6\u60c5\uff1a<\/p>\n<ul>\n<li> \uff1aWindows 10<\/li>\n<li>Python \u7248\u672c\uff1a3.8.6<\/li>\n<li>Django \u7248\u672c\uff1a3.2.19<\/li>\n<li> client \u7248\u672c\uff1a2.1.1<\/li>\n<li>MySQL \u7248\u672c\uff1a0.0.3<\/li>\n<\/ul>\n<p>\u9879\u76ee\u7684\u76ee\u5f55\u7ed3\u6784\u3001models.py \u6587\u4ef6\u5185\u5bb9\uff0c\u4ee5\u53ca settings.py \u6587\u4ef6\u4e2d\u7684\u5e94\u7528\u7a0b\u5e8f\u6ce8\u518c\u548c\u6570\u636e\u5e93\u914d\u7f6e\u90fd\u5df2\u786e\u8ba4\u65e0\u8bef\u3002<\/p>\n<p>\u7136\u800c\uff0c\u5728\u8fd0\u884c python3 manage.py makemigrations \u548c python3 manage.py migrate \u547d\u4ee4\u540e\uff0cMySQL \u4e2d\u7684\u6570\u636e\u8868\u4ecd\u672a\u521b\u5efa\u6210\u529f\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u7ecf\u8fc7\u5206\u6790\uff0c\u95ee\u9898\u51fa\u5728\u4f7f\u7528\u7684 Python \u89e3\u91ca\u5668\u4e0a\u3002\u6267\u884c python3 \u547d\u4ee4\u5b9e\u9645\u4e0a\u6307\u5411\u7684\u662f Windows \u81ea\u5e26\u7684 Python \u89e3\u91ca\u5668\uff0c\u800c\u4e0d\u662f\u5b89\u88c5\u5305\u4e2d\u5b89\u88c5\u7684 Python \u89e3\u91ca\u5668\u3002<\/p>\n<p><strong>\u89e3\u51b3\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\u4f7f\u7528 python \u547d\u4ee4\uff08\u4e0d\u5e26\u7248\u672c\u53f7\uff09\u6765\u8c03\u7528\u5b89\u88c5\u5305\u5b89\u88c5\u7684 Python \u89e3\u91ca\u5668\u3002<\/li>\n<li>\u5728 python \u89e3\u91ca\u5668\u4e2d\uff0c\u8f93\u5165 python manage.py makemigrations \u548c python manage.py migrate \u547d\u4ee4\u3002\u6b64\u65f6\uff0c\u6570\u636e\u8868\u5c06\u6210\u529f\u521b\u5efa\u3002<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662fPython Django \u6570\u636e\u5e93\u8fc1\u79fb\u5931\u8d25\uff1a `3 manage.py makemigrations` \u5728 Windows \u4e0a\u65e0\u6cd5\u521b\u5efa MySQL \u6570\u636e\u8868\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Django \u6570\u636e\u5e93\u8fc1\u79fb\u5931\u8d25 \u5728\u6267\u884c 3 manage.py makemigrations \u547d\u4ee4\u65f6\uff0c\u9047\u5230\u4e86 MySQL \u6570\u636e\u8868\u521b\u5efa\u5931\u8d25\u7684\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u95ee\u9898\u8be6\u60c5\uff1a \uff1aWindows 10 Python \u7248\u672c\uff1a3.8.6 Django \u7248\u672c\uff1a3.2.19 client \u7248\u672c\uff1a2.1.1 MySQL \u7248\u672c\uff1a0.0.3 \u9879\u76ee\u7684\u76ee\u5f55\u7ed3\u6784\u3001models.py \u6587\u4ef6\u5185\u5bb9\uff0c\u4ee5\u53ca settings.py \u6587\u4ef6\u4e2d\u7684\u5e94\u7528\u7a0b\u5e8f\u6ce8\u518c\u548c\u6570\u636e\u5e93\u914d\u7f6e\u90fd\u5df2\u786e\u8ba4\u65e0\u8bef\u3002 \u7136\u800c\uff0c\u5728\u8fd0\u884c python3 manage.py makemigrations \u548c python3 manage.py migrate \u547d\u4ee4\u540e\uff0cMySQL \u4e2d\u7684\u6570\u636e\u8868\u4ecd\u672a\u521b\u5efa\u6210\u529f\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u89e3\u51b3\u65b9\u6848 \u7ecf\u8fc7\u5206\u6790\uff0c\u95ee\u9898\u51fa\u5728\u4f7f\u7528\u7684 Python \u89e3\u91ca\u5668\u4e0a\u3002\u6267\u884c python3 \u547d\u4ee4\u5b9e\u9645\u4e0a\u6307\u5411\u7684\u662f Windows \u81ea\u5e26\u7684 Python \u89e3\u91ca\u5668\uff0c\u800c\u4e0d\u662f\u5b89\u88c5\u5305\u4e2d\u5b89\u88c5\u7684 Python \u89e3\u91ca\u5668\u3002 \u89e3\u51b3\u6b65\u9aa4\uff1a \u4f7f\u7528 python \u547d\u4ee4\uff08\u4e0d\u5e26\u7248\u672c\u53f7\uff09\u6765\u8c03\u7528\u5b89\u88c5\u5305\u5b89\u88c5\u7684 Python \u89e3\u91ca\u5668\u3002 \u5728 python [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-7626","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=7626"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7626\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}