问题描述
我正在从AWS运行linux red hat环境.
I am running a linux red hat environment from AWS.
我已遵循将sqlite3升级到最新"版本的所有说明.版本.
I have followed every instruction for upgrading sqlite3 to the "latest" version.
我正在运行python 3.9.2(并已使用 LD_RUN_PATH =/usr/local/lib ./configure
重新编译)和Django版本4.
I am running python 3.9.2 (and have recompiled it with LD_RUN_PATH=/usr/local/lib ./configure
) and django version 4.
我已经设置了一个虚拟环境来安装和运行django.我已将激活脚本更改为包括 export LD_LIBRARY_PATH ="/usr/local/lib"
I have set up a virtual environment to install and run django. I have changed the activate script to include export LD_LIBRARY_PATH="/usr/local/lib"
在运行 python manage.py runserver
时,出现错误 django.db.utils.NotSupportedError:deterministic = True需要SQLite 3.8.3或更高版本
.我已经打开文件/home/ec2-user/django/django/db/backends/sqlite3/base.py
(发生错误的位置),并且在出现错误的行之后立即包含打印内容声明:
Upon running python manage.py runserver
, I get the error django.db.utils.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
. I have opened the file /home/ec2-user/django/django/db/backends/sqlite3/base.py
(where the error occurs) and right after the line with the error have include a print statement:
print("**************************\n" +
str(Database.sqlite_version) +
"\n" + str(Database.sqlite_version_info) +
"\n**************************")
哪个会重播:
**************************
3.28.0
(3, 28, 0)
**************************
**************************
3.28.0
(3, 28, 0)
**************************
请让我知道还需要什么其他信息.我已经在 stack
上上下搜索,却找不到正确的解决方案来解决这一问题.
Please let me know what additional information is needed. I have searched up and down the stack
and can't find the right solution to pop
this one off.
提前谢谢!
编辑
这是回溯:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/ec2-user/django/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/home/ec2-user/django/django/utils/asyncio.py", 21 in inner
return func(*args, **kwargs)
File "/home/ec2-user/django/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/ec2-user/django/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/home/ec2-user/django/django/db/backends/sqlite3/base.py", line 210, in get_new_connection
create_deterministic_function('django_date_extract', 2, _sqlite_datetime_extract)
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/python/lib/python/3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/opt/python39/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/home/ec2-user/django/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/ec2-user/django/django/core/management/commands/runserver.py", line 126, in inner_run
self.check_migrations()
File "/home/ec2-user/django/django/core/management/base.py", line 486, in check_migrations
executor = MigrationExecutor(connectsion[DEFAULT_DB_ALIAS])
File "/home/ec2-user/django/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/home/ec2-user/django/django/db/migrations/loader.py", line 53, in __init__
self.build_graph()
File "/home/ec2-user/django/django/db/migrations/loader.py", line 220, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/home/ec2-user/django/django/db/migrations/recorder.py", line 77, in applied_migrations
if self.has_table():
File "/home/ec2-user/django/django/db/migrations/recorder.py", line 55, in has_table
with self.connection.cursor() as cursor:
File "/home/ec2-user/django/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/home/ec2-user/django/django/db/backends/base/base.py", line 259, in cursor
return self._cursor()
File "/home/ec2-user/django/django/db/backends/base/base.py", line 235, in _cursor
self.ensure_connection()
File "/home/ec2-user/django/djanog/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/home/ec2-user/django/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/home/ec2-user/django/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/ec2-user/django/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/home/ec2-user/django/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/home/ec2-user/django/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/ec2-user/django/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/home/ec2-user/django/django/db/backends/sqlite3/base.py", line 210, in get_new_connection
create_deterministic_function('django_date_extract', 2, _sqlite_datetime_extract)
django.db.utils.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
推荐答案
目前我能想到的最好的办法是进入/home/ec2-user/django/django/db/backends/sqlite3/base.py
,将 get_new_connection()
中的函数变量 deterministic = True
更改为 deterministic = False
...
The best I can figure at the moment is to go into /home/ec2-user/django/django/db/backends/sqlite3/base.py
, change the function variable deterministic=True
in get_new_connection()
to deterministic=False
...
这将消除错误,但似乎是一种超级欺骗的解决方案.如果有更好的解决方法,请告诉我.
This will remove the error, but seems like a super cheaty solution. If anyone has a better fix, please let me know.
这篇关于Django-Deterministic = True在运行python manage.py runserver时需要SQLite 3.8.3或更高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!