728x90 WEB/Django10 Window 환경에서 django celery 오류 및 작동 방법 django 에서 비동기로 api를 처리하려면 celery를 사용하여야 한다. 다음 명령어로 celery를 설치한다. pip install celery 그 다음 celery.py를 config 폴더 내에 다음과 같이 작성하여 준다. from __future__ import absolute_import, unicode_literals import os from celery import Celery, shared_task from django.conf import settings from celery.schedules import crontab # set the default Django settings module for the 'celery' program. os.environ.setdefault('DJ.. 2023. 10. 24. Django Project AWS에 배포하기 1 AWS에 Django Project를 배포해보도록 하겠다. 우선 AWS 콘솔에 로그인한다. 로그인 후 EC2를 사용할 것이기 때문에 EC2로 이동한다. ubuntu server 18.04를 선택한다. 프리티어로 사용 가능한 t2.micro를 선택하였다. 인스턴스를 생성하면 다음과 같이 키 페어를 생성하라고 나온다. 키가 없다면 새 키 페어 생성을 통해 키페어를 생성해준다. 해당 키를 통해 서버에 접속할 수 있기 때문에 키는 안전한 폴더에 보관한다. 인스턴스 시작을 누르고 어느정도 기다리면 인스턴스가 시작된다. 인스턴스가 시작되면 연결을 통해 인스턴스에 들어가보자. 인스턴스에 접속하기 위해 putty 를 다운받도록 한다. putty는 아래주소에서 다운받을수 있다. www.chiark.greenend.org.. 2020. 9. 8. Django 파이썬 웹 프로그래밍(8) React 설치 React를 설치하기 위해 node.js를 먼저 설치해야 한다. https://nodejs.org/en/download/ Download | Node.js Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. nodejs.org node.js 쉬운 설치를 위해 .msi 파일로 자신의 운영체제에 맞는 버전을 선택한다. 설치를 완료하면 다음과 같이 뜬다. node가 잘 설치되었는지 확인하는 방법은 cmd 창에 npm -v를 입력하면 된다. (django_project) C:\Users\devgu\community>npm -v 6.14.6 그 다음 create react app을 설치한다. create react app은 react .. 2020. 8. 17. Django 파이썬 웹 프로그래밍(7) TextEditor 사용 + 설정 ckeditor를 통해 Field를 TextField에서 RichtextUploadingField로 바꿔주겠다. pip install django-ckeditor 그 다음 base.py를 다음과 같이 바꿔준다. INSTALLED_APPS = [ ... 'ckeditor', 'ckeditor_uploader', ] CKEDITOR_UPLOAD_PATH = 'uploads/' CKEDITOR_IMAGE_BACKEND = "pillow" urlpatterns을 다음과 같이 수정해준다. url(r'^ckeditor/', include('ckeditor_uploader.urls')), models.py text를 다음과 같이 수정해준다. text = RichTextUploadingField(blank=True,n.. 2020. 7. 26. Django 파이썬 웹 프로그래밍(6) API 저번 글에서 만든 TitleSearch API를 사용해보도록 하겠다. 우리는 urls.py에서 tsearch/ 로 들어왔을 때 views.py의 TitleSearch로 넘겨주었다. TitleSearch는 다음과 같다. class TitleSearch(APIView): def get(self, request, format=None): title_search = request.query_params.get('title_search', None) if title_search is not None: post = models.Post.objects.filter(title__contains=title_search) serializer = serializers.PostSerializer(post, many=True).. 2020. 7. 26. Django 파이썬 웹 프로그래밍(5) ADMIN 계정 설정 및 ADMIN PAGE 이번 글에서는 Admin 계정 설정과 Admin Page에서 Post APP을 확인해보도록 하겠다. 우선 runserver을 통해 localhost 서버를 열어주도록 하겠다. python manage.py runserver 그 다음으로 urls.py를 이용해 amdin page를 들어가기 위해 다음과 같이 수정해준다. from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.conf.urls import include, url from django.views import defaults as default_views from django.views.. 2020. 7. 26. Django 파이썬 웹 프로그래밍(4) Postgresql 설치 및 연결 Database를 담당하는 Postgresql 설치 와 연결을 하도록 하겠다. https://www.postgresql.org/download/windows/ PostgreSQL: Windows installers Windows installers Interactive installer by EDB Download the installer certified by EDB for all supported PostgreSQL versions. This installer includes the PostgreSQL server, pgAdmin; a graphical tool for managing and developing your databases, and StackBui www.postgresql.org 에서.. 2020. 7. 26. Django 파이썬 웹 프로그래밍(3) Model과 View 그리고 Serializer 이번 글에서는 model을 생성하고 migration 작업을 통하여 admin 페이지에서 확인하는 작업까지 가질 것이다. 지금 제작하는 사이트는 커뮤니티 사이트이다. 우리가 만든 APP은 post이다. post를 구성하는 요소에는 글, 댓글이 있을 것이다. 또한 글은 TimeModel이다. Time Model이란 시간정보를 담고 있다. 대부분의 글과 댓글은 작성시간이나 수정시간을 포함한다. models.py를 다음과 같이 수정한다. from django.db import models class Post(TimeStampedModel): title = models.CharField(max_length=50, null=True) owner_nick = models.CharField(max_length=50,.. 2020. 7. 26. Django 파이썬 웹 프로그래밍(2) 앱 만들기 Django에서 Database를 사용하여 작업을 하려면 우선 앱(Application)을 생성해주어야 한다. 필자는 커뮤니티 사이트를 만들 예정이므로 Post라는 이름의 앱을 만들도록 하겠다. (django_project) C:\Users\devgu\community>python manage.py startapp post 만들었으면 community 아래에 post라는 폴더가 생긴다. 폴더 내용은 다음과 같다. 하나씩 살펴보자 1. migration - python으로 정의한 내용을 DB로 옮겨주는 것이다. 자동으로 sql문을 작성해준다고 생각하면 된다. 따로 건들이 필요 없이 나중에 manage.py를 이용하면 된다. 2. admin - admin page를 위한 py이다. 3. apps - app에.. 2020. 7. 26. 이전 1 2 다음 728x90