我今天决定更改默认id,因为我考虑到了项目的可扩展性。由于我将用户主主键更改为UUID,我遇到了一系列错误,其中一些错误可以通过stackoverflow上的一些问题解决。
我使用“oauth2_provider_access令牌”从oauth2_provider进行身份验证。
我真的不知道另一个是从哪里来的,但当我尝试我的API时,我被卡住了。
下面是我的错误日志
[08/Feb/2023 08:46:54] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0 Internal Server Error: /admin/ Traceback (most recent call last): File "/home/user_me/f_project/softwareAPI/software_venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) psycopg2.errors.UndefinedFunction: operator does not exist: bigint = uuid LINE 1: ...NER JOIN "users" ON ("django_admin_log"."user_id" = "users".... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/user_me/f_project/softwareAPI/software_venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/home/user_me/f_project/softwareAPI/software_venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 220, in _get_response response = response.render() File "/home/user_me/f_project/softwareAPI/software_venv/lib/python3.10/site-packages/django/template/response.py", line 114, in render . . . . . . File "/home/user_me/f_project/softwareAPI/software_venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute with self.db.wrap_database_errors: File "/home/user_me/f_project/softwareAPI/software_venv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/home/user_me/f_project/softwareAPI/software_venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: operator does not exist: bigint = uuid LINE 1: ...NER JOIN "users" ON ("django_admin_log"."user_id" = "users".... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. [08/Feb/2023 08:46:54] "GET /admin/ HTTP/1.1" 500 449397 Not Found: /favicon.ico [08/Feb/2023 08:46:54] "GET /favicon.ico HTTP/1.1" 404 2986
有人能帮忙吗?
如有其他细节,请评论。
我期望/login和/register API能够成功工作,但出现了上面的错误。