본문 바로가기

전체 글

Django REST Framework 간단설정 참고 : medium.com/swlh/build-your-first-rest-api-with-django-rest-framework-e394e39a482c 1. Django Rest Frame Work를 설치한다. pip install djangorestframework 2. settings.py에 설정한다. 1 2 3 4 5 INSTALLED_APPS = [ # All your installed apps stay the same ... 'rest_framework', ] Colored by Color Scripter 3. serializers.py 파일 작성 1 2 3 4 5 6 7 8 from rest_framework import serializers from .models import MyMode.. 더보기
Django Permission 참고 : developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication Django Tutorial Part 8: User authentication and permissions Excellent work — you've now created a website that library members can log in into and view their own content and that librarians (with the correct permission) can use to view all loaned books and their borrowers. At the moment we're still just viewing c devel.. 더보기
Django : Model 정의하기 1. Field생성 시 주요 argument max_length help_text : 도움말 verbose_name : UI상에 나오는 이름 default : 기본값 null : True/False blank : True/False, blank허용여부 (필요시 null=True와 같이 쓰이기도) choices : 선택가능한 값 primary_key : True일 경우 이 값을 primary key로 만듬 2. Field Type docs.djangoproject.com/en/3.0/ref/models/fields/#model-field-types CharField : 고정길이 문자열. max_length를 반드시 할당해줘야함 TextField : 긴 텍스트 IntegerField : 정수 DateFiel.. 더보기
Python 파일 목록 및 하위폴더 목록 읽어오기 출처 : https://www.quora.com/Whats-the-easiest-way-to-recursively-get-a-list-of-all-the-files-in-a-directory-tree-in-Python 1. os.listdir() 1 2 3 4 5 6 7 8 9 10 11 12 def traverse(dirpath) for item in os.listdir(dirpath): #item은 폴더거나 파일이거나 둘중 하나 abspath = os.path.join(dirpath, item) try: if os.path.isdir(abspath): #폴더인경우 traverse(abspath) else: #파일인 경우 dosomething(dirpath, item) except FileNotFoun.. 더보기
Ubuntu에서 Python3 virtualenv개발환경 작성하기 보호되어 있는 글입니다. 더보기
테두리 추출용 XDoG 필터 코드 (파이썬3용) 테두리 추출용 XDoG필터 구현한 파이썬3용 코드 출처 : https://blog.csdn.net/qq_27879381/article/details/72718135 XDoG:一种快速简洁的图像边缘提取器_Python_icmll-CSDN博客 引言 前段时间由于做Auto-painter(经常抽风会坏掉的demo、很卡常常进不去的文章)的项目,需要生成一大堆训练集,就是一张彩色的图片和它的线条图(sketch),一些现成的什么边缘提取算子的效果感觉都不太好用,机智的我找寻到了一种叫做XDoG的边缘提取算子,并且用matlab和python都进行了实现。效果如下: Figure 1. sketch Figure 2. orginal picture 基本原理 基本就是参照谷歌2012年的的一篇叼叼叼的论文:XDoG: An eXtended dif blog.csdn.. 더보기
CentOS 8 한글 입력문제 해결하기 CentOS 8 은 ibus-hangul이 자동으로 설치 되지 않는다.... 1) dnf yum install ibus-hangul 2) 리부트 3) "설정 -> 지역 및 언어 -> 입력소스"에 가서 korea로 검색하면 나오는 "한국어(Hangul)"을 선택한다. ※ ibus-hangul을 설치하지 않으면 "한국어(hangul)"이 나오지 않는다 4) 이제 shift+space로 한/영 전환하여 한글을 사용한다. 더보기
우분투 Nvidia 드라이버 삭제하기 Nvidia 드라이버를 깔았는데 잘 안될 경우, 차라리 오픈소스 드라이버인 Nouveau로 돌리고 싶을때 사용하는 방법을 정리한다. 1) Grub에서 recovery 모드로 진입한 후 커맨드 라인으로 들어간다 2) sudo nvidia-uninstall 3) sudo apt-get remove --purge nvidia* 4) sudo apt autoremove 5) sudo apt autoclean 6) nouveau를 블랙리스트에 걸어두었을 수 있으니 하기명령으로 블랙리스트를 해제한다. sudo rm /etc/modprobe.d/blacklist-nouveau.conf 7) sudo update-initramfs -k all - u 8) 우분투 데스크탑에 문제가 있는 경우 데스크탑을 다시 설치해준다... 더보기