{"id":865,"date":"2024-12-10T16:23:09","date_gmt":"2024-12-10T08:23:09","guid":{"rendered":"http:\/\/www.chan.ink\/?p=865"},"modified":"2024-12-12T13:12:25","modified_gmt":"2024-12-12T05:12:25","slug":"%e3%80%90djangosqlite%e3%80%91%e5%85%b3%e4%ba%8edjango-db-utils-notsupportederror-deterministictrue-requires-sqlite-3-8-3-or-higher%e7%9a%84%e9%94%99%e8%af%af%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"http:\/\/www.chan.ink\/index.php\/2024\/12\/10\/%e3%80%90djangosqlite%e3%80%91%e5%85%b3%e4%ba%8edjango-db-utils-notsupportederror-deterministictrue-requires-sqlite-3-8-3-or-higher%e7%9a%84%e9%94%99%e8%af%af%e8%a7%a3%e5%86%b3\/","title":{"rendered":"\u3010Django+SQLite\u3011\u5173\u4e8edjango.db.utils.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher\u7684\u9519\u8bef\u89e3\u51b3"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"33\" src=\"http:\/\/www.chan.ink\/wp-content\/uploads\/2024\/12\/1733816233296.png\" alt=\"\" class=\"wp-image-866\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1116\" height=\"160\" src=\"http:\/\/www.chan.ink\/wp-content\/uploads\/2024\/12\/1733816267142.png\" alt=\"\" class=\"wp-image-867\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f7f\u7528Django\u81ea\u5e26\u7684SQLite\u6570\u636e\u5e93\u65f6\uff0c\u63d0\u793a\u9700\u8981\u66f4\u9ad8\u7248\u672c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u67e5\u770b\u5f53\u524d\u865a\u62df\u73af\u5883\u4e2d\u81ea\u5e26\u7684SQLite\u7248\u672c<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"712\" height=\"246\" src=\"http:\/\/www.chan.ink\/wp-content\/uploads\/2024\/12\/1733816331897.png\" alt=\"\" class=\"wp-image-868\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u518d\u770b\u4e0blinux\u7cfb\u7edf\u81ea\u5e26\u7684\u3010PS:\u5df2\u7ecf\u88ab\u6211\u66f4\u65b0\u5230\u6700\u65b0\u7248\u3011SQLite\u7248\u672c<app-translate-content class=\"eusoft-translate-container-span-en ng-star-inserted\" _nghost-ng-c341168634=\"\"><\/app-translate-content><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1026\" height=\"88\" src=\"http:\/\/www.chan.ink\/wp-content\/uploads\/2024\/12\/1733816427812.png\" alt=\"\" class=\"wp-image-869\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3.47\uff0c\u8fd9\u662f\u5f53\u524d\u6b64\u6587\u53d1\u5e03\u65f6\u7684\u6700\u65b0\u7248\u672c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7ffb\u904d\u4e86\u4ee5\u5f80\u7684\u6559\u7a0b\uff0c\u6700\u540e\u7684\u89e3\u51b3\u529e\u6cd5\u5982\u4e0b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u6211\u4e3a\u4f8b\uff0c\u6211\u662f\u4f7f\u7528\u7684\u865a\u62df\u73af\u5883\uff0c\u6545\u800c\u6211\u627e\u5230\u865a\u62df\u73af\u5883\u4e0b\u7684\u76ee\u5f55\uff0c\u76ee\u5f55\u5730\u5740\u5982\u4e0b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\/envs\/lib\/python3.9\/site-packages\/django\/db\/backends\/sqlite3<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6253\u5f00base.py\u6587\u4ef6<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">#from sqlite3 import dbapi2 as Database \u00a0#\u6ce8\u91ca\u5b83<br>from pysqlite3 import dbapi2 as Database #\u65b0\u52a0\u8fd9\u6bb5\u4ee3\u7801<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"879\" height=\"829\" src=\"http:\/\/www.chan.ink\/wp-content\/uploads\/2024\/12\/1733818886024.png\" alt=\"\" class=\"wp-image-870\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fee\u6539\u540e\u70b9\u51fb\u4fdd\u5b58<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"82\" src=\"http:\/\/www.chan.ink\/wp-content\/uploads\/2024\/12\/1733818913506.png\" alt=\"\" class=\"wp-image-871\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"775\" height=\"639\" src=\"http:\/\/www.chan.ink\/wp-content\/uploads\/2024\/12\/1733819276585.png\" alt=\"\" class=\"wp-image-875\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u7ec8\u4e8e\u89e3\u51b3\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6b64\u5904\u8d34\u51fa\u7ed9\u6211\u89e3\u51b3\u6b64\u95ee\u9898\u7684\u5e16\u5b50<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/blog.csdn.net\/qq_44501429\/article\/details\/131147638\">https:\/\/blog.csdn.net\/qq_44501429\/article\/details\/131147638<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5410\u69fd\uff1b\u8fd9\u4e2a\u95ee\u9898\uff0c\u524d\u540e\u6298\u817e\u6211\u7ea62\u4e2a\u5c0f\u65f6\uff0c\u4e3b\u8981\u662f\u524d\u4eba\u7ed9\u7684\u89e3\u51b3\u529e\u6cd5\uff0c\u5df2\u7ecf\u4e0d\u518d\u6709\u7528\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u6700\u8fd1\uff0c\u5f88\u591a\u670b\u53cb\u90fd\u628a\u81ea\u5df1\u7684\u64cd\u4f5c\u7cfb\u7edf\u3001Python\u3001Django\u90fd\u5347\u7ea7\u5230\u6700\u65b0\u7248\u672c\u4e86\uff0c\u4f7f\u7528\u9ed8\u8ba4SQLite\u6570\u636e\uff0c\u8fd0\u884c\u65f6\u4f1a\u62a5\u51fa\u7c7b\u4f3cdjango.db.utils.NotSupportedError: deterministic=True requires SQLite 3.8.3\u7684\u9519\u8bef\u63d0\u793a\u3002\u8fd9\u4e3b\u8981\u662f\u64cd\u4f5c\u7cfb\u7edf\u9ed8\u8ba4SQLite\u6570\u636e\u5e93\u7248\u672c\u592a\u4f4e\u9020\u6210\u7684\u3002\u8fd9\u91cc\u7ed9\u5927\u5bb6\u63d0\u4f9b\u4e09\u79cd\u89e3\u51b3\u529e\u6cd5\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u5927\u5bb6\u3002\n\n\u7b2c\u4e00\u79cd\uff1a\n\n\u5347\u7ea7\u7cfb\u7edf\u91cc\u7684SQLite\u7248\u672c\u3002\u65b9\u6cd5\uff1ahttps:\/\/www.django.cn\/forum\/forum-487.html\n\n\u6ce8\u610f\uff0c\u5982\u9700\u8981\u6700\u65b0\u7248\u672c\u7684\u8bdd\uff0c\u8bf7\u4ece\u5b98\u7f51\u4e0b\u8f7d\u6700\u65b0\u7684\u8f6f\u4ef6\u5305\u3002 \u4e0b\u8f7d\u5740\uff1ahttps:\/\/www.sqlite.org\/download.html\n\n\u7b2c\u4e8c\u79cd\uff1a\u627e\u5230\u62a5\u9519\u6587\u4ef6\uff0c\u5982\/usr\/local\/python3\/lib\/python3.8\/site-packages\/django\/db\/backends\/sqlite3\/base.py \u6253\u5f00\u5b83\uff0c\u627e\u5230\n\ndef check_sqlite_version():\n    if Database.sqlite_version_info &lt; (3, 9, 0):\n\u628a\u91cc\u9762\u5c0f\u62ec\u53f7\u91cc\u7684 SQLite\u7248\u672c\uff083\uff0c9\uff0c0\uff09\u4fee\u6539\u6210\u4f60\u5f53\u524d\u7cfb\u7edf\u91cc\u7248\u672c\u5c31\u597d\u3002\n\n\u7b2c\u4e09\u79cd\uff1a\n\n\u4f7f\u7528\u7b2c\u4e09\u65b9\u5305\u8fd0\u884cSQLite\u3002\u628asqlite3 \u66f4\u6362\u4e3apysqlite3 \u548c pysqlite3-binary\u65b9\u6cd5\uff1a\n\n1\u3001\u5b89\u88c5pysqlite3\u548cpysqlite3-binary\npip install pysqlite3\npip install pysqlite3-binary\n2\u3001\u6253\u5f00\u6587\u4ef6\/usr\/local\/python3\/lib\/python3.8\/site-packages\/django\/db\/backends\/sqlite3\/base.py\uff0c\u627e\u5230 from sqlite3 import dbapi2 as Database \u6ce8\u91ca\u5b83\uff0c\u6dfb\u52a0\u4ee3\u7801\n\n#from sqlite3 import dbapi2 as Database  #\u6ce8\u91ca\u5b83\nfrom pysqlite3 import dbapi2 as Database #\u65b0\u52a0\u8fd9\u6bb5\u4ee3\u7801\n\u4e09\u79cd\uff0c\u603b\u6709\u4e00\u79cd\u9002\u5408\u4f60<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bd4\u65b9\u8bf4\u8fd9\u4e09\u79cd\uff0c\u5176\u4e2d\u7b2c\u4e8c\u79cd\u662f\u6700\u7b80\u4fbf\u7684\uff0c\u4f46\u662f\u6b64\u6a21\u5757\u4e2d\u5df2\u7ecf\u6ca1\u6709\u4e0e\u4e4b\u4e00\u6837\u7684\u4ee3\u7801\u4e86\u3002\u7b2c\u4e09\u79cd\u5012\u662f\u53ef\u4ee5\u89e3\u51b3\u3002\u53e6\u5916\uff0c\u8fd8\u6709\u7b2c\u56db\u79cd\u89e3\u51b3\u529e\u6cd5\uff0c\u6211\u60f3\u662f\u5c06deterministic=True\u6539\u4e3aFalse\uff0c\u4e0d\u8fc7\u8fd9\u4f1a\u4e0d\u4f1a\u4e3a\u9879\u76ee\u5e26\u6765\u9690\u85cf\u7684\u95ee\u9898\u8fd8\u672a\u53ef\u77e5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/gitee.com\/hejunwang\/django32_celery\">https:\/\/gitee.com\/hejunwang\/django32_celery<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">==========================================<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c31\u5230\u8fd9\u91cc\u5427\uff0c\u6563\u4f1a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528Django\u81ea\u5e26\u7684SQLite\u6570\u636e\u5e93\u65f6\uff0c\u63d0\u793a\u9700\u8981\u66f4\u9ad8\u7248\u672c\u3002 \u67e5\u770b\u5f53\u524d\u865a\u62df\u73af\u5883\u4e2d\u81ea\u5e26\u7684SQLite\u7248\u672c \u518d\u770b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-865","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/posts\/865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/comments?post=865"}],"version-history":[{"count":4,"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/posts\/865\/revisions"}],"predecessor-version":[{"id":957,"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/posts\/865\/revisions\/957"}],"wp:attachment":[{"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/media?parent=865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/categories?post=865"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.chan.ink\/index.php\/wp-json\/wp\/v2\/tags?post=865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}