Dev. Blog isprometheo의 좌충우돌 개발 블로그
Posts with the tag python:

[Emacs] Python 개발 환경 구축

예전에 Emacs로 python 통합 개발 환경을 구성하기 위해서 여러 라이브러리들을 설치해본 적이 있었다. 당시에는 ropemacs를 사용하여 다른 것보다도 자동 완성 기능을 할 수 있도록 했었다. 최근에 다시 Python으로 개발하면서

[Python] GeoDjango

Django에서 일정 거리내의 데이터를 조회하려면 다음과 같은 API를 사용하면되는데 데이터베이스에 따라 사용할 수 있는 것이 제한되어 있다. SpatiaLite를 이용하는 경우에 distance_gt, distance_gte, distance_lt, distance_lte는 사용 가

[Python] Django logging

Django에서 로그를 남기려면 다음과 같이 하면 된다. settings.py에 다음을 추가한다. LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'file': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'filename': '/path/to/log/debug.log', }, }, 'loggers': { 'django.request': { 'handlers': ['file'], 'level': 'DEBUG', 'propagate': True, }, 'django.request': { 'handlers': ['file'], 'level': 'DEBUG', 'propagate': True, }, ‘myproject': { 'handlers': ['file'], 'level':

[Python] nginx + gunicorn + Django

Django 프로젝트의 settings.py에 다음을 추가한다. STATIC_ROOT = os.path.join(BASE_DIR, 'static') 그리고 다음 명령어를 이용하여 Django에 내장된 static 파일을 지정한 디렉토리에 저장한다. $ python manage.py collectstatic gunicorn 관련된 설정은 공식 문서와 예제 파일을 참고하여 작성한다.

[Python] nginx + Django

Django와 nginx를 연동하기 위해서 flup 라이브러리를 설치한다. $ pip install flup Django 실행은 다음과 같다. $ python manage.py runfcgi method=prefork pidfile=PID_FILE host=127.0.0.1 port=8000 nginx.conf 에 다음과 같이 추가한다. server { listen 80 server_name localhost; location /static/ { #static url autoindex on; root /static/; #static 파일들이 저장된 디렉토리 } location / { #사용