- ๐ฅ ๊พธ์คํจ ํ๋๋ ์์ ์๋ ๋ฐฑ์๋ ๊ฐ๋ฐ์์ ๋๋ค.
- ๐ก ์๋ฒ ๊ฐ๋ฐ์ ์๊ฐํ๋ฉฐ ์ธํ๋ผ์ ๊ด์ฌ์ด ๋ง์ต๋๋ค.
- ๐ ๋๋ง์ ์ผ์ ์ฐพ๊ธฐ์ํด ์ด์ฌํ ๋ ธ๋ ฅ์ค์ ๋๋ค.
์ธ์ด ๋ฐ ๋๊ตฌ
social login๊ตฌํํ๊ธฐ ์ํด, ๊ธฐ์กด ๋๋ ํฐ๋ฆฌ์์
urls.py
์ด์ ๊ฐ์ด ์ถ๊ฐํ๊ณ ๋์
1) python manage.py migrate --settigs=settings_heroku
2) git push # ์๋ฃ ํ
3) heroku ps:scale web=1 # ์๋ฒ ์คํํ์ ๋
at=error code=H10 desc = "App crashed" method=GET path= "/"~
๊ฐ ๋์์ ์ฌ๋ฌ๊ฐ์ง ๊ตฌ๊ธ๋ง ํด๋ณธ ๊ฒฐ๊ณผ
https://pythonq.com/so/mysql/963944
db์ญ์ ๋ฅผ ํ๋ผ๊ณ ํ๋ค์??
๊ทธ๋์ ์๋ญ๊ฐ ์ด์ํ๋ค๋ ์๊ฐ์
๋ค์! python manage.py migrate --settings=settings_heroku
๋ฅผ ๋ค์ํ๋
account์ socialaccount๊ฐ ์๋ค๊ณ ํฉ๋๋ค.
๊ทธ๋์ migrations ๋๋ ํฐ๋ฆฌ ์ญ์ ํ, makemigrations ์ migrate๋ฅผ ํ์ ๋
์ ๋ฐ๊ณผ ๋๊ฐ์ ์ํฉ์ด ๋ฐ์ํฉ๋๋ค.
python manage.py showmigrations์ ํตํด ์ ๋ง socialaccount, account๊ฐ ์๋ค์ด๊ฐ๊ฑด์ง ํ์ธํด๋ณด๋,
๋ฐ๊ณผ ๊ฐ์ด migrate์ socialaccount์ account๊ฐ ๋ค์ด๊ฐ ์์ต๋๋ค.
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gd_backend (master)
$ python manage.py showmigrations
account
[ ] 0001_initial
[ ] 0002_email_max_length
admin
[ ] 0001_initial
[ ] 0002_logentry_remove_auto_add
[ ] 0003_logentry_add_action_flag_choices
auth
[ ] 0001_initial
[ ] 0002_alter_permission_name_max_length
[ ] 0003_alter_user_email_max_length
[ ] 0004_alter_user_username_opts
[ ] 0005_alter_user_last_login_null
[ ] 0006_require_contenttypes_0002
[ ] 0007_alter_validators_add_error_messages
[ ] 0008_alter_user_username_max_length
[ ] 0009_alter_user_last_name_max_length
[ ] 0010_alter_group_name_max_length
[ ] 0011_update_proxy_permissions
[ ] 0012_alter_user_first_name_max_length
authtoken
[ ] 0001_initial
[ ] 0002_auto_20160226_1747
[ ] 0003_tokenproxy
contenttypes
[ ] 0001_initial
[ ] 0002_remove_content_type_name
gdapp
[ ] 0001_initial
sessions
[ ] 0001_initial
sites
[ ] 0001_initial
[ ] 0002_alter_domain_unique
social_django
[ ] 0001_initial (2 squashed migrations)
[ ] 0002_add_related_name (2 squashed migrations)
[ ] 0003_alter_email_max_length (2 squashed migrations)
[ ] 0004_auto_20160423_0400 (2 squashed migrations)
[ ] 0005_auto_20160727_2333 (1 squashed migrations)
[ ] 0006_partial
[ ] 0007_code_timestamp
[ ] 0008_partial_timestamp
[ ] 0009_auto_20191118_0520
[ ] 0010_uid_db_index
socialaccount
[ ] 0001_initial
[ ] 0002_token_max_lengths
[ ] 0003_extra_data_default_dict
(gd2venv)
ํ์ฌ ๊ณ ๋ฏผ์ค์ธ๊ฒ ์ ๋ง, ๊ธฐ์กด cleardb๋ฅผ ์ญ์ ํ๊ณ ์๋ก ๋ง๋ค์ด์ผ ํ๋๊ฑด์ง
์๋๋ฉด, ์ด๋ ํ ์ค๋ฅ์ธ์ง ์ฐพ๊ธฐ๊ฐ ํ๋๋ค์ใ ใ
์ ๋ฐฐ๋ ํํธ์์๊น์?ใ ใ
This field is required. (400 error)
๊ฐ ๋ฐ์ํ๊ณ ์์ต๋๋ค.
gdapp\serializers.py
์์ ๋ฌธ์ ๊ฐ ์๋ ๊ฒ ๊ฐ์
์ ๊ธฐ ๋ถ๋ถ์ ์ฃผ์ํ๊ณ ์ ๋ฐ์ดํธ ํ, ์ ์ฉํ๋ ๋๊ฐ์ด field it required๊ฐ ๋ฐ์ํ๋ค์.
๊ตฌ๊ธ๋ง ๊ฒฐ๊ณผ
https://kimdoky.github.io/django/2018/05/01/django-error-required/
blank = True์ NULL = True๋ฅผ ๋ฃ์ผ๋ฉด ์๋ง ํด๊ฒฐ๋ ๊ฒ์ด๋ผ๋ ๋ง์ด ์์ด์ ์ ์ฉํ๋๋ฐ๋, This field is required. (400 error)
๊ฐ ๋ฐ์ํ๋ค์ใ
ใ
์ด๋ฌํ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ ์ด์ ๊ฐ ์ด๋ป๊ฒ ๋๋๊ฑธ๊น์??
์ ๋ฒ ์ฒ๋ผ workspace์์ drop ์์
์ ํ์๊ณ django์์ python manage.py migrate --settings=heroku.settings์ ํ๋ socialaccount์ account๊ฐ ์ ์์ ์ผ๋ก ์คํ๋ ๊ฑธ๊น์??
์ ๋ ์๋ฒ ํฐ์ก์ ๋, ์ง๋ฌธ๋๋ฆฌ๊ธฐ ์ ์ ์ด์์
์ ํ 3๋ฒ์ ๋ ํ๊ฑฐ ๊ฐ์๋ฐ ์๋๋ ๊ฒ ๊ฐ์ต๋๋ค.
db ํ ์ด๋ธ ์ด๊ธฐํ๋ ์ด๋ป๊ฒ ํ์ ๊ฑธ๊น์??
๊ธฐ์กด createsuperuser๋ฅผ ๋ง๋ค์๋๋ฐ ๊ธฐ์ต์ด ๋์ง ์์ต๋๋ค.
kakao, naver ๊ณ์ ์ ์ถ๊ฐํด๋ณด๊ณ ์ถ์ด createsuperuser์ด ํ์ํฉ๋๋ค.
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gd_backend (master)
$ heroku run python manage.py createsuperuser
ยป Warning: heroku update available from 7.53.0 to 7.59.0.
Running python manage.py createsuperuser on โฌข dongagd... up, run.4935 (Free)
Email: [email protected]
Password:
Password (again):
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py",
line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "gdapp_user_username_key"
DETAIL: Key (username)=() already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>
main()
File "/app/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in execute
return super().execute(*args, **options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.9/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 "/app/gdapp/models.py", line 95, in create_superuser
return self.create_user(email, password, **extra_fields)
File "/app/gdapp/models.py", line 84, in create_user
return self._create_user(email, password, **extra_fields)
File "/app/gdapp/models.py", line 78, in _create_user
user.save(using=self._db)
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/auth/base_user.py", line 67, in save
super().save(*args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/base.py", line 726, in save
self.save_base(using=using, force_insert=force_insert,
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/base.py", line 763, in save_base
updated = self._save_table(
File "/app/.heroku/python/lib/python3.9/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 "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/base.py", line 906, in _do_insert
return manager._insert(
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/manager.py",
line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 1270, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1416, in execute_sql
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py",
line 98, in execute
return super().execute(sql, params)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py",
line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py",
line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py",
line 84, in _execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/utils.py", line 90,
in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py",
line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "gdapp_user_username_key"
DETAIL: Key (username)=() already exists.
(gdvenv)
IntegrityError๊ฐ ๋ฐ์ํฉ๋๋ค.
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gd_backend (master)
$ heroku run python manage.py shell
ยป Warning: heroku update available from 7.53.0 to 7.59.0.
Running python manage.py shell on โฌข dongagd... up, run.5995 (Free)
Python 3.9.7 (default, Aug 30 2021, 22:04:11)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import User
>>> User.objects.get(username="[email protected]", is_superuser=True).delete()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/manager.py",
line 187, in __get__
raise AttributeError(
AttributeError: Manager isn't available; 'auth.User' has been swapped for 'gdapp.User'>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>>
now exiting InteractiveConsole...
(gdvenv)
AttibuteError, ๋งค๋์ ๊ฐ ์ด์ฉํ ์ ์์ต๋๋ค. auth.User๋ฅผ gdapp.User๋ก ๋ฐ๋์์ต๋๋ค. ๋ผ๋ ๊ฒ์ ๋ณด๊ณ
settings
์ auth.User๋ฅผ ์ถ๊ฐํด์ผ๊ฒ ๊ตฌ๋ ๋ผ๋ ์๊ฐ์ auth.User๋ฅผ ์ถ๊ฐํ์์ต๋๋ค.
$ git push heroku master # ๊น์ง๋ ์๋์ง๋ง,
$ heroku run python manage.py migrate # ์ค๋ฅ
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gd_backend (master)
$ heroku run python manage.py migrate
ยป Warning: heroku update available from 7.53.0 to 7.59.0.
Running python manage.py migrate on โฌข dongagd... up, run.5025 (Free)
Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>
main()
File "/app/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 363, in execute
settings.INSTALLED_APPS
File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__
self._setup(name)
File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/__init__.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/app/gdproject/settings.py", line 18, in <module>
User = get_user_model()
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/auth/__init__.py", line 160, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL, require_ready=False)
File "/app/.heroku/python/lib/python3.9/site-packages/django/apps/registry.py", line 201, in get_model
self.check_apps_ready()
File "/app/.heroku/python/lib/python3.9/site-packages/django/apps/registry.py", line 136, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
(gdvenv)
์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
๋ฐ์ํด์ ๊ตฌ๊ธ๋ง์ ํด๋ณด๋
settings์ django.setup()์ ์ถ๊ฐํ๋
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gd_backend (master)
$ heroku run python manage.py migrate
ยป Warning: heroku update available from 7.53.0 to 7.59.0.
Running python manage.py migrate on โฌข dongagd... up, run.2957 (Free)
Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>
main()
File "/app/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 92, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/loader.py", line 53, in __init__
self.build_graph()
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/loader.py", line 220, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/recorder.py", line 77, in applied_migrations
if self.has_table():
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/recorder.py", line 55, in has_table
with self.connection.cursor() as cursor:
File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/base/base.py", line 259, in cursor
return self._cursor()
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/dummy/base.py", line 20, in complain
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
(gdvenv)
์ด๋ฌํ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋คใ ใ
์ค๋ ํ๋ฃจ์ข ์ผ ์ฐพ๊ณ ์์ง๋ง ํด๊ฒฐํ์ง ๋ชปํ๊ณ ์์ด ์ ๊ฒ ๋์์ต๋๋คใ ใ
login ํ๋ ๋ถ๋ถ์์ str object์์ decode ์์ฑ์ด ์์ด ์ ์ฉ์ด ์๋๋ค๊ณ ํฉ๋๋ค.
๊ตฌ๊ธ๋ง ํด๋ณธ ๊ฒฐ๊ณผ, token์ decode ํจ์์ ์ธ์๋ก utf-8์ ์ค ์, ํด๊ฒฐํ ์ ์๋ค๊ณ ํ์ฌ ์ ์ฉํ์์ต๋๋ค.
serializers๋ฅผ ๋ณ๊ฒฝํ์์๋
๋ณ๊ฒฝ๋ ๋ด์ฉ์ด ์๋ค๊ณ ํฉ๋๋ค. (serializers ๋ถ๋ถ์ด ๋ณ๊ฒฝ๋์์์ ๋ง์ด๊ทธ๋ ์ด์ ์ด ์ ์ฉ์ด ๋์ด์ผ ํ๋๋ฐ ์๋๋ ๊ฒ ๊ฐ์ต๋๋ค.)
๋ค์ ํ๋ฒ login์ ํด๋ณด๋ ๋๊ฐ์ ๊ฒฐ๊ณผ๊ฐ ๋์ต๋๋ค.
์ด์ธ๋ก ๋ง์ฝ email์ด๋ password๊ฐ ๋ค๋ฅผ ๊ฒฝ์ฐ๋ ์์คํ๋ฉ๋๋ค.
๊ฑฐ์ ๋ค๋ ๊ฒ ๊ฐ์๋ฐ, seralizer์์ ๋ณ๊ฒฝ์ ํ์์๋ migrate์์ update๋ ๋ด์ฉ์ด ์๋ค๋ ๊ฒ์ด ์ ๋ง ์ดํด๊ฐ ์๋ฉ๋๋ค.
email, password๋ฅผ ์ ์์ ์ผ๋ก ์
๋ ฅํ์ ๋ ์คํ์ด ๋์ง ์๊ณ ์ค๋ฅ๊ฐ ๋ฐ์ํ๊ณ ์์ต๋๋ค.
a) makemigrations์ ํด์ฃผ์์ต๋๋ค.
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gd_backend (master)
$ python manage.py makemigrations
Migrations for 'account':
D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\allauth\account\migrations\0003_auto_20211
012_1629.py
- Alter field id on emailaddress
- Alter field id on emailconfirmation
Migrations for 'socialaccount':
D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\allauth\socialaccount\migrations\0004_auto
_20211012_1629.py
- Alter field id on socialaccount
- Alter field id on socialapp
- Alter field id on socialtoken
(gd2venv)
์ฌ๊ธฐ์ socialaccount, socialapp, socialtoken, emailaddress, emialconfirmation ์ด ์์ ๋์๋ค๊ณ ํฉ๋๋ค.
์์ ๋ ์ด์ ๊ฐ INSTALLED_APPS์ provider naver๋ฅผ ์ถ๊ฐํด์ ๋๊ฑธ๊น์??
์๋๋ฉด ์ด์ ์ ๋ณ๊ฒฝํ social ์ด ์ถ๊ฐ๋๊ฑธ๊น์??
b) migrate
$ python manage.py migrate --settings=gdproject.settings_heroku
Operations to perform:
Apply all migrations: account, admin, auth, authtoken, contenttypes, gdapp, sessions, sites, social_django
, socialaccount
Running migrations:
Applying account.0003_auto_20211012_1629... OK
Applying socialaccount.0004_auto_20211012_1629... OK
(gd2venv)
migrate๋๋ ์ ์ฉ๋์๋ค๊ณ ํฉ๋๋ค.
์ง๋ฌธ
[1] ์ฒซ ๋ฒ์งธ ์ง๋ฌธ
2)์์ ๋ณด์ด๋ ๊ฒ๊ณผ ๊ฐ์ด SourceTree์์
๋ฅผ ํด์ฃผ์์ต๋๋ค. ํ์ง๋ง, ๊ทธ๋ํ์์๋ ํ๋์ ์ค master๋ง ์ด์ฉํด์ push ๋์๋ค๊ณ ๋ํ๋๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋ธ๋์น๋ฅผ ์์ฑํด๋ ์ด๋ป๊ฒ ๊ทธ๋ํ์์๋ ํ์๊ฐ ๋์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ด์ ๊ฐ ์ด๋ป๊ฒ ๋๋๊ฑธ๊น์??
[2] ๋ ๋ฒ์งธ ์ง๋ฌธ
a) makemigrations์ ํด์ฃผ์์ต๋๋ค.
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gd_backend (master)
$ python manage.py makemigrations
Migrations for 'account':
D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\allauth\account\migrations\0003_auto_20211
012_1629.py
- Alter field id on emailaddress
- Alter field id on emailconfirmation
Migrations for 'socialaccount':
D:\Computer_Science\School\GraduationWork\gd2venv\lib\site-packages\allauth\socialaccount\migrations\0004_auto
_20211012_1629.py
- Alter field id on socialaccount
- Alter field id on socialapp
- Alter field id on socialtoken
(gd2venv)
์ฌ๊ธฐ์ socialaccount, socialapp, socialtoken, emailaddress, emialconfirmation ์ด ์์ ๋์๋ค๊ณ ํฉ๋๋ค.
์์ ๋ ์ด์ ๊ฐ INSTALLED_APPS์ provider naver๋ฅผ ์ถ๊ฐํด์ ๋๊ฑธ๊น์??
์๋๋ฉด ์ด์ ์ ๋ณ๊ฒฝํ social ์ด ์ถ๊ฐ๋๊ฑธ๊น์??
heroku์์ showmigrations๋ฅผ ํ์ ๋
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gdproject (master)
$ heroku run python manage.py showmigrations
ยป Warning: heroku update available from 7.53.0 to 7.59.0.
Running python manage.py showmigrations on โฌข dongagd... up, run.8258 (Free)
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
[X] 0003_logentry_add_action_flag_choices
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_alter_validators_add_error_messages
[X] 0008_alter_user_username_max_length
[X] 0009_alter_user_last_name_max_length
[X] 0010_alter_group_name_max_length
[X] 0011_update_proxy_permissions
[X] 0012_alter_user_first_name_max_length
authtoken
[X] 0001_initial
[X] 0002_auto_20160226_1747
[X] 0003_tokenproxy
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
gdapp
[X] 0001_initial
[X] 0002_alter_user_options
[X] 0003_alter_user_options
[X] 0004_auto_20210530_1413
sessions
[X] 0001_initial
sites
[X] 0001_initial
[X] 0002_alter_domain_unique
(gdvenv)
๊ธฐ๋ณธ python์์ showmigrations์ ํ์ ๋
KChang@LAPTOP-H1595VAD MINGW64 /d/Computer_Science/School/GraduationWork/gdproject (master)
$ python manage.py showmigrations
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
[X] 0003_logentry_add_action_flag_choices
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_alter_validators_add_error_messages
[X] 0008_alter_user_username_max_length
[X] 0009_alter_user_last_name_max_length
[X] 0010_alter_group_name_max_length
[X] 0011_update_proxy_permissions
[X] 0012_alter_user_first_name_max_length
authtoken
[X] 0001_initial
[X] 0002_auto_20160226_1747
[X] 0003_tokenproxy
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
gdapp
[X] 0001_initial
sessions
[X] 0001_initial
sites
[X] 0001_initial
[X] 0002_alter_domain_unique
social_django
[X] 0001_initial (2 squashed migrations)
[X] 0002_add_related_name (2 squashed migrations)
[X] 0003_alter_email_max_length (2 squashed migrations)
[X] 0004_auto_20160423_0400 (2 squashed migrations)
[X] 0005_auto_20160727_2333 (1 squashed migrations)
[X] 0006_partial
[X] 0007_code_timestamp
[X] 0008_partial_timestamp
[X] 0009_auto_20191118_0520
[X] 0010_uid_db_index
(gdvenv)
gdapp๊ณผ social_django๊ฐ heroku migrations์์ ๋ณด์ด์ง ์์ต๋๋ค.
2021-10-03T13:22:35.486142+00:00 app[web.1]: /app/.heroku/python/lib/python3.9/site-packages/rest_framework/pagination.py:200: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'gdapp.models.Location'> QuerySet.
2021-10-03T13:22:35.486151+00:00 app[web.1]: paginator = self.django_paginator_class(queryset, page_size)
2021-10-03T13:22:35.604978+00:00 app[web.1]: Internal Server Error: /location/
2021-10-03T13:22:35.604979+00:00 app[web.1]: Traceback (most recent call last):
2021-10-03T13:22:35.604980+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
2021-10-03T13:22:35.604980+00:00 app[web.1]: return self.cursor.execute(sql, params)
2021-10-03T13:22:35.604981+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "location" does not exist
2021-10-03T13:22:35.604982+00:00 app[web.1]: LINE 1: SELECT COUNT(*) AS "__count" FROM "location"
2021-10-03T13:22:35.604982+00:00 app[web.1]: ^
2021-10-03T13:22:35.604982+00:00 app[web.1]:
2021-10-03T13:22:35.604983+00:00 app[web.1]:
2021-10-03T13:22:35.604983+00:00 app[web.1]: The above exception was the direct cause of the following exception:
2021-10-03T13:22:35.604983+00:00 app[web.1]:
2021-10-03T13:22:35.604983+00:00 app[web.1]: Traceback (most recent call last):
2021-10-03T13:22:35.604984+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
2021-10-03T13:22:35.604984+00:00 app[web.1]: response = get_response(request)
2021-10-03T13:22:35.604985+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
2021-10-03T13:22:35.604985+00:00 app[web.1]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
2021-10-03T13:22:35.604986+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
2021-10-03T13:22:35.604986+00:00 app[web.1]: return view_func(*args, **kwargs)
2021-10-03T13:22:35.604986+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view
2021-10-03T13:22:35.604987+00:00 app[web.1]: return self.dispatch(request, *args, **kwargs)
2021-10-03T13:22:35.604987+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
2021-10-03T13:22:35.604988+00:00 app[web.1]: response = self.handle_exception(exc)
2021-10-03T13:22:35.604988+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
2021-10-03T13:22:35.604988+00:00 app[web.1]: self.raise_uncaught_exception(exc)
2021-10-03T13:22:35.604989+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
2021-10-03T13:22:35.604989+00:00 app[web.1]: raise exc
2021-10-03T13:22:35.604990+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
2021-10-03T13:22:35.604990+00:00 app[web.1]: response = handler(request, *args, **kwargs)
2021-10-03T13:22:35.604991+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/rest_framework/mixins.py", line 40, in list
2021-10-03T13:22:35.604991+00:00 app[web.1]: page = self.paginate_queryset(queryset)
2021-10-03T13:22:35.604991+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/rest_framework/generics.py", line 171, in paginate_queryset
2021-10-03T13:22:35.604992+00:00 app[web.1]: return self.paginator.paginate_queryset(queryset, self.request, view=self)
2021-10-03T13:22:35.604993+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/rest_framework/pagination.py", line 204, in paginate_queryset
2021-10-03T13:22:35.604994+00:00 app[web.1]: self.page = paginator.page(page_number)
2021-10-03T13:22:35.604994+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/paginator.py", line 76, in page
2021-10-03T13:22:35.604995+00:00 app[web.1]: number = self.validate_number(number)
2021-10-03T13:22:35.604995+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/paginator.py", line 54, in validate_number
2021-10-03T13:22:35.604995+00:00 app[web.1]: if number > self.num_pages:
2021-10-03T13:22:35.604996+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
2021-10-03T13:22:35.604997+00:00 app[web.1]: res = instance.__dict__[self.name] = self.func(instance)
2021-10-03T13:22:35.604997+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/paginator.py", line 103, in num_pages
2021-10-03T13:22:35.604997+00:00 app[web.1]: if self.count == 0 and not self.allow_empty_first_page:
2021-10-03T13:22:35.604998+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
2021-10-03T13:22:35.604998+00:00 app[web.1]: res = instance.__dict__[self.name] = self.func(instance)
2021-10-03T13:22:35.604999+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/paginator.py", line 97, in count
2021-10-03T13:22:35.604999+00:00 app[web.1]: return c()
2021-10-03T13:22:35.604999+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 412, in count
2021-10-03T13:22:35.605000+00:00 app[web.1]: return self.query.get_count(using=self.db)
2021-10-03T13:22:35.605000+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/query.py", line 519, in get_count
2021-10-03T13:22:35.605000+00:00 app[web.1]: number = obj.get_aggregation(using, ['__count'])['__count']
2021-10-03T13:22:35.605001+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/query.py", line 504, in get_aggregation
2021-10-03T13:22:35.605001+00:00 app[web.1]: result = compiler.execute_sql(SINGLE)
2021-10-03T13:22:35.605001+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
2021-10-03T13:22:35.605002+00:00 app[web.1]: cursor.execute(sql, params)
2021-10-03T13:22:35.605002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 98, in execute
2021-10-03T13:22:35.605002+00:00 app[web.1]: return super().execute(sql, params)
2021-10-03T13:22:35.605003+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
2021-10-03T13:22:35.605003+00:00 app[web.1]: return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
2021-10-03T13:22:35.605008+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
2021-10-03T13:22:35.605008+00:00 app[web.1]: return executor(sql, params, many, context)
2021-10-03T13:22:35.605008+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
2021-10-03T13:22:35.605009+00:00 app[web.1]: return self.cursor.execute(sql, params)
2021-10-03T13:22:35.605009+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
2021-10-03T13:22:35.605010+00:00 app[web.1]: raise dj_exc_value.with_traceback(traceback) from exc_value
2021-10-03T13:22:35.605010+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
2021-10-03T13:22:35.605011+00:00 app[web.1]: return self.cursor.execute(sql, params)
2021-10-03T13:22:35.605011+00:00 app[web.1]: django.db.utils.ProgrammingError: relation "location" does not exist
2021-10-03T13:22:35.605012+00:00 app[web.1]: LINE 1: SELECT COUNT(*) AS "__count" FROM "location"
2021-10-03T13:22:35.605012+00:00 app[web.1]: ^
2021-10-03T13:22:35.605012+00:00 app[web.1]:
2021-10-03T13:22:35.606184+00:00 app[web.1]: 10.1.45.233 - - [03/Oct/2021:13:22:35 +0000] "GET /location/ HTTP/1.1" 500 171674 "https://dongagd.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36 Edg/94.0.992.31"
500๋ฒ ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉฐ,
psycopg2.errors.UndefinedTable: relation "location" does not exist
location -> Location์ผ๋ก ๋ฐ๊ฟ์ผํ๋ ๊ฑด์ง ๋ฐ๊พธ๋ ค๊ณ ํ๋
ํด๋์ค name ์ด์ธ๋ locaiton ๋จ์ด๊ฐ ๋ณด์ด์ง ์๋๋ค. (register ๋ฑ๋กํ๋๋ฐ์์ location์ ์ฌ์ฉํ๊ธฐ๋ ํ์ง๋ง ๋ณ ์๋ชป๋๊ฒ์ ์์ด ๋ณด์ธ๋ค.)
location, diary ๋ฑ ๊ธฐ๋ณธ django์์๋ ํ์ด์ง๊ฐ ์คํ ๋์ง๋ง, heroku์์๋ ์คํ์ด ๋์ง์๋๋ค.
1)์ ์ถ์ธกํ๊ณ migrate์ ํ๋ฒ ์ง์๋ณด๊ณ ์ถ์ง๋ง ํ์ผ์์น๊ฐ ์ด๋์๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
์ด์ ๋ง๋ค์๋ ์ฐ๋๊ณผ์ ์ ์ง๋ฌธ์ด ์์ต๋๋ค.
์ฌ๊ธฐ์ ์ดํด๊ฐ ์๋๋ ๋ถ๋ถ์ด ์์ต๋๋ค.
1)์์ workbench๋ฅผ ์ด์ฉํ์ฌ ์์ฑ๋ models, serializers, views, urls ๋ฑ์ด sqlite์ ์ง์ ๋ฉ๋๋ค.
(heroku ๋์
๋๊ธฐ ์ ๊น์ง)
2) ์ด์ sqlite๊ฐ ์๋, heroku_database, cleardb์ ์ ์ฅํ๊ธฐ ์ํด settings_heroku๋ฅผ ์์ฑํ์ฌ
Procfile -> gdproject.wsgi -> runserver with settings_heroku๋ฅผ ํตํด
์ง์ ํ DB๊ฐ sqlite์์ heroku, cleardb๋ก ๋ฐ๋๊ฑธ๊น์??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.