Backend/π Python(17)
-
[Open AI API μλ¬] ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3
FastAPI λ‘ μ°νΌν° import ν λ λ°μν μλ¬ FastAPI λ΄λΆμ μ€μΉλ urllib3 v2.0 μ΄ OpenSSL 1.1.1+ λ²μ λ§ μ§μνλ€κ³ νλ€. Error message ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168 κ·ΈλΌ μ΄λ»κ² ν κΉ? μλ¬λ₯Ό ν΄κ²°νλ μ¬λ¬ λ°©λ²μ΄ μμ§λ§, νμλ κ°λ¨ν urllib3μ λ²μ μ 2.0λ³΄λ€ μλλ‘ λ€μ΄κ·Έλ μ΄λ νλ€ ν΄κ²° pip uninstall urllib3 pip install 'urllib3
2023.05.28 -
[Error]Python κ°μνκ²½ μ€μΉ configure: error: Unexpected output of 'arch' on OSX
ν¨μ€νΈ μΊ νΌμ€ λ λ λ : λμ©λ μλΉμ€λ₯Ό μν μν€ν μ² with Redis by κ°λλͺ μμ μ€μ΅ μ€ λ°μν μλ¬ μλ¬ λ©μμ§ configure: error: Unexpected output of 'arch' on OSX make: *** No targets specified and no makefile found. Stop. ν΄κ²° m1 apple silicon issue λ‘ python version μ 3.9.1 λ‘ μ κ·Έλ μ΄λ. pyenv install 3.9.1 ref : https://www.codeit.kr/community/threads/31708
2022.10.03 -
μ΅κ·Ό νμ΄μ¬ PS νλ©΄μ λ°°μ΄ κ²
dict μ fromkeys() λ©μλ - λμ λ리 μμ± μ, μ΄λ―Έ key κ°μ΄ μ ν΄μ§ κ²½μ° νΈλ¦¬νκ² λμ λ리λ₯Ό μμ±ν μ μλ€. - seq : λμ λ리μ key κ°μ΄ λ iterable λ‘, μ¦ dictionary μ key λͺ©λ‘μ΄λ€. - value : seq μ κ° key μ ν λΉλ value (κ°) μλ―Έ # μ μ @staticmethod # known case def fromkeys(*args, **kwargs): # real signature unknown """ Create a new dictionary with keys from iterable and values set to value. """ pass # μ¬μ©λ² value = 0 seq = [1, 2, 3] dictionary = dict...
2022.05.05 -
Django CBV (3) - DetailView
views.py from django.contrib.auth.models import User from django.views.generic import DetailView class AccountDetailView(DetailView): model = User context_object_name = 'target_user' # targetμ΄ λλ userμ μ 보λ₯Ό λ³΄μΌ μ μλλ‘ template_name = "detail.html" Userμ detailν μ 보λ₯Ό λ³΄κ³ μΆμ λ DetailView classλ₯Ό μμ λ°μ΅λλ€. model μ μμ 미리 μ μλ User λͺ¨λΈμ κ°μ Έμ΅λλ€. context_object_name = 'target_user'λ μ§μ ν΄μ€μλ€ . μ΄λ κ² target_userλ₯Ό ν λΉν..
2021.05.23 -
Django CBV (2) - λ‘κ·ΈμΈ, λ‘κ·Έμμ ꡬν
Urls.py 첫μ€μ from django.contrib.auth.views import LogoutView, LoginView μμ LoginView μ LogoutView λΌλ ν΄λμ€λ₯Ό μμλ°μμμ νμΈν μ μμ΅λλ€. from django.contrib.auth.views import LogoutView, LoginView from django.urls import path from account.views import AccountCreateView, hello_world app_name = "account" urlpatterns = [ path('hello_world', hello_world, name='hello_world'), path('create/', AccountCreateView.as..
2021.05.23 -
Django CBV (1) - νμκ°μ
FBV(function based view)κ° μλ CBV(class based view)λ‘ νμκ°μ μ μμ±νλ©΄, Djangoκ° μ 곡νλ classλ₯Ό μμλ°κΈ° λλ¬Έμ λ κ°κ²°ν μ½λλ‘ μμ±ν μ μμ΅λλ€. Views.py from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from django.views.generic import CreateView from django.urls import reverse_lazy class AccountCreateView(CreateView): model = User form_class = UserCreationForm success_url = ..
2021.05.23 -
Django Bootstrap4 μ°λ
1. μ°μ Bootstrap 곡μννμ΄μ§μμ CSS CDNμ copy ν©λλ€. https://getbootstrap.com/docs/5.0/getting-started/introduction/ Introduction Get started with Bootstrap, the world’s most popular framework for building responsive, mobile-first sites, with jsDelivr and a template starter page. getbootstrap.com copy ν css cdn μ μ₯κ³ ν νλ¦Ώ λ΄λΆμ λΆμ¬λ£κΈ° ν΄μ€λλ€. 2. bootstrap4 libraryλ₯Ό λ€μ΄λ‘λ λ°κ² μ΅λλ€. terminalμ pip install django-bootst..
2021.05.23 -
νμ΄μ¬ λ©μλ μ€λ²λΌμ΄λ©, μ€λ²λ‘λ©
λ©μλ μ€λ²λΌμ΄λ© μ€λ²λΌμ΄λ©μ λΆλͺ¨ ν΄λμ€μ λ©μλλ₯Ό, μμ ν΄λμ€μμ μ¬μ μ νμ¬ μ¬μ©νλ κ²μ μλ―Ένλ€. μλ₯Ό λ€μ΄ λΆλͺ¨ν΄λμ€μμ add()λΌλ λ©μλλ 2κ°μ μΈμλ°μ λν μ μμ§λ§, μμ ν΄λμ€μ add() λ©μλλ μ€λ²λΌμ΄λ©λμ΄ 3κ°μ§μ μΈμκΉμ§ λ°λλ‘ μ¬μ μ ν μ μλ€. μλΈν΄λμ€(μμ)μμ μνΌ(λΆλͺ¨)ν΄λμ€λ₯Ό νΈμΆ ν μ¬μ© λ©μλ μ¬ μ μ ν μ¬μ©κ°λ₯ λΆλͺ¨ν΄λμ€μ λ©μλλ₯Ό μΆμν ν μ¬μ©κ°λ₯ (ꡬ쑰μ μ κ·Ό κ°λ₯) νμ₯ κ°λ₯ + λ€νμ±(λ€μν λ°©μμΌλ‘ λμ -> λΆλͺ¨μμ λ©μλ νλλ₯Ό λ§λ€μ§λ§,μ¬μ©νλ μμμ λ°λΌ λ€μνκ² μ¬μ©λ μ μλ€) κ°λ μ± μ¦κ°, μ€λ₯κ°λ₯μ± κ°μ, λ©μλ μ΄λ¦ μ μ½(λΆλͺ¨κ° λ©μλ μ΄λ¦μ μ΄λ―Έ μ μν΄λ¨κΈ°μ) dir(),_dict_ κ°μ²΄ λ΄λΆ κ²μ¬ λ©μλ dir() :..
2021.05.18 -
νμ΄μ¬ lambda, filter, reduce
μνμ€ν: μ μ²λ¦¬μ reduce, map, filter μ¬μ© (3νμ ) μ΅λͺ ν¨μ Lambda ν¨μλ νν μ°λ¦¬κ° μλ μΌλ°ν¨μμ μ΅λͺ ν¨μλ‘ λλ μ μλ€. μ΅λͺ ν¨μλ μΌλ°ν¨μμ λ¬λ¦¬ νΈμΆλ ν μ¦μ μλ©Έλλ€. (μΌλ°ν¨μλ λ°ν νμλ λ©λͺ¨λ¦¬ μ‘μλ¨Ήλλ€) μ΅λͺ ν¨μλ μΌλ°ν¨μλ³΄λ€ κ°κ²°νκ² μμ±νμ¬ μ¬μ©ν μ μλ€. μ΄λ¬ν νΉμ±μΌλ‘ lambda(μ΅λͺ ν¨μ)ν¨μλ κ°κ²°νκ³ μΌνμ±μΌλ‘ μ¬μ©ν ν¨μ μμ±μ μ¬μ©λλ€. # μΌλ°ν¨μ def func_name(a, b): return a + b # μ΅λͺ ν¨μ total = lambda a, b: a + b # μ΅λͺ ν¨μλ ν¨μλͺ μ νλλΌ κ³¨ μν μΌλ μλ€. (λ§ κ·Έλλ‘ 'μ΅λͺ ' ν¨μ) lambda ν¨μ μμ 1~10κΉμ§μ μμ°μλ₯Ό κ°κ° μ κ³±νμ¬ λ¦¬μ€νΈμ μ μ₯ν΄..
2021.05.18