Closed KC64ML closed 3 years ago
음 이전 커밋내역 확인해서 돌려놓고 다시 해볼까요? Heroku에 배포된 서버와 그 서버가 바라보는 DB에 슈퍼유저가 생성되어야하네요?
python manage.py createsuperuser --settings=gdproject.settings_heroku
입력하면 슈퍼유저 생성 가능해요.
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gd_backend (master)
$ python manage.py createsuperuser --settings=gdproject.settings_heroku
Email: lkc263@naver.com
Password:
Password (again):
Traceback (most recent call last):
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\backends\mysql\base.py", line 73, in execute
return self.cursor.execute(query, args)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\cursors.py", line 148, in execute
result = self._query(query)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\cursors.py", line 310, in _query
conn.query(q)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\connections.py", line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
result.read()
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\connections.py", line 1156, in read
first_packet = self.connection._read_packet()
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
packet.raise_for_error()
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, "Duplicate entry '' for key 'username'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Computer_Science\School\GraduationWork\gd_backend\manage.py", line 22, in <module>
main()
File "D:\Computer_Science\School\GraduationWork\gd_backend\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 79, in execute
return super().execute(*args, **options)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\core\management\base.py", line 398, in execute
output = self.handle(*args, **options)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 189, in handle
self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
File "D:\Computer_Science\School\GraduationWork\gd_backend\gdapp\models.py", line 95, in create_superuser
return self.create_user(email, password, **extra_fields)
File "D:\Computer_Science\School\GraduationWork\gd_backend\gdapp\models.py", line 84, in create_user
return self._create_user(email, password, **extra_fields)
File "D:\Computer_Science\School\GraduationWork\gd_backend\gdapp\models.py", line 78, in _create_user
user.save(using=self._db)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\contrib\auth\base_user.py", line 67, in save
super().save(*args, **kwargs)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\models\base.py", line 726, in save
self.save_base(using=using, force_insert=force_insert,
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\models\base.py", line 763, in save_base
updated = self._save_table(
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\models\base.py", line 868, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\models\base.py", line 906, in _do_insert
return manager._insert(
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\models\query.py", line 1270, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\models\sql\compiler.py", line 1416, in execute_sql
cursor.execute(sql, params)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\backends\utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\django\db\backends\mysql\base.py", line 73, in execute
return self.cursor.execute(query, args)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\cursors.py", line 148, in execute
result = self._query(query)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\cursors.py", line 310, in _query
conn.query(q)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\connections.py", line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
result.read()
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\connections.py", line 1156, in read
first_packet = self.connection._read_packet()
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
packet.raise_for_error()
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
django.db.utils.IntegrityError: (1062, "Duplicate entry '' for key 'username'")
(gd2venv)
테스하기위해, 말씀하신 --settings=gdproject.settings_heroku 입력시 django.db.utils.IntegrityError가 발생합니다.
음... superuser가 이미 존재하여 발생하는걸까요??
createsuperuser 계정 추가에서 오류
기존 createsuperuser를 만들었는데 기억이 나지 않습니다.
kakao, naver 계정을 추가해보고 싶어 createsuperuser이 필요합니다.
1) 새로운 superuser를 만들려고 시도하였습니다.
IntegrityError가 발생합니다.
2) shell 편집기로 들어가, 비밀번호를 변경하려고 하였습니다.
AttibuteError, 매니저가 이용할 수 없습니다. auth.User를 gdapp.User로 바뀌었습니다. 라는 것을 보고
settings
에 auth.User를 추가해야겠구나 라는 생각에 auth.User를 추가하였습니다.와 같은 오류가 발생합니다.
발생해서 구글링을 해보니
settings에 django.setup()을 추가하니
이러한 오류가 발생합니다ㅠㅠ
오늘 하루종일 찾고 있지만 해결하지 못하고 있어 적게 되었습니다ㅠㅠ