我很困惑如何使用python管理.py来自终端的createsuperuser命令。在
当我运行这个命令时,它会说
在django.db.utils.IntegrityError:重复的键值违反了唯一约束“authtoken_token_user_id_key” 详细信息:密钥(用户标识)=(abcdef@gmail.com电子邮件)已经存在。在
但是,在使用这个命令之前,我删除了数据库,并在删除migrations目录中的000*个文件后重新创建。在
我检查了authtoken_token和user表中是否没有行。 我不知道怎么了。在
请给我一些建议。在
(remoshin) ubuntu@ip-172-31-33-33:~/remoshin/remoshin$ python3 manage.py makemigrations
(remoshin) ubuntu@ip-172-31-33-33:~/remoshin/remoshin$ python3 manage.py migrate
(remoshin) ubuntu@ip-172-31-33-33:~/remoshin/remoshin$ python3 manage.py dbshell
psql (9.5.8)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
remoshin_maindb=# \dt
List of relations
Schema | Name | Type | Owner
--------+-----------------------------------------------+-------+---------
public | auth_group | table | remosys
public | auth_group_permissions | table | remosys
public | auth_permission | table | remosys
public | authtoken_token | table | remosys
public | django_admin_log | table | remosys
public | django_content_type | table | remosys
public | django_migrations | table | remosys
public | django_session | table | remosys
public | remosys_chat_detail_tbl | table | remosys
public | remosys_chat_tbl | table | remosys
public | remosys_clinic_ipaddress_tbl | table | remosys
public | remosys_clinic_open_tbl | table | remosys
public | remosys_clinic_tbl | table | remosys
public | remosys_consultation_menu_tbl | table | remosys
public | remosys_consultation_tbl | table | remosys
public | remosys_department_tbl | table | remosys
public | remosys_error_tbl | table | remosys
public | remosys_menu_tbl | table | remosys
public | remosys_refund_request_tbl | table | remosys
public | remosys_remoshin_doctor_tbl | table | remosys
public | remosys_remoshin_manager_tbl | table | remosys
public | remosys_remoshin_manager_tbl_groups | table | remosys
public | remosys_remoshin_manager_tbl_user_permissions | table | remosys
public | remosys_remoshin_user_tbl | table | remosys
public | remosys_statement_tbl | table | remosys
(25 rows)
remoshin_maindb=# select * from authtoken_token;
key | created | user_id
-----+---------+---------
(0 rows)
remoshin_maindb=# select * from remosys_remoshin_user_tbl;
remoshin_maindb=# select * from authtoken_token_user_id_key";
remoshin_maindb"# select max(id) from authtoken_token_user_id_key;
remoshin_maindb"#
remoshin_maindb=# \q
(remoshin) ubuntu@ip-172-31-33-33:~/remoshin/remoshin$ python3 manage.py createsuperuser
(omit)
File "/home/ubuntu/remoshin/lib/python3.5/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
psycopg2.IntegrityError: duplicate key value violates unique constraint "authtoken_token_user_id_key"
DETAIL: Key (user_id)=(abcdef@gmail.com) already exists.
目前没有回答
相关问题 更多 >
编程相关推荐