{"id":723,"date":"2022-01-20T18:00:00","date_gmt":"2022-01-20T09:00:00","guid":{"rendered":"https:\/\/www.sea2800.com\/?p=723"},"modified":"2022-01-19T14:27:58","modified_gmt":"2022-01-19T05:27:58","slug":"django3-2%e3%81%a7runserver%e3%82%92%e5%85%a5%e5%8a%9b%e3%81%97%e3%81%9f%e3%82%89%e7%aa%81%e7%84%b6%e3%83%a2%e3%83%87%e3%83%ab%e3%81%aewarning%e3%81%8c%e5%87%ba%e3%81%9f%e6%99%82%e3%81%ae%e5%af%be","status":"publish","type":"post","link":"https:\/\/www.sea2800.com\/?p=723","title":{"rendered":"Django3.2\u3067runserver\u3092\u5165\u529b\u3057\u305f\u3089\u7a81\u7136\u30e2\u30c7\u30eb\u306eWARNING\u304c\u51fa\u305f\u6642\u306e\u5bfe\u51e6\u6cd5"},"content":{"rendered":"\n<p><a href=\"https:\/\/note.com\/trum2800\"><\/a><a href=\"https:\/\/note.com\/trum2800\">Wata<\/a>2022\u5e741\u670819\u65e5 14:18<\/p>\n\n\n\n<p id=\"28cc26e6-2d23-4661-9422-eeddacdedca0\">Django3.\uff12\u306b\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3057\u3066python manage.py&nbsp;runserver \u3092\u5165\u529b\u3057\u305f\u3089\u3053\u306e\u753b\u50cf\u304c\u51fa\u305f\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\u304b\uff1f<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/assets.st-note.com\/img\/1642565794440-ExCOGdd7ZS.png\"><img decoding=\"async\" src=\"https:\/\/assets.st-note.com\/img\/1642565794440-ExCOGdd7ZS.png?width=800\" alt=\"\u753b\u50cf\u3092\u62e1\u5927\u8868\u793a\"\/><\/a><\/figure>\n\n\n\n<p id=\"11fa444c-114a-493d-80cc-7fa3f3ad7e60\">\u3053\u308c\u304c\u8d77\u3053\u3063\u305f\u6642\u3069\u3046\u3044\u3046\u98a8\u306b\u5bfe\u51e6\u3059\u308c\u3070\u3044\u3044\u304b\u3092\u66f8\u304d\u8a18\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u539f\u56e0<\/h2>\n\n\n\n<p id=\"ae15dfcc-ddc7-4c07-9750-033d1c8a9e53\">\u3053\u308c\u304c\u8d77\u304d\u305f\u539f\u56e0\u3068\u3057\u3066\u516c\u5f0f\u30b5\u30a4\u30c8\u3067\u306fdjango\u306e3.\uff12\u306b\u3088\u308b\u4ed5\u69d8\u5909\u66f4\u306b\u3088\u308b\u3082\u306e\u3067<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Customizing type of auto-created primary keys\u00b6<br><br>When defining a model, if no field in a model is defined with primary_key=True an implicit primary key is added. The type of this implicit primary key can now be controlled via the DEFAULT_AUTO_FIELD setting and AppConfig.default_auto_field attribute. No more needing to override primary keys in all models.<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/docs.djangoproject.com\/en\/3.2\/releases\/3.2\/\n<\/div><\/figure>\n\n\n\n<p id=\"e0945b4f-4ba4-4c7b-9660-ca23162ddecf\">\u8981\u7d04\u3059\u308b\u3068\u306f\u30e2\u30c7\u30eb\u5185\u306bprimary_key=True\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u6697\u9ed9\u306e\u30d7\u30e9\u30a4\u30de\u30eb\u30ad\u30fc\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002\u6697\u9ed9\u306e\u30d7\u30e9\u30a4\u30de\u30eb\u30ad\u30fc\u306fDEFAULT_AUTO_FIELD\u8a2d\u5b9a\u3068AppConfig.default_auto_field attribute\u3067\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u5168\u3066\u306e\u30e2\u30c7\u30eb\u3092\u4e0a\u66f8\u304d\u3059\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u3063\u305f\u3068\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u6c7a\u65b9\u6cd5<\/h2>\n\n\n\n<p id=\"5774bf2f-0994-41e8-8f44-a785d49768ad\"><a href=\"https:\/\/settings.py\/\" target=\"_blank\" rel=\"noreferrer noopener\">settings.py<\/a>\u306b\u4ee5\u4e0b\u306e\u3053\u3068\u3092\u66f8\u3051\u3070OK\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'<\/code><\/pre>\n\n\n\n<p id=\"1b69f3d0-b8cd-42e3-9ae3-87407c5ec01b\">models.py\u3067\u8a18\u8ff0\u3059\u308b\u4f8b\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from django.apps import AppConfig\n\nclass MyAppConfig(AppConfig):\n    default_auto_field = 'django.db.models.AutoField'\n    name = 'my_app'<\/code><\/pre>\n\n\n\n<p id=\"04cae4e1-e1f9-43f4-9e57-b49e464e6b9f\">\u7279\u5b9a\u306e\u30e2\u30c7\u30eb\u3060\u3051\u306b\u884c\u3046\u5834\u5408\u306fmodels.py\u306b\u4ee5\u4e0b\u306e\u901a\u308a\u306b\u66f8\u3051\u3070OK\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from django.db import models\n\nclass MyModel(models.Model):\n    id = models.AutoField(primary_key=True)<\/code><\/pre>\n\n\n\n<p id=\"9034caeb-fb6e-424f-bd23-0e5a87a94077\">\u30e2\u30c7\u30eb\u306b\u4eca\u307e\u3067\u306f\u5fc5\u8981\u306a\u304b\u3063\u305f\u3082\u306e\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u306b\u306a\u3063\u305f\u6642\u3001\u8ffd\u52a0\u3057\u305f\u30e2\u30c7\u30eb\u3092\u4e0a\u66f8\u304d\u306f\u3067\u304d\u305a\u3001\u5b50\u30e2\u30c7\u30eb\u3092\u4f5c\u3063\u3066\u305d\u306e\u89aa\u30e2\u30c7\u30eb\u3092\u7d10\u3065\u3051\u305f\u308a\u3001\u305d\u306e\u30e2\u30c7\u30eb\u5c5e\u6027\u3092\u8ffd\u52a0\u3059\u308b\u306e\u306f\u7c21\u5358\u306a\u65b9\u6cd5\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c7\u30fc\u30bf\u3092\u6d88\u3059\u3068\u3044\u3046<strong>\u7981\u3058\u624b<\/strong>\u3067\u3042\u3063\u305f\u308a\u3001fake\u3057\u3066Migrations\u5c65\u6b74\u3092\u524a\u9664\u3057\u3066\u4e0a\u66f8\u3059\u308b\u3068\u3044\u3046\u3054\u307e\u304b\u3057\u306b\u3057\u3066\u3082\u3081\u3093\u3069\u304f\u3055\u3044\u306e\u3067\u4e00\u3005\u4e0a\u66f8\u304d\u3057\u306a\u304f\u3066\u6e08\u3080\u306e\u306f\u304b\u306a\u308a\u697d\u306b\u306a\u308a\u307e\u3059\u306d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wata2022\u5e741\u670819\u65e5 14:18 D [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,8],"tags":[16],"class_list":["post-723","post","type-post","status-publish","format-standard","hentry","category-django","category-python","tag-django"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.sea2800.com\/index.php?rest_route=\/wp\/v2\/posts\/723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sea2800.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sea2800.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sea2800.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sea2800.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=723"}],"version-history":[{"count":1,"href":"https:\/\/www.sea2800.com\/index.php?rest_route=\/wp\/v2\/posts\/723\/revisions"}],"predecessor-version":[{"id":724,"href":"https:\/\/www.sea2800.com\/index.php?rest_route=\/wp\/v2\/posts\/723\/revisions\/724"}],"wp:attachment":[{"href":"https:\/\/www.sea2800.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sea2800.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sea2800.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}