라벨이 Django인 게시물 표시

[Django] bulk_create 예제

  # service = created.user.username             # filenname = created.file             # filepath = '/home/ubuntu/lotto/file/' + service + '/' + filenname             # file = open(filepath)             # reader = csv.reader(file)             # bulk_list = []             # user = created.user             # round = created.round             # date = created.date             # grade = created.grade             # lucky = created.lucky             # for row in reader:             #     bulk_list.append(             #         Lucky(       ...

[Django] robots.txt 적용

[robots.txt 만들기] robots.txt 내용 모든 로봇 수집 허용 User-agent: * Allow:/ 네이버 로봇만 수집 허용 User-agent: Yeti Allow:/ robots.txt 위치 project\app\templates\app\robots.txt [Django 설정] project\project\urls.py 에 아래 내용 추가 from django.views.generic import TemplateView path('robots.txt/', TemplateView.as_view(template_name="app/robots.txt", content_type='text/plain'))

[Django] BSModalReadView 404 Error

class SmsrelatedCheckView ( BSModalReadView ): template_name = 'homepage/read_smsrelated.html' model = Smsrelated 404 에러발생 class SmsrelatedCheckView ( BSModalReadView ): template_name = 'homepage/read_smsrelated.html' model = Smsrelated queryset = Content.objects.all() queryset 등록 시 에러나지 않음

[Django] migration 초기화

python manage.py migrate --fake core zero delete migration py files in app

[OS] Apache2 Port 변경

아파치의 기본 서비스 포트인 80포트를 다른 포트로 변경하는 방법입니다. apache 2.4.x 기준입니다. 아파치의 포트 관련 환경설정 파일 열기 $ sudo nano /etc/apache2/ports.conf 80이라고 되어 있는 Listen 포트를 아래와 같이 원하는 포트로 변경한 후 수정한 파일을 저장하고 에디터 모드에서 빠져나옵니다. 아파치의 가상호스트 환경설정 파일 열기 $ sudo nano /etc/apache2/sites-available/000-default.conf <VirtualHost *:80> 라인을 찾고 아래와 같이 수정한 후 저장하고 나옵니다. <VirtualHost *:8081> 아파치 서비스 재시작하기 $ sudo /etc/init.d/apache2 restart 웹브라우져로 기존에 접속했던 주소 뒤에 변경한 포트 번호를 입력해보고 접근 가능한지 테스트합니다. 아래와 같은 방식으로 입력하면 됩니다.  http://서버주소:8081