dev/error (7) 썸네일형 리스트형 unit test 중 401 unauthorized 에러 발생 # tests.py def test_review_get_handler_method_success(self): client = Client() access_token = jwt.encode({'id':12345},SECRET_KEY, ALGORITHM) headers = {"Authorization" : access_token} response = client.get('/reviews/1',**headers) self.assertEqual(response.json(), { "results": { "top_review": { "review_id": 1, "user_id": 1, "nickname": "jayce", "rating": 2.5, "content": "리뷰내용1", "created_at": "20.. ImproperlyConfigured django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. import os, django, csv from products.models import * from users.models import * os.environ.setdefault( "DJANGO_SETTINGS_MODULE", "readme.settings", ) django.se.. django.db.utils.IntegrityError: (1452, 'Cannot add or update a child row django.db.utils.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`readme`.`products`, CONSTRAINT `products_author_id_4e72eb3c_fk_authors_id` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`))') unit test 를 진행하던 와중에 뜬 에러 setUp 에서 product_id가 참조할 author_id 가 없다는 뜻 class ReviewTest(TestCase): def setUp(self): Category.objects.create( id = 1, name = '베스트셀.. [git]fatal: The current branch feature/models has no upstream branch. 메인에서 pull 받은 이후 새로운 브랜치를 생성하고 새로운 브랜치의 작업 내용을 github에 push할 때 발생 업스트림 브랜치를 설정하지 않아서 발생한 에러다 git push --set-upstream origin 브랜치이름 해결은 됐는데... 근데 아직 upstream과 origin 과의 정확한 차이점을 모르겠다.. 공부 후에 별도의 포스팅으로 다뤄봐야겠당 Authentication plugin 'caching_sha2_password' cannot be loaded 시작은 아래와 같은 에러였다 >python manage.py runserver .... NameError: name '_mysql' is not defined. mysql 때문에 고생했던 지난 날.. 재설치해서 해결했던 에러였다 바로 mysqlclient 재설치 그리고 난생 처음보는 (여기와서 보는 에러가 전부 난생처음본다만..) 에러를 만났다 >python manage.py runserver .... MySQLdb._exceptions.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/Users/jayce/miniconda3/envs/westagram/lib/plugin/cach.. [python]SyntaxError: (unicode error) 1 2 from selenium import webdriver driver = webdriver.Chrome("C:\Users\kimji\Desktop\python\chromedriver.exe") cs 위와 같이 셀레니움으로 투닥투닥하던 와중 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2 -3: truncated \UXXXXXXXX escape 라는 에러가 떴길래 바로 구글에게 물어봤다(구글은 신이다) 찾아볼 결과 파일의 경로를 불러올 때 \를 사용했고 그게 유니코드로 인식이 되었기 때문이다 아래의 방법으로 해결할 수 있다! C:/Users/kimji/Desktop/python/chromedriver.. [python] AttributeError module 'requests' has no attribute 'get' 원래대로라면 터미널에 200같은 응답코드가 떠야하는데 AttributeError: partially initialized module 'requests' has no attribute 'get' (most likely due to a circular import) 라는 오류가 떴다 AttributeError는 속성 이름이 잘못됐거나 없는 속성을 가져오려 하면 뜨는 오류다 없는 속성도 아니고 이름도 잘못되지 않았는데 하고 찬찬히 살펴보니 파일 이름과 속성 이름이 같아서 발생한 오류였다 파일 이름 바꾸니까 해결됨! 역시 잘못은 항상 사람이 한다 이전 1 다음