Pythons

Google Colab Plotly Graph 안 보일 때

현상 plotly 라이브러리를 활용하여 Google Colab에서 시각화를 할 때 그래프가 보이지 않는 현상이 존재함 여러 방법론이 등장하지만, 공식문서에 따라서 어떻게 활용하는지 확인하도록 함 Google Colab 먼저 구글 코랩에서 간단한 시각화 코드를 작성하고 코드를 실행한다. import plotly plotly.__version__ # 5.13.1 샘플 코드는 아래와 같음 import plotly.graph_objects as go import pandas as pd temp = pd.DataFrame({ "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"], "Contestant": ["Alex", "Alex", "Alex", "Jordan", "Jordan", "Jordan"], "Number Eaten": [2, 1, 3, 1, 3, 2], }) fig = go.

Scrapy Tutorial - 다중페이지 크롤링

개요 이번에는 Scrapy를 통해서 다중 페이지를 크롤링 하도록 한다. Target 페이지 타겟 웹사이트 : https://www.audible.com/search 프로젝트 시작 프로젝트 시작은 다음과 같이 할 수 있다. $ scrapy startproject multiCam_tutorial New Scrapy project 'multiCam_tutorial', using template directory 'C:\Users\j2hoo\OneDrive\Desktop\your_project_folder\venv\Lib\site-packages\scrapy\templates\project', created in: C:\Users\j2hoo\OneDrive\Desktop\your_path\multiCam_tutorial You can start your first spider with: cd multiCam_tutorial scrapy genspider example example.com 해당 multiCam_tutorial 경로에서 다음 명령어를 실행하여 타겟 사이트를 설정한다. $ scrapy genspider audible www.audible.com/search Created spider 'audible' using template 'basic' in module: multiCam_tutorial.

Scrapy Tutorial - 기본편

개요 Scrapy Tutorial 설치 과정 및 기본 크롤링 과정을 살펴본다. 라이브러리 설치 라이브러리 설치는 다음과 같다. pip install scrapy 프로젝트 시작 Django와 비슷하게 터미널 명령어는 startproject라고 입력한다. $ scrapy startproject multiCam_tutorial New Scrapy project 'multiCam_tutorial', using template directory 'C:\Users\j2hoo\OneDrive\Desktop\your_project_folder\venv\Lib\site-packages\scrapy\templates\project', created in: C:\Users\j2hoo\OneDrive\Desktop\your_path\multiCam_tutorial You can start your first spider with: cd multiCam_tutorial scrapy genspider example example.com 파일 구조는 아래와 같이 여러개의 파일로 구성되었다. 타겟 주소는 아래와 같다. 주소 : https://www.worldometers.info/world-population/population-by-country/ $ scrapy genspider worldometer www.

Django - ExcelCalCulator_7

개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - 이전 글 1편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_1/ 2편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_2/ 3편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_3/ 4편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_4/ 5편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_5/ 6편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_6/ Step 02 - 프로젝트 완성하기 지금까지 구현한 기능과 미완료된 기능을 확인한다. Step 03 - 로그인 실패 시 보이는 화면을 구현 우선 사용자가 로그인 실패 시, 보이는 화면으로 구현한다.

Django - ExcelCalCulator_6

개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - 이전 글 1편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_1/ 2편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_2/ 3편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_3/ 4편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_4/ 5편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_5/ Step 02 - 프로젝트 완성하기 지금까지 구현한 기능과 미완료된 기능을 확인한다. Step 03 - 엑셀 결과 화면 출력 위한 세션값 저장 우선 calculate 함수의 마지막에 엑셀 결과 화면으로 데이터와 함께 url을 이동시켜본다.

Django - ExcelCalCulator_5

개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - 이전 글 1편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_1/ 2편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_2/ 3편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_3/ 4편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_4/ Step 02 - 파일 업로드 하기 로그인을 통해 메인 화면으로 왔다면, 파일 업로드 기능 구현 Step 03 - 파일 업로드 기능 구현 check - 1 : index.

Django - ExcelCalCulator_4

개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - 이전 글 1편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_1/ 2편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_2/ 3편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_3/ Step 02 - 로그인 기능 구현 로그인된 사용자만 이용할 수 있도록 구현 이 때, 현재 사용자가 로그인된 사용자인지 판단하려고 세션 사용 회원 가입 통한 과정 이외에도 정상적인 로그인 과정에서도 세션 처리 진행 Step 03 - 로그인 처리 구현 check - 1 : signin.

Django - ExcelCalCulator_3

개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - 이전 글 1편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_1/ 2편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_2/ Step 02 - 인증하기 구현 자신의 이메일로 발송된 인증 코드를 입력한 후, “인증하기” 버튼을 누르면, main app 의 [views.py](http://views.py) 파일에 만들어 놓은 verify 함수로 오도록 설정한다. verifyCode.html url을 설정한다.

Django - ExcelCalCulator_2

개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - 이전 글 1편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_1/ Step 02 - 이메일 인증으로 회원 가입 절차는 다음과 같다. 회원 가입 화면에서 개인정보 입력 후 회원 가입하기 버튼 클릭 때 해당 정보로 유저 데이터 생성 및 DB에 저장, 이 때 인증되지 않은 유저로 등록 DB에 저장 후, 입력한 이메일로 인증 코드 발송 발송된 인증 코드는 유저 이름과 함께 쿠키로 저장 후 인증 코드 입력 화면으로 전환 인증 코드 입력 화면에서 인증 코드 입력 후 인증하기 버튼 클릭 때 입력된 코드와 쿠키에 저장된 인증 코드 비교 후 회원 성공/실패 처리 성공 때는 회원의 인증 값을 true 로 설정, 실패 때 해당 회원정보 삭제 Step 03 - DB 설정 사용자 정보를 저장할 수 있는 모델을 만들어야 한다.

Django - ExcelCalCulator_1

개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - Github Repo 생성 아래와 같이 Github Repo를 생성한다. Step 02 - 가상환경 생성 및 라이브러리 설치 virtualenv 명령어를 활용하여 가상환경을 설치한다. 실행 경로 : ExcelCalculate-with-Django $ virtualenv venv created virtual environment CPython3.9.13.final.0-64 in 2305ms creator CPython3Windows(dest=C:\Users\j2hoo\OneDrive\Desktop\ExcelCalculate-with-Django\venv, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\j2hoo\AppData\Local\pypa\virtualenv) added seed packages: pip==23.