Skip to content

Instantly share code, notes, and snippets.

@allieus
allieus / naver_webtoon_crawl.py
Last active August 27, 2024 11:31
네이버 웹툰, 특정 에피소스, 하나의 이미지로 합치기
import os
import requests
from bs4 import BeautifulSoup
from PIL import Image
def dump(episode_url):
html = requests.get(episode_url).text
soup = BeautifulSoup(html)
@allieus
allieus / README.md
Last active June 28, 2024 05:04
윈도우 기본 개발 프로그램 설치

윈도우 기본 개발 프로그램 설치

  • 아래 명령들에서 필요한 프로그램을 설치하는 명령만 복사해서 설치해주세요.
@allieus
allieus / ddns.py
Last active May 9, 2024 23:15
Route 53 에 내 도메인 정보 반영하기 (Dynamic DNS 로 활용하기)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from boto.route53 import connect_to_region
from boto.route53.record import ResourceRecordSets
def apply(domain, ip, ttl, region, access_key=None, secret_key=None):
if access_key:
os.environ.setdefault('AWS_ACCESS_KEY_ID', access_key)
@allieus
allieus / README.md
Last active February 8, 2024 00:48
맥 개발 팩키지 설치
@allieus
allieus / README.md
Created July 5, 2016 02:58
네이버 웹툰 크롤링

주의

  • 본 스크립트는 학술목적으로만 사용해주세요.
  • 만화책은 구매해서 보시고, 웹툰은 웹툰 서비스를 통해 감상해주세요. :-)
@allieus
allieus / extend.py
Created August 30, 2011 02:37
Update for ONLY changed fields
from django.db import models
class ChangedOnlySaveModel(models.Model):
def __init__(self, *args, **kwargs):
models.Model.__init__(self, *args, **kwargs)
self._initial_data = self.__dict__.copy()
def save(self, commit=True):
if not self.pk:
models.Model.save(self, commit)
@allieus
allieus / gist:1180051
Last active June 25, 2022 18:10
wgs84/tm127/tm128/grs80/cyworld 간 좌표변환
'''
aero님께서 구현하신 구글/네이버/싸이월드/콩나물 좌표변환은 펄/자바스크립트로 되어있습니다.
펄/자바스크립트에 익숙지 않은지라, 수식을 파이썬으로 번역해보았습니다.
'''
from pyproj import Proj
from pyproj import transform
WGS84 = { 'proj':'latlong', 'datum':'WGS84', 'ellps':'WGS84', }
@allieus
allieus / askdjango_vod_frontend_jquery_sample.html
Created September 4, 2017 08:39
AskDjango VOD, 웹프론트엔드 시작편, jQuery 샘플
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Melon 검색</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
</head>
<body>
<div class="container">

TL;DR

django-subdomains 라이브러리는 channels websocket URL 라우팅에 관여할 수 없습니다.

배경

웹소켓에서도 urlpatterns를 지정하고 URL 별로 다른 Consumer를 지정할 수 있는데요. 서브도메인 별로 다른 urlpatterns를 가지도록 할 수 있느냐. 이를 위해 django-subdomains 라이브러리를 사용할 수 있느냐가 주제였습니다.

django-subdomains 라이브러리는 장고 미들웨어를 통해, 요청 도메인별로 root urlconf를 다르게 설정해주는 기능을 합니다. channels에서 django-subdomains이 사용가능하느냐인데요. 결론적으로는 django-subdomains는 channels를 지원할 수 없습니다.

@allieus
allieus / z_allinone.sh
Last active December 20, 2021 14:24
centos 7.2 에 장고 프로젝트 배포 (using ncloud VM)
# check root user
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# yum epel 저장소 추가
yum install -y epel-release
# 아파치 웹서버 설치 및 시작