작성한 이유(저는 이 문제로 골머리를 앓았어서..) 도메인 설정 후 쿠키가 전달되지 않아 로그인이 되지 않았다가 해결되었습니다 session 설정 뿐만 아니라 nginx 설정도 확인해야 합니다 혹시라도 이 문제로 고통받으시는 분이 있다면 해결책이 되길 바랍니다 back 쪽 session 설정 if (process.env.NODE_ENV === "production") { app.use(morgan("combined")); app.use(hpp()); app.use(helmet()); app.set("trust proxy", 1); //배포 시 추가 app.use( cors({ origin: "https://engword.shop", //local "http://localhost:3000" credentials: true, }) ); } else { app.use(morgan("dev")); app.use( cors({ origin: true, credentials: true, }) ); } passportConfig(); app.use(express.json()); app.use(express.urlencoded({ extended: true })); app.use(cookieParser(process.env.COOKIE_SECRET)); app.use( session({ saveUninitialized: false, resave: false, secret: process.env.COOKIE_SECRET, proxy: true, //배포 시 추가 cookie: { httpOnly: true, secure: process.env.NODE_ENV === "production" ? true : false, //https 적용 시 true sameSite: process.env.NODE_ENV === "production" ? "none" : false, domain: process.env.NODE_ENV === "production" && ".engword.shop", }, }) ); nginx 설정 back 에서 설정한 nginx입니다 sudo vim /etc/nginx/nginx.conf server { server_name api.engword.shop; location / { proxy_set_header HOST $host; //추가 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.0:3000 //http로 설정할 것 proxy_redirect off; } //아래는 certbot 내용 } 위와 같이 설정을 바꾼 후 nginx를 다시 실행합니다 sudo systemctl restart nginx pm2 로 진행 시 pm2 를 껏다 키거나, pm2 재시작을 하시면 됩니다. pm2 껏다 키는 경우 sudo npx pm2 kill npm start (혹은 sudo npm start) pm2 재시작 sudo npx pm2 reload all
사용자 입력 예외처리를 하고 있는데, 1)문자 입력 시 오류 2)3자리 숫자가 아닐 경우 오류 다음과 같이 코드를 짰는데 1)의 경우 except 부분에서 "입력 오류"를 출력하지만 2)의 경우 "입력오류"가 출력되지 않고 그냥 재입력하게 되네요. 혹시 이유를 알 수 있나요? 또한 문자 입력 시 "숫자만 입력 가능합니다"를 출력 두자리수 입력 시 "세 자리 수를 입력하세요"를 출력 하도록 하려면 코드를 어떻게 수정해야 할까요? 감사합니다.! #세 자리 숫자만 입력할 수 있게 하는 함수 def input_check(msg, casting = int): while True: try: num = input(msg) # 사용자 입력 num_str = str(num) #맨 앞의 수가 0일경우 0이 잘려버리기 때문에 str을 따로 저장 if(casting(num) and len(num) == 3): return num_str except: print("입력 오류") continue
안녕하세요~! 아나콘다를 설치하면서 두가지 정도 질문이 있습니다 1) 2023.02.22날짜로 아나콘다 최신판을 설치하는데 그림과 같이 옵션사항에 환경변수 체크가 되지 않습니다 ㅠㅠ 업데이트 되면서 바뀐것인지 아나콘다 최신판에서 이 옵션을 선택하지 않아도 괜찮을까요?? 2) 2023.02.22날짜로 아나콘다 최신판에서는 파이썬 버전이 3.9버전인데 파이썬 공식버전으로는 3.11까지 배포가 되었습니다 버전 차이가 많이 나도 아나콘다를 설치하는게 사용에 더 편리할까요??
이렇게 (N+2)*(N+2) list를 만들고 안에다가 복사해서 붙여넣어버리는 방법은 별로인가요? N = int(input()) input_list = [list(map(int, input().split())) for _ in range(N)] n_list = [[0] * (N + 2) for _ in range(N + 2)] for i in range(N): for j in range(N): n_list[i + 1][j + 1] = input_list[i][j]
안녕하세요 동균님 network 캐싱에 대해서 궁금한 점이 있어서 질문 남깁니다! image를 캐싱하면 image를 요청할 때 재요청이 안되는건 알겠는데, 저 network tab에서 disable cache 같은 경우는 해당 사용자 환경에서 설정할 수 있는 부분이라고 생각합니다. disable cache를 체크한 경우에는 캐싱을 못할텐데 그 부분에 대해서는 어떻게 해결을 해야하는건가요? 아니면 저 부분도 사용자 환경에 적용할 수 있도록 하는 방법이 있는건가요?
소수 개수 구하기 문제 언어 : 파이썬 내용: 제가 작성한 하위 코드 for문 두 개 돌렸을뿐인데 리미트 타임에러가 뜹니다.. 구글링 해서 emurate함수 써서 푼 문제는 정답이라고 뜹니다. 난이도 초급에 emurate함수 방식으로 써서 풀라는 의도는 아니라고 판단되어 문의 드립니다. 아래 코드가 에러인지, 제가 잘 못하고 있는지 궁금합니다. (입사 전에는 자바로 면접 보고 들어갔는데 입사 한 회사에서 사용하는 언어는 파이썬이라서 파이썬으로 코테 풀고 있는점도 참고해서 피드백 부탁드립니다) received_data = int(input()) list = [] for i in range(2,received_data+1): list.append(0) for i in range(2,received_data+1): if list[i-2]==0: for j in range(2,received_data+1): if j>i and j%i==0: list[j-2]=1 print(list.count(0))
hyunwooji@jihyeon-uui-MacBook-Air emotiondiary % npm install -g serve npm WARN config global --global , --local are deprecated. Use --location=global instead. npm ERR! code EACCES npm ERR! syscall mkdir npm ERR! path /usr/local/lib/node_modules/serve npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/serve' npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/serve'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'mkdir', npm ERR! path: '/usr/local/lib/node_modules/serve' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator. npm ERR! A complete log of this run can be found in: npm ERR! /Users/hyunwooji/.npm/_logs/2023-02-19T07_24_53_420Z-debug-0.log 구글링 해봣을때는 npm 업데이트 문제인거같다고로 찾아서 npm update 도 해봣는데 전혀 해결되지 않고 더 꼬이고 있는거같습니다.. 완강을 앞두고 좌절중이네요ㅠ 오늘 다 완강하고 싶었는데 도저히 해결이 안되어 질문남깁니다 감사합니다!!
이 강의에서 에러가 발생했습니다. 소스코드는 다음과 같습니다. import requests from bs4 import BeautifulSoup url = "https://www.naver.com/" response = requests.get(url) # 에러 발생한 부분 html = response.text soup = BeautifulSoup(html, 'html.parser') word = soup.select_one("#NM_set_home_btn") print(word.text) 위 코드중 response = requests.get(url) 위 부분에서 에러가 발생했습니다. [ 에러 내용 ] Max retries exceeded with url:강의에서 접속한 url 이런 에러가 나오고 Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available. 뒤에 이런 문장이 나옵니다. 에러 해결 방법은 무었인가요? [ 에러 전체 내용 ] 에러의 전체 내용은 다음과 같습니다. Exception has occurred: SSLError HTTPSConnectionPool(host='search.naver.com', port=443): Max retries exceeded with url: /search.naver?where=news&sm=tab_jum&query=%EC%82%BC%EC%84%B1%EC%A0%84%EC%9E%90 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available. During handling of the above exception, another exception occurred: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='search.naver.com', port=443): Max retries exceeded with url: /search.naver?where=news&sm=tab_jum&query=%EC%82%BC%EC%84%B1%EC%A0%84%EC%9E%90 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) During handling of the above exception, another exception occurred: File "D:\crawling\05. 뉴스 제목과 링크 가져오기.py", line 4, in <module> response = requests.get("https://search.naver.com/search.naver?where=news&sm=tab_jum&query=%EC%82%BC%EC%84%B1%EC%A0%84%EC%9E%90") requests.exceptions.SSLError: HTTPSConnectionPool(host='search.naver.com', port=443): Max retries exceeded with url: /search.naver?where=news&sm=tab_jum&query=%EC%82%BC%EC%84%B1%EC%A0%84%EC%9E%90 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
안녕하세요 재남님! 배포 과정에서 문제가 있어 질문 드립니다~ 현재 상황은 heroku에 깃 연동을 통해 배포를 한 상태입니다. 그렇기 때문에 herokuURL/graphql 을 입력하면 studio.apollographql.com 에서 날리는 api test도 잘 동작하고 있습니다. 그런데 vercel로 배포한 페이지에서는 products 화면을 제외한 cart, admin 같은 경우는 204 error가 뜨고 있는 상황입니다. 검색을 해보니 컨텐츠를 보여줄 필요가 없다(?) 라고 나오는데 어떤 문제인지 잘모르겠습니다.. ㅜ
안녕하세요. 데이터 증강 부분에 대해서 궁금점이 있어서 질문드립니다. 가지고 있는 데이터가 1000개 라고 가정했을 때, tr.Compose를 적용시키면 '기존 이미지 1000개 + 증강된 추가 이미지 개수' 가 되는건가요?? 제가 간단하게 해봤을 때는 transform 했을 때 이미지 개수 증가가 아니라 단순 이미지 변환까지만 이루어지는 것 같은데, 제가 잘못된 부분이 있는건가 좀 헷갈려서 질문 드립니다. 만약 단순 이미지 변환만 이루어지는 것이라면 이미지 개수 증가를 위해서 추가적인 작업을 진행해주어야 하는지도 궁금하네요.
안녕하세요 4일차 공부를 하던중 willpay를 cart 에서 밖으로 꺼내 willpay-index.tsx 로 변경하게 되면서 이러한 오류가 뜨면서 장바구니가 담아지지 않습니다.(장바구니가 비어있을 때는 비어있다는 텍스트는 출력이됩니다) 코드상 오류 표시는 안나는데 해결이 안되서 여쭤봅니다. 감사합니다.
200여개의 csv 파일이 있습니다. (용량은 각각 1메가에서 120메가 - 최대 100만건 데이터 등등 ). 결측치 가 있어서 판다스 에서 불러들여서 정리하고 for 반복문으로 파일 개별적으로 읽어 들여와 장고 모델에 save() 로 입력시키는 작업을 진행하고 있습니다. 초반 10여개 파일까지는 제법 속도가 나오는데 (7만행 데이터 20분 소요) 이후로 속도가 급격하게 감소해서 24시간 돌려서 30메가 파일 겨우 저장 중입니다(1건에 1초씩 걸리네요 ㅠㅠ). 개발중이라 로컬에 있는 장고 내장 sqlite 사용 했습니다. 속도를 좀 더 빠르게 하는 방법이 있을까요? 3일째 검색 해봤는데 별다른 해결책이 보이지 않아서 질문 남겨 봅니다. app.py # new 폴더에 정리된 csv 파일을 읽어서 DB에 저장 import pandas as pd # django 프로젝트에 있는 settings.py 파일을 읽어서 환경변수로 설정 import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dbking.settings") import django django.setup() #django 프로젝트에 있는 models.py 파일에서 BasicData 클래스를 읽어온다 from common.models import BasicData # new 폴더에 있는 파일명을 읽어서 product 변수에 리스트에 저장 product_list = os.listdir("./script/newdb") # product_list 에 csv 파일 정렬(오름차순) for x in product_list: # csv 파일 하나씩 읽어오기 df = pd.read_csv("./script/newdb/" + x, encoding="cp949") # 결측치를 0으로 채운다 df = df.fillna(0) for a in list_of_csv: # 파일마다 컬럼수가 달라서 remark1, remark2 라는 예비컬럼 2개 추가 # -> 인덱스 에러 나는 경우 0 으로 저장 if a[16] is None: a.insert(16, 0) a.insert(17, 0) elif a[17] is None: a.insert(17, 0) # DB에 저장 try: db_insert = BasicData( opnSvcId = a[2], opnSfTeamCode = a[3], mgtNo = a[4], fileNumber = fileNumber, businessType = businessType, opnSvcNm = a[1], apvPermYmd = a[5], confirmNumber = a[6], businessCondition = a[7], siteTel = a[8], sitePostNo = a[9], siteWhlAddr = a[10], rdnWhlAddr = a[11], rdnPostNo = a[12], bplcNm = a[13], latitude = a[14], longitude = a[15], remark1 = a[16], remark2 = a[17], ) i += 1 # print(i) except Exception as e: print("쿼리", e) continue #DB에 저장 입력 try: db_insert.save() except Exception as e: print("저장중에러",e) continue from django.db import models class BasicData(models.Model): # 개방서비스아이디 opnSvcId = models.CharField(max_length=100) #개방자치단체코드 opnSfTeamCode = models.CharField(max_length=10) # 관리번호 mgtNo = models.CharField(max_length=100) #파일번호 fileNumber = models.IntegerField() #업종명 businessType = models.CharField(max_length=100) #개방서비스명 opnSvcNm = models.CharField(max_length=100) #인허가일자 apvPermYmd = models.DateField() #영업상태구분코드(1-정상, 2-폐업, 3-휴업, 4-전환) confirmNumber = models.IntegerField() #영업상태명 businessCondition = models.CharField(max_length=100) #소재지전화 siteTel = models.CharField(max_length=100) #우편번호 sitePostNo = models.CharField(max_length=100) #주소 siteWhlAddr = models.CharField(max_length=100) #도로명주소 rdnWhlAddr = models.CharField(max_length=100) #도로명우편번호 rdnPostNo = models.CharField(max_length=100) #사업장명 bplcNm = models.CharField(max_length=100) # 위도 latitude = models.FloatField() # 경도 longitude = models.FloatField() #비고1 remark1 = models.CharField(max_length=100) #비고2 remark2 = models.CharField(max_length=100) # 생성시점 created = models.DateTimeField(auto_now_add=True) update = models.DateTimeField(auto_now=True) def save(self, *args, **kwargs): queryset = BasicData.objects.filter(mgtNo__exact=self.mgtNo) # 중복된 이름이 없을 때만 저장 if len(queryset) == 0: super().save(*args, **kwargs) print('> Created new category') # if '&' in self.addr: # self.addr = self.addr.replace('&', ' ') # self.save() # 중복된 카테고리 있을 시 저장 안함 else: print('> Cannot create category with existing name') def __str__(self): return self.name