GithubHelp home page GithubHelp logo

gd_backend's Introduction

๐Ÿ‘‹ ๋ฐ˜๊ฐ‘์Šต๋‹ˆ๋‹ค!

12

  • ๐Ÿ”ฅ ๊พธ์ค€ํ•จ ํ•˜๋‚˜๋Š” ์ž์‹  ์žˆ๋Š” ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ์ž์ž…๋‹ˆ๋‹ค.
  • ๐Ÿ“ก ์„œ๋ฒ„ ๊ฐœ๋ฐœ์„ ์ƒ๊ฐํ•˜๋ฉฐ ์ธํ”„๋ผ์— ๊ด€์‹ฌ์ด ๋งŽ์Šต๋‹ˆ๋‹ค.
  • ๐Ÿ˜Ž ๋‚˜๋งŒ์˜ ์ผ์„ ์ฐพ๊ธฐ์œ„ํ•ด ์—ด์‹ฌํžˆ ๋…ธ๋ ฅ์ค‘์ž…๋‹ˆ๋‹ค.

์–ธ์–ด ๋ฐ ๋„๊ตฌ

gd_backend's People

Contributors

aciddust avatar kc64ml avatar

Watchers

 avatar  avatar

gd_backend's Issues

social login ๊ตฌํ˜„ํ•˜๋˜ ์ค‘, ์„œ๋ฒ„๊ฐ€ ์‹คํ–‰๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

ํ˜„์žฌ ์ƒํ™ฉ (๊ตฌ๊ธ€, ๋„ค์ด๋ฒ„ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ๊ตฌํ˜„ํ•˜๋˜ ์ค‘)

social login๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด, ๊ธฐ์กด ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ

  1. settings

์‚ฌ์ง„2

์‚ฌ์ง„1

urls.py

allauth

์ด์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•˜๊ณ  ๋‚˜์„œ

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์‚ญ์ œ

db์‚ญ์ œ๋ฅผ ํ•˜๋ผ๊ณ  ํ•˜๋„ค์š”??

๊ทธ๋ž˜์„œ ์•„๋ญ”๊ฐ€ ์ด์ƒํ•˜๋‹ค๋Š” ์ƒ๊ฐ์—

๋‹ค์‹œ! python manage.py migrate --settings=settings_heroku๋ฅผ ๋‹ค์‹œํ•˜๋‹ˆ

account์™€ socialaccount๊ฐ€ ์—†๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋ž˜์„œ migrations ๋””๋ ‰ํ„ฐ๋ฆฌ ์‚ญ์ œํ›„, makemigrations ์™€ migrate๋ฅผ ํ–ˆ์„ ๋•Œ

์œ„ ๋ฐ‘๊ณผ ๋˜‘๊ฐ™์€ ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

๋ฐœ์ƒ1

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) ๋ฐœ์ƒ

ํ˜„์žฌ ์˜ค๋ฅ˜ ์ƒํ™ฉ

bad requeset

This field is required. (400 error)

๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

gdapp\serializers.py์—์„œ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๊ฒƒ ๊ฐ™์•„

Inkedfield_LI

์ €๊ธฐ ๋ถ€๋ถ„์„ ์ฃผ์„ํ•˜๊ณ  ์—…๋ฐ์ดํŠธ ํ›„, ์ ์šฉํ•˜๋‹ˆ ๋˜‘๊ฐ™์ด field it required๊ฐ€ ๋ฐœ์ƒํ•˜๋„ค์š”.

๊ตฌ๊ธ€๋ง ๊ฒฐ๊ณผ

https://kimdoky.github.io/django/2018/05/01/django-error-required/

Inkedmodels_LI

blank = True์™€ NULL = True๋ฅผ ๋„ฃ์œผ๋ฉด ์•„๋งˆ ํ•ด๊ฒฐ๋  ๊ฒƒ์ด๋ผ๋Š” ๋ง์ด ์žˆ์–ด์„œ ์ ์šฉํ–ˆ๋Š”๋ฐ๋„, This field is required. (400 error)๊ฐ€ ๋ฐœ์ƒํ•˜๋„ค์š”ใ… ใ… 

์ด๋Ÿฌํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ์ด์œ ๊ฐ€ ์–ด๋–ป๊ฒŒ ๋˜๋Š”๊ฑธ๊นŒ์š”??

2์ผ์ „ ํ•ด๊ฒฐ ๋ฐฉ์•ˆ์— ๋Œ€ํ•ด ์งˆ๋ฌธ์ด ์žˆ์Šต๋‹ˆ๋‹ค!

1. migrations์„ ํ–ˆ๋Š”๋ฐ ์ œ๋Œ€๋กœ ์ž‘๋™ํ•˜์ง€ ์•Š์•„, ํ…Œ์ด๋ธ”๋“ค์„ ๋‹ค dropํ•ด์„œ ๋‹ค์‹œ migrations์„ ์‹œ์ผœ ํ•ด๊ฒฐ๋˜์—ˆ๋‹ค.

์ €๋ฒˆ ์ฒ˜๋Ÿผ workspace์—์„œ drop ์ž‘์—…์„ ํ•˜์‹œ๊ณ  django์—์„œ python manage.py migrate --settings=heroku.settings์„ ํ•˜๋‹ˆ socialaccount์™€ account๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰๋œ ๊ฑธ๊นŒ์š”??
์ €๋Š” ์„œ๋ฒ„ ํ„ฐ์กŒ์„ ๋•Œ, ์งˆ๋ฌธ๋“œ๋ฆฌ๊ธฐ ์ „์— ์ด์ž‘์—…์„ ํ•œ 3๋ฒˆ์ •๋„ ํ•œ๊ฑฐ ๊ฐ™์€๋ฐ ์•ˆ๋˜๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

db ํ…Œ์ด๋ธ” ์ดˆ๊ธฐํ™”๋Š” ์–ด๋–ป๊ฒŒ ํ•˜์‹ ๊ฑธ๊นŒ์š”??

  • ์™ธ๋ž˜ํ‚ค ์ œ์•ฝ??

2. Revert์— ๊ด€ํ•˜์—ฌ ์งˆ๋ฌธ์ด ์žˆ์Šต๋‹ˆ๋‹ค! ์„œ๋ฒ„ ํ„ฐ์กŒ์„ ๋•Œ Revert ์ž‘์—…ํ•˜๋‹ค๊ฐ€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์—ˆ๋Š”๋ฐ Revert๋Š” ์–ด๋–ป๊ฒŒ ํ•˜๋Š” ๊ฒƒ์ผ๊นŒ์š”??

  • ๋”๋ธŒํด๋ฆญํ•˜๋ฉด ์•Œ์•„์„œ ์ด์ „ ์ปค๋ฐ‹ ์ƒํƒœ๋กœ ๋Œ์•„๊ฐ€๊ณ  ํ—ค๋“œ๋งŒ ์˜ฎ๊ธฐ๋ฉด ๋œ๋‹ค.
  • ๊ทธ๋ ‡๊ฒŒ ํ•ด์„œ ๋ธŒ๋žœ์น˜ ๋”ฐ์„œ ์ž‘์—…ํ•œ๋‹ค??

3. ํ•„๋“œ ์ •๋ณด๋ฅผ ๋ฐ”๊ฟจ๋Š”๋ฐ, ๊ธฐ์กด migration์„ ์ œ๊ฑฐํ•˜๊ณ  ๋‹ค์‹œ migration์„ ํ•ด์„œ DB์— ๋ฐ˜์˜ํ•˜๋ฉด ์—๋Ÿฌ๊ฐ€ ํ„ฐ์ง„๋‹ค. ์ด๋Ÿด๊ฒฝ์šฐ db ์ดˆ๊ธฐํ™”๋ฅผ ํ•ด์•ผ๊ฒ ์ฃ ??

4. settings ์—์„œ Debug True๋ž€??

์†Œ์…œ ๋กœ๊ทธ์ธ์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด admin์— ์ ‘๊ทผํ•ด์•ผํ•˜๋Š”๋ฐ createsuperuser ๊ณ„์ • ์ถ”๊ฐ€๊ฐ€ ์•ˆ๋ฉ๋‹ˆ๋‹คใ… ใ… 

createsuperuser ๊ณ„์ • ์ถ”๊ฐ€์—์„œ ์˜ค๋ฅ˜

๊ธฐ์กด createsuperuser๋ฅผ ๋งŒ๋“ค์—ˆ๋Š”๋ฐ ๊ธฐ์–ต์ด ๋‚˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

kakao, naver ๊ณ„์ •์„ ์ถ”๊ฐ€ํ•ด๋ณด๊ณ  ์‹ถ์–ด createsuperuser์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

  1. ์ƒˆ๋กœ์šด superuser๋ฅผ ๋งŒ๋“ค๋ ค๊ณ  ์‹œ๋„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
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๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

  1. shell ํŽธ์ง‘๊ธฐ๋กœ ๋“ค์–ด๊ฐ€, ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๋ณ€๊ฒฝํ•˜๋ ค๊ณ  ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
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๋ฅผ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Inkedsettingspy์— ์ถ”๊ฐ€ํ•˜๋‹ˆ_LI

$ 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()์„ ์ถ”๊ฐ€ํ•˜๋‹ˆ

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) 

์ด๋Ÿฌํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹คใ… ใ… 

์˜ค๋Š˜ ํ•˜๋ฃจ์ข…์ผ ์ฐพ๊ณ  ์žˆ์ง€๋งŒ ํ•ด๊ฒฐํ•˜์ง€ ๋ชปํ•˜๊ณ  ์žˆ์–ด ์ ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹คใ… ใ… 

seralizer๋ฅผ ๋ณ€๊ฒฝ ํ›„, migrate๋ฅผ ํ•˜์ง€๋งŒ ๋ณ€๊ฒฝ์ด ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

1. ํ˜„์žฌ ํšŒ์›๊ฐ€์ž…์€ ์ž˜๋ฉ๋‹ˆ๋‹ค.

social login

2. login์—์„œ ๋ฌธ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

login

login ํ•˜๋Š” ๋ถ€๋ถ„์—์„œ str object์—์„œ decode ์†์„ฑ์ด ์—†์–ด ์ ์šฉ์ด ์•ˆ๋œ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

Inkedseralizer_LI

๊ตฌ๊ธ€๋ง ํ•ด๋ณธ ๊ฒฐ๊ณผ, token์— decode ํ•จ์ˆ˜์— ์ธ์ž๋กœ utf-8์„ ์ค„ ์‹œ, ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค๊ณ  ํ•˜์—ฌ ์ ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค.

serializers๋ฅผ ๋ณ€๊ฒฝํ–ˆ์Œ์—๋„

migrate

๋ณ€๊ฒฝ๋œ ๋‚ด์šฉ์ด ์—†๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. (serializers ๋ถ€๋ถ„์ด ๋ณ€๊ฒฝ๋˜์—ˆ์Œ์— ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์ด ์ ์šฉ์ด ๋˜์–ด์•ผ ํ•˜๋Š”๋ฐ ์•ˆ๋˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.)

๋‹ค์‹œ ํ•œ๋ฒˆ login์„ ํ•ด๋ณด๋‹ˆ ๋˜‘๊ฐ™์€ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ต๋‹ˆ๋‹ค.

login

์ด์™ธ๋กœ ๋งŒ์•ฝ email์ด๋‚˜ password๊ฐ€ ๋‹ค๋ฅผ ๊ฒฝ์šฐ๋Š” ์ž˜์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

์ž˜์‹คํ–‰๋œ๋‹ค

๊ฑฐ์˜ ๋‹ค๋œ ๊ฒƒ ๊ฐ™์€๋ฐ, seralizer์—์„œ ๋ณ€๊ฒฝ์„ ํ–ˆ์Œ์—๋„ migrate์—์„œ update๋œ ๋‚ด์šฉ์ด ์—†๋‹ค๋Š” ๊ฒƒ์ด ์ •๋ง ์ดํ•ด๊ฐ€ ์•ˆ๋ฉ๋‹ˆ๋‹ค.
email, password๋ฅผ ์ •์ƒ์ ์œผ๋กœ ์ž…๋ ฅํ–ˆ์„ ๋–„ ์‹คํ–‰์ด ๋˜์ง€ ์•Š๊ณ  ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

makemigrations, migrate์—์„œ ์ถ”๊ฐ€ ์งˆ๋ฌธ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

makemigrations, migrate ์˜ˆ์‹œ

  1. settings์— naver social ์ถ”๊ฐ€

settings์—์„œ_LI

  1. SourceTree, push ์™„๋ฃŒ

push ์™„๋ฃŒ

  1. settings์—์„œ ๋ณ€๊ฒฝ๋œ ๋‚ด์šฉ์ด ์žˆ์–ด

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] ์ฒซ ๋ฒˆ์งธ ์งˆ๋ฌธ

push ์™„๋ฃŒ

2)์—์„œ ๋ณด์ด๋Š” ๊ฒƒ๊ณผ ๊ฐ™์ด SourceTree์—์„œ

  • oauth branch๋ฅผ ์ƒ์„ฑํ•œํ›„
  • ์ปค๋ฐ‹ ํ›„
  • master๋กœ ๋Œ์•„์™€ ๋ณ‘ํ•ฉ
  • push

๋ฅผ ํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ, ๊ทธ๋ž˜ํ”„์—์„œ๋Š” ํŒŒ๋ž€์ƒ‰ ์ค„ 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์—์„œ migrate ๋‚ด์šฉ ์‚ญ์ œ ๊ฐ€๋Šฅํ• ๊นŒ์š”??

1) heroku, python migrate ๋˜ํ•œ, ์ดˆ๊ธฐํ™”๊ฐ€ ๊ฐ€๋Šฅํ• ๊นŒ์š”??

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์—์„œ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

2) ์–ด๋– ํ•œ ๋ฌธ์ œ์ธ์ง€ ๋ณด๋ฉด (logs --tail)

์ด๋Ÿฌํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค

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์„ ์‚ฌ์šฉํ•˜๊ธฐ๋Š” ํ•˜์ง€๋งŒ ๋ณ„ ์ž˜๋ชป๋œ๊ฒƒ์€ ์—†์–ด ๋ณด์ธ๋‹ค.)

3) ๋งˆ์ง€๋ง‰์œผ๋กœ

location, diary ๋“ฑ ๊ธฐ๋ณธ django์—์„œ๋Š” ํŽ˜์ด์ง€๊ฐ€ ์‹คํ–‰ ๋˜์ง€๋งŒ, heroku์—์„œ๋Š” ์‹คํ–‰์ด ๋˜์ง€์•Š๋Š”๋‹ค.

1)์„ ์ถ”์ธกํ•˜๊ณ  migrate์„ ํ•œ๋ฒˆ ์ง€์›Œ๋ณด๊ณ  ์‹ถ์ง€๋งŒ ํŒŒ์ผ์œ„์น˜๊ฐ€ ์–ด๋””์žˆ๋Š”์ง€ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค.

์–ด์ œ ๋งŒ๋“ค์—ˆ๋˜ ์—ฐ๋™๊ณผ์ •์— ์งˆ๋ฌธ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

์–ด์ œ ๋งŒ๋“ค์—ˆ๋˜ ์—ฐ๋™๊ณผ์ •์— ์งˆ๋ฌธ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

  1. mysql workbench์—์„œ EER ๋‹ค์ด์–ด๊ทธ๋žจ์„ migrate ํ•˜์—ฌ models, serializers, views, urls ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
  • settings databases์—์„œ๋Š” mysql๋กœ ์„ค์ •์„ ๋ฐ”๊ฟ”์ค๋‹ˆ๋‹ค.
  1. ์ด์ œ heroku ์Šคํ‚ค๋งˆ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
  • ์—ฌ๊ธฐ ๋ฌธ์ œ์ ์ด Forward engineer์ด ๋˜์ง€ ์•Š์•„,
  • settings databases์—์„œ mysql -> sqlite๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.
  • setting_heroku๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
  • Procfile์„ ํ†ตํ•ด ์„œ๋ฒ„๋ฅผ ์‹คํ–‰์‹œํ‚ค๊ธฐ ์œ„ํ•ด gdproject.wsgi.py์—์„œ๋„ runserver with settings -> runserver with settings_heroku๋กœ ๋ฐ”๊พธ์–ด์ค๋‹ˆ๋‹ค.
  • python manage.py migrate --settings=gdproject.settings_heroku์„ ํ•˜์—ฌ workbench heroku ์Šคํ‚ค๋งˆ, Tables์— table๋“ค์ด ์ถ”๊ฐ€๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.

์—ฌ๊ธฐ์„œ ์ดํ•ด๊ฐ€ ์•ˆ๋˜๋Š” ๋ถ€๋ถ„์ด ์žˆ์Šต๋‹ˆ๋‹ค.
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๋กœ ๋ฐ”๋€๊ฑธ๊นŒ์š”??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.