{"id":200625,"date":"2025-05-06T09:56:40","date_gmt":"2025-05-06T01:56:40","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200625\/"},"modified":"2025-05-06T09:56:40","modified_gmt":"2025-05-06T01:56:40","slug":"pycharm%e4%b8%8bdjango%e8%bf%9e%e6%8e%a5mysql%e6%95%b0%e6%8d%ae%e5%ba%93%ef%bc%8c%e6%89%a7%e8%a1%8cmakemigrations%e5%90%8e%e4%b8%ba%e4%bd%95%e6%b2%a1%e6%9c%89%e5%88%9b%e5%bb%ba%e6%95%b0%e6%8d%ae","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200625\/","title":{"rendered":"Pycharm\u4e0bDjango\u8fde\u63a5MySQL\u6570\u636e\u5e93\uff0c\u6267\u884cmakemigrations\u540e\u4e3a\u4f55\u6ca1\u6709\u521b\u5efa\u6570\u636e\u8868\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>Pycharm\u4e0bDjango\u8fde\u63a5MySQL\u6570\u636e\u5e93\uff0c\u6267\u884cmakemigrations\u540e\u4e3a\u4f55\u6ca1\u6709\u521b\u5efa\u6570\u636e\u8868\uff1f<\/h1>\n<p>\u4eb2\u7231\u7684\u7f16\u7a0b\u5b66\u4e60\u7231\u597d\u8005\uff0c\u5982\u679c\u4f60\u70b9\u5f00\u4e86\u8fd9\u7bc7\u6587\u7ae0\uff0c\u8bf4\u660e\u4f60\u5bf9\u300aPycharm\u4e0bDjango\u8fde\u63a5MySQL\u6570\u636e\u5e93\uff0c\u6267\u884cmakemigrations\u540e\u4e3a\u4f55\u6ca1\u6709\u521b\u5efa\u6570\u636e\u8868\uff1f\u300b\u5f88\u611f\u5174\u8da3\u3002\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u7ed9\u5927\u5bb6\u8be6\u7ec6\u89e3\u6790\u4e00\u4e0b\uff0c\u4e3b\u8981\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5e0c\u671b\u6240\u6709\u8ba4\u771f\u8bfb\u5b8c\u7684\u7ae5\u978b\u4eec\uff0c\u90fd\u6709\u5b9e\u8d28\u6027\u7684\u63d0\u9ad8\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241110\/1731204407673015372dd9a.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>pycharm\u4e0bDjango\u4e0eMySQL\u8fde\u63a5\u95ee\u9898\uff1a\u6267\u884cmakemigrations\u540e\u6570\u636e\u5e93\u8868\u672a\u521b\u5efa<\/strong><\/p>\n<p>\u5bf9\u4e8e\u5728pycharm\u4e2d\u4f7f\u7528Django\u8fde\u63a5MySQL\u6570\u636e\u5e93\u65f6\uff0c\u6267\u884c\u201cpython3 manage.py makemigrations\u201d\u547d\u4ee4\u540e\u6570\u636e\u5e93\u8868\u6ca1\u6709\u521b\u5efa\u6210\u529f\u7684\u7591\u60d1\uff0c\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6848\u53ef\u80fd\u6709\u6240\u5e2e\u52a9\uff1a<\/p>\n<p><strong>\u73af\u5883\u4fe1\u606f\uff1a<\/strong><\/p>\n<ul>\n<li>\u7cfb\u7edf\uff1aWin10<\/li>\n<li>Python\u7248\u672c\uff1a3.8.6<\/li>\n<li>Django\u7248\u672c\uff1a3.2.19<\/li>\n<li>mysqlclient\u7248\u672c\uff1a2.1.1<\/li>\n<li>mysql\u7248\u672c\uff1a0.0.3<\/li>\n<\/ul>\n<p><strong>\u95ee\u9898\u63cf\u8ff0\uff1a<\/strong><\/p>\n<p>\u5df2\u5b8c\u6210\u9879\u76ee\u7684app\u6ce8\u518c\u548c\u6570\u636e\u5e93\u914d\u7f6e\uff0c\u5e76\u5728pycharm\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4e86\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<ul>\n<li>python3 manage.py makemigrations<\/li>\n<li>python3 manage.py migrate<\/li>\n<\/ul>\n<p>\u4f46\u5e76\u672a\u5728MySQL\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u6570\u636e\u8868\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u5206\u6790\u547d\u4ee4\u8f93\u51fa\u4fe1\u606f\uff0c\u53d1\u73b0\u7cfb\u7edf\u5b9e\u9645\u8fd0\u884c\u7684\u547d\u4ee4\u5e76\u975e\u201cpython3 manage.py\u201d\uff0c\u800c\u662f\u76f4\u63a5\u6307\u5411\u4e86Windows\u81ea\u5e26\u7684Python 3\uff0c\u5bfc\u81f4\u547d\u4ee4\u65e0\u6548\u3002\u5c1d\u8bd5\u76f4\u63a5\u8f93\u5165\u201cpython\u201d\uff0c\u5373\u53ef\u6210\u529f\u6253\u5f00Python IDLE\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5bf9\u4e8e\u5df2\u7ecf\u901a\u8fc7\u5b89\u88c5\u5305\u65b9\u5f0f\u5b89\u88c5Python\u7684\u7528\u6237\uff0c\u5728\u4f7f\u7528pycharm\u65f6\u65e0\u9700\u518d\u4f7f\u7528\u201cpython3\u201d\u524d\u7f00\uff0c\u76f4\u63a5\u8f93\u5165\u201cpython\u201d\u5373\u53ef\u3002\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\uff1a<\/p>\n<ul>\n<li>python manage.py makemigrations<\/li>\n<li>python manage.py migrate<\/li>\n<\/ul>\n<p>\u6b64\u65f6\uff0c\u76f8\u5173\u6570\u636e\u8868\u5c06\u5728MySQL\u6570\u636e\u5e93\u4e2d\u6210\u529f\u521b\u5efa\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300aPycharm\u4e0bDjango\u8fde\u63a5MySQL\u6570\u636e\u5e93\uff0c\u6267\u884cmakemigrations\u540e\u4e3a\u4f55\u6ca1\u6709\u521b\u5efa\u6570\u636e\u8868\uff1f\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u6570\u636e\u5e93\u77e5\u8bc6\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Pycharm\u4e0bDjango\u8fde\u63a5&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200625","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200625"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200625\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}