작성
·
475
0
CreateView - 폼(form)으로 포스트 작성 페이지 만들기 강의에서
여기까지왔는데요
이런오류가 뜨네요
python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\threading.py", line 1016, in bootstrapinner
self.run()
File "C:\Program Files\Python310\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\management\commands\runserver.py", line 134, in inner_run
self.check(display_num_errors=True)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\management\base.py", line 475, in check
all_issues = checks.run_checks(
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\checks\registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\checks\urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver
return check_method()
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\urls\resolvers.py", line 494, in check
for pattern in self.url_patterns:
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\utils\functional.py", line 57, in get
res = instance.__dict__[self.name] = self.func(instance)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\urls\resolvers.py", line 715, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\utils\functional.py", line 57, in get
res = instance.__dict__[self.name] = self.func(instance)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\urls\resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Program Files\Python310\lib\importlib\__init__.py", line 126, in import_module
return bootstrap.gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in gcdimport
File "<frozen importlib._bootstrap>", line 1027, in findand_load
File "<frozen importlib._bootstrap>", line 1006, in findand_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in loadunlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in callwith_frames_removed
File "C:\github\do_it_django_inflearnb_2022\do_it_django_prj\urls.py", line 23, in <module>
path('blog/', include('blog.urls')),
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\urls\conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
File "C:\Program Files\Python310\lib\importlib\__init__.py", line 126, in import_module
return bootstrap.gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in gcdimport
File "<frozen importlib._bootstrap>", line 1027, in findand_load
File "<frozen importlib._bootstrap>", line 1006, in findand_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in loadunlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in callwith_frames_removed
File "C:\github\do_it_django_inflearnb_2022\blog\urls.py", line 6, in <module>
path('tag/<str:slug>/', views.tag_page),
AttributeError: module 'blog.views' has no attribute 'tag_page'
답변 5
0
0
안녕하세요. 강의의 오류는 아닌 것 같습니다.
따라하시다가 마이그레이션 실수를 하신 것 같네요.
db를 삭제해도 되는 경우라면, 일단 db.sqlite3 파일을 삭제하시고, blog를 비롯한 모든 폴더의 migrations 폴더를 삭제하세요.
그리고
python manage.py makemigrations blog
python manage.py migrate
를 실행시키면 될 것 같습니다.
자세한 내용은 아래 링크를 참고해보세요.
https://www.jgahn.com/archive/post/40/
0
django allauth - 소셜 로그인 구현하기 강의 에서
오류가있는데요
코드 다 하고
python manage.py migrate 했는데요
이런 오류가 뜨네요
Traceback (most recent call last):
File "C:\github\do_it_django_inflearnb_2022\manage.py", line 22, in <module>
main()
File "C:\github\do_it_django_inflearnb_2022\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\management\base.py", line 371, in execute
output = self.handle(*args, **options)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\management\base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\core\management\commands\migrate.py", line 95, in handle
executor.loader.check_consistent_history(connection)
File "C:\github\do_it_django_inflearnb_2022\venv\lib\site-packages\django\db\migrations\loader.py", line 302, in check_consistent_history
raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration socialaccount.0001_initial is applied before its dependency sites.0001_initial on database 'default'.
0
0
맨 마지막에 오류 메시지를 보면 views.py에 tag_page라는 attribute가 없다고 하네요.
views.py에 tag_page가 잘 작성되어 있는지 확인해보세요.
urls.py에 create_post 뒤에 슬래쉬가 빠져서 그런게 아닐까요?