묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
(회고)다른 PC에서 ssh 키 생성해서 하니 주피터 노트북이 안켜졌네요
개인 PC가 두대에서 개인 맥 pc에도 ssh 키값을 넣고 설정했습니다. 그렇게 되면 Linux계정이 환경을 설정한 계정과 달라서 주피터 노트북을 실행하면 정상적으로 실행이 안되는 것같네요.접근권한 관련한 문제겠죠? switch user로 설정한 계정으로 진행은 되긴합니다.
-
미해결파이썬 사용자를 위한 웹개발 입문 A to Z Django + Bootstrap
python manage.py test 오류
이런 오류가 납니다ㅠㅠ tests.py 코드 입니다 from django.test import TestCase, Clientfrom bs4 import BeautifulSoupfrom .models import Post, Category, Tagfrom django.utils import timezonefrom django.contrib.auth.models import Userdef create_category(name='life', description=''): category, is_created = Category.objects.get_or_create( name=name, description=description, ) category.slug = category.name.replace('', '-').replace('/', '') category.save() return categorydef create_tag(name='some tag'): tag, is_created = Tag.objects.get_or_create( name=name ) tag.slug = tag.name.replace('', '-').replace('/', '') tag.save() return tagdef create_post(title, content, author, category=None): blog_post = Post.objects.create( title=title, content=content, created=timezone.now(), author=author, category=category, ) return blog_postclass TestModel(TestCase): def setUp(self): self.client = Client() self.author_000 = User.objects.create(username='smith', password='nopassword') def test_category(self): category = create_category() post_000 = create_post( title='The first post', content='Hello World. We are the world.', author=self.author_000, category=category, ) self.assertEqual(category.post_set.count(), 1) def test_tag(self): tag_000 = create_tag(name='bad_guy') tag_001 = create_tag(name='america') post_000 = create_post( title='The first post', content='Hello World. We are the world.', author=self.author_000, ) post_000.tags.add(tag_000) post_000.tags.add(tag_001) post_000.save() post_001 = create_post( title='Stay Fool, Stay Hungry', content='Story about Steve Jobs', author=self.author_000 ) post_001.tags.add(tag_001) post_001.save() self.assertEqual(post_000.tags.count(), 2) self.assertEqual(tag_001.post_set.count(), 2) self.assertEqual(tag_001.post_set.first(), post_000) self.assertEqual(tag_001.post_set.last(), post_001) def test_post(self): category=create_category( ) post_000 = create_post( title='The first post', content='Hello World. We are the world.', author=self.author_000, category=category, )class TestView(TestCase): def setUp(self): self.client = Client() self.author_000 = User.objects.create_user(username='smith', password='nopassword') self.user_obama = User.objects.create_user(username='obama', password='nopassword') def check_navbar(self, soup): navbar = soup.find('div', id='navbar') self.assertIn('Blog', navbar.text) self.assertIn('About me', navbar.text) def check_right_side(self, soup): category_card = soup.find('div', id='category-card') self.assertIn('미분류 (1)', category_card.text) # 미분류 (1) 있어야 함 self.assertIn('정치/사회 (1)', category_card.text) # 정치/사회 (1) 있어야 함 def test_post_list_no_post(self): response = self.client.get('/blog/') self.assertEqual(response.status_code, 200) soup = BeautifulSoup(response.content, 'html.parser') title = soup.title self.assertIn(title.text, 'Blog') self.check_navbar(soup) self.assertEqual(Post.objects.count(), 0) self.assertIn('아직 게시물이 없습니다.', soup.body.text) def test_post_list_with_post(self): tag_america = create_tag(name='america') post_000 = create_post( title='The first post', content='Hello World. We are the world.', author=self.author_000, ) post_000.tags.add(tag_america) post_000.save() post_001 = create_post( title='The first post', content='Second Second Second', author=self.author_000, category=create_category(name='정치/사회') ) post_001.tags.add(tag_america) post_001.save() self.assertGreater(Post.objects.count(), 0) response = self.client.get('/blog/') self.assertEqual(response.status_code, 200) soup = BeautifulSoup(response.content, 'html.parser') body = soup.body self.assertNotIn('아직 게시물이 없습니다.', body.text) self.assertIn(post_000.title, body.text) post_000_read_more_btn = body.find('a', id='read-more-post-{}'.format(post_000.pk)) self.assertEqual(post_000_read_more_btn['href'], post_000.get_absolute_url()) self.check_right_side(soup) # main_div에는 main_div = soup.find('div', id='main_div') self.assertIn('정치/사회', main_div.text) # '정치/사회' 있어야 함 self.assertIn('미분류', main_div.text) # '미분류' 있어야 함 # Tag post_card_000 = main_div.find('div', id='post-card-{}'.format(post_000.pk)) self.assertIn('#america',post_card_000.text) #Tag가 해당 post의 card마다 있다. def test_post_detail(self): category_politics = create_category(name='정치/사회') post_000 = create_post( title='The first post', content='Hello World. We are the world.', author=self.author_000, category=category_politics ) tag_america = create_tag(name='america') post_000.tags.add(tag_america) post_000.save() post_001 = create_post( title='The first post', content='Second Second Second', author=self.author_000, ) self.assertGreater(Post.objects.count(), 0) post_000_url = post_000.get_absolute_url() self.assertEqual(post_000_url, '/blog/{}/'.format(post_000.pk)) response = self.client.get(post_000_url) self.assertEqual(response.status_code, 200) soup = BeautifulSoup(response.content, 'html.parser') title = soup.title self.assertEqual(title.text, '{} - Blog'.format(post_000.title)) self.check_navbar(soup) body = soup.body main_div = body.find('div', id='main_div') self.assertIn(post_000.title, main_div.text) self.assertIn(post_000.author.username, main_div.text) self.assertIn(post_000.content, main_div.text) self.check_right_side(soup) # Tag self.assertIn('#america', main_div.text) # Tag가 해당 post의 card마다 있다. self.assertIn(category_politics.name, main_div.text)#category가 main_div에 있다. self.assertNotIn('EDIT', main_div.text)#EDIT 버튼이 로그인하지 않은 경우 보이지 않는다. login_success = self.client.login(username='smith', password='nopassword')#login을 한 경우에는 self.assertTrue(login_success) response = self.client.get(post_000_url) self.assertEqual(response.status_code, 200) soup = BeautifulSoup(response.content, 'html.parser') main_div = soup.find('div', id='main-div') self.assertEqual(post_000.author, self.author_000) #post.author와 login한 사용자가 동일하다면 self.assertIn('EDIT', main_div.text) #EDIT 버튼이 있다. # 다른 사람인 경우에는 없다. login_success = self.client.login(username='obama', password='nopassword') #login을 한 경우에는 self.assertTrue(login_success) response = self.client.get(post_000_url) self.assertEqual(response.status_code, 200) soup = BeautifulSoup(response.content, 'html.parser') main_div = soup.find('div', id='main-div') self.assertEqual(post_000.author, self.author_000) # post.author와 login한 사용자가 동일하다면 self.assertNotIn('EDIT', main_div.text) # EDIT 버튼이 있다. def test_post_list_by_category(self): category_politics = create_category(name='정치/사회') post_000 = create_post( title='The first post', content='Hello World. We are the world.', author=self.author_000, ) post_001 = create_post( title='The first post', content='Second Second Second', author=self.author_000, category=category_politics ) response = self.client.get(category_politics.get_absolute_url()) self.assertEqual(response.status_code, 200) soup = BeautifulSoup(response.content, 'html.parser') main_div = soup.find('div', id='main_div') self.assertNotIn('미분류', main_div.text) self.assertIn(category_politics.name, main_div.text) def test_post_list_no_category(self): category_politics = create_category(name='정치/사회') post_000 = create_post( title='The first post', content='Hello World. We are the world.', author=self.author_000, ) post_001 = create_post( title='The first post', content='Second Second Second', author=self.author_000, category=category_politics ) response = self.client.get('/blog/category/_none/') self.assertEqual(response.status_code, 200) soup = BeautifulSoup(response.content, 'html.parser') main_div = soup.find('div', id='main_div') self.assertIn('미분류', main_div.text) self.assertNotIn(category_politics.name, main_div.text) def test_tag_page(self): tag_000 = create_tag(name='bad_guy') tag_001 = create_tag(name='america') post_000 = create_post( title='The first post', content='Hello World. We are the world.', author=self.author_000, ) post_000.tags.add(tag_000) post_000.tags.add(tag_001) post_000.save() post_001 = create_post( title='Stay Fool, Stay Hungry', content='Story about Steve Jobs', author=self.author_000 ) post_001.tags.add(tag_001) post_001.save() response = self.client.get(tag_000.get_absolute_url()) self.assertEqual(response.status_code, 200) soup = BeautifulSoup(response.content, 'html.parser') main_div = soup.find('div', id='main-div') blog_h1 = main_div.find('h1', id='blog-list-title') self.assertIn('#{}'.format(tag_000.name), blog_h1.text) self.assertIn(post_000.title, main_div.text) self.assertNotIn(post_001.title, main_div.text)
-
미해결Vue.js 중급 강좌 - 웹앱 제작으로 배워보는 Vue.js, ES6, Vuex
문법에 관련 질문입니다
<li v-for="(todoItem, index) in propsdata" v-bind:key="todoItem.itme" .....> 1. todoItem 값을 하위의 toggledCompleted에서 인자로 사용했는데 v-on, v-for 이런 키워드 안에서는 사용할수 있는건지요 2. 위의 v-for에 in propsdata로 스크립트의 props에 정의된 이름? 을 그대로 사용 가능한건 v-for 안 이기때문에 가능한건지요 3. 스크립트의 props: ['propsdata']는 배열 0번째에 propsdata 라는 스트링을 넣은 의미 인건가요? 여기에 상위 컴포넌트에서 내려보낸 값이 담긴다는건 알겠는데 뷰 에서는 배열에 키값을 설정할수 있는건가요 3. v-bind:key="todoItem.itme"는 무슨 의미인지요? todoItem.item의 값을 어디의 키값으로 설정? 사용? 한다는 뜻인가요 바쁘시겠지만 답변 부탁 드리겠습니다.
-
미해결C 프로그래밍 - 입문부터 게임 개발까지
printf("%d₩n",age)에서의 ₩n 의미
₩n의 의미를 모르겠습니다!
-
미해결2022 30분 요약 강좌 시즌 1 : HTML, CSS, Linux, Bootstrap, Python, JS, jQuery&Ajax
open in browser 문의
안녕하세요! 아톰에서 open in browse 검색해도 패키지가 안나오는데 혹시 서비스가 종료된걸까요?
-
미해결Vue.js 중급 강좌 - 웹앱 제작으로 배워보는 Vue.js, ES6, Vuex
created에 대한 질문
강의 잘 듣고 있습니다. 아래의 질문을 드리니 답변 부탁 드리겠습니다. 1. App.vue의 created는 App 컨테이너가 생성될때 딱 한번 실행 되는건지요 2. TodoList.vue의 v-bind:key는 무슨 역할을 하는지도 알려 주시면 감사하겠습니다.
-
미해결선형대수학개론
12page ex4.질문 있습니다.
안녕하세요. 강의잘 듣고 있습니다. 12p ex4에서 eigenvector가 하나만 나오는데 P를 구성할때 b2를 임의로 independent하게 잡은 것인가요? b1,b2모두 임의로 P를 구성해도 independent하다면 베타 매트릭스를 구할 수 있다는 뜻인가요?
-
미해결[리뉴얼] React로 NodeBird SNS 만들기
Post.update 반환값
시퀄라이즈 5버전은 모르겠는데 6버전에서는 업데이트 성공여부를 boolean값으로 반환하네요. 그래서 post.setHashtags에서 에러가 납니다. 업데이트하고 다시 불러와야 할 거 같아요! 제로초님 강좌 잘 봤습니다ㅎ
-
미해결선형대수학개론
11페이지 질문
space P3에서 R4로 onto 를 하는것 처럼 space pn에서 R(n+1)로 onto한다고 일반화를 할 수 있을까요?
-
미해결홍정모의 따라하며 배우는 C언어
sizeof(str5) 질문
저는 extra에서 sizeof(str5) 값이 8바이트라고 출력되는데 왜그런건가요?
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
props.history.push('/') 에서 자꾸 에러가 발생합니다.
https://github.com/overman623/boiler-plate/blob/master/client/src/components/views/LoginPage/LoginPage.js#L29-L37 강의 잘듣고 있습니다. 처음 해보는것이라 따라해보면서 하고있는데, 아무리 따라해도 이 부분이 막히고 있습니다. Uncaught (in promise) TypeError: Cannot read property 'push' of undefined 라는 에러가 나와서 많이 어렵습니다. 도움을 부탁드립니다.
-
미해결자바 스프링 프레임워크(renew ver.) - 신입 프로그래머를 위한 강좌
생성자,setter
.getBean을 사용하니까 생성자에 있는 출력문과 setter에 있는 출력문 두개다 사용 되는데 왜그런지 알수있을까요..? 객체를 생성할때 생성자가 실행되는건 알겠는데 set은 메소드를 실행해야지 실행되는거 아닌가요?? bean의 기능중 하나인지 알고싶습니다.
-
해결됨[백문이불여일타] 데이터 분석을 위한 고급 SQL
이런 방법은 어떤가요
실업무에서 연속된 숫자를 찾을 때 다음과 같은 방법을 이용하는데, 다중 셀프 조인과 비교했을 때 어떤 방식이 좀 더 효율적인지 궁금합니다. (쿼리문이 좀 엉망으로 복붙되는 듯합니다) select ConsecutiveNums = Num from ( select rk = rank () over (partition by Num order by Id) , conse = rank () over (partition by Num order by Id) + (100 - Id) , * from Logs ) as a group by Num, conse having count(*) >= 3
-
따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
nodemon 실행 관련 질문드립니다
삭제된 글입니다
-
미해결파이썬 사용자를 위한 웹개발 입문 A to Z Django + Bootstrap
migrate 에러 문의
저번에 awesome avartar 문의를 드렸었는데요 결국 포기하고 원상태로 복구시키려니 이런 에러가 뜹니다저번에 venv의 하위파일중 db를 건드렸던건지 venv안의 awesome avartar 파일들과 manage.py 파일들을 모두 삭제하고 진행시켰는데도 'blog_category'가 이미 있다고 뜹니다 전에는 blog_comment.author_id 가 있다고 뜨고 그 뒤엔 blog_comment가 이미있다고 뜨고 지금은 이상태입니다... 뭐가문제일까요 models.py와 views.py는 강사님과 다른게없습니다
-
미해결하울의 안드로이드 인스타그램 클론 만들기
메인화면에서 프로필이미지사진 가져오기에 대하여..
안녕하세요 완강을 했습니다. 감사합니다 . 좋은강의를 들어서 처음 코틀린을 접하고 배울수 있는 기회가 되었습니다. 저기 궁금한게 있어서 질문을 하고 싶은데 프로필 사진이지금은 이미지를 습득해서 그거를 넣고 있는데 그게 말고 파이어베이스에 있는 profileImages에서 가져오려면 어떻게 해야할까요? 알려주시면 감사합니다..
-
미해결화이트해커가 되기 위한 8가지 웹 해킹 기술
im-config에서 한글
가져오기 실패로 버츄얼박스 업데이스해서 사용하고 한글 변환까지하고 이제 한글 입력하려는데 왜 없는거죠 따라하는거 다따라했습니다
-
미해결자바 머신러닝 weka(웨카) 초급
회귀분석
회귀분석 공식 Y = Wx+b는 어떤걸 보고 산출해야 되나요?? 각 속성마다 소수 점만 나오는데 어떻게 해석해야할지 잘 모르겠습니다...
-
미해결공공데이터로 파이썬 데이터 분석 시작하기
'상호명이 '파스쿠찌|잠바주스'가 아닌 것만 가져오세요.'에 궁금한 점이 있습니다.
안녕하세요, 선생님. 강의 잘 듣고 있습다. 복습하다 중간에 궁금한 점이 생겨 질문드립니다, 03_frainchise_eda_input 파일에서요. # "상권업종대분류명"이 "학문/교육"이 아닌 것만 가져옵니다. 에서는 아래처럼 작성을 하는 것으로 배웠습니다. df_bread = df_bread[df_bread['상권업종대분류명'] != '학문/교육'].copy() 그리고 아래의 문항 중 # 상호명이 '파스쿠찌|잠바주스'가 아닌 것만 가져오세요. 에서 df_bread[~df_bread['상호명'].str.contains('파스쿠찌|잠바주스')]로 알려주셨는데요. 이것의 shape을 찍어보면 (812, 12)가 오는데 아래처럼 df_bread[df_bread['상호명'] != '파스쿠찌|잠바주스']로 했을 때 는 (823, 12)로 row의 개수가 달라서 왜 다른지 궁금하여 문의드립니다. 저는 두 개의 row 개수가 같을 거라고 생각을 했는데 달라서 어떻게 다른 것인지 궁금합니다. 항상 좋은 강의 감사드립니다 :)
-
미해결쉽고 빠르게 끝내는 GO언어 프로그래밍 핵심 기초 입문 과정
수업관련 질문은 아니지만 에디터 관련해서 질문드려요
이클립스나 인텔리제이 같은거에서 자바할때 해당 패키지에 속해있는 메서드들 보는 것처럼(사진처럼이요) 아톰에서 그런 기능을 제공해주나요 ? 검색해서 찾아보긴 하는데 원하는게 없어서요. 아시면 답글 부탁드립니다!