Skip to content

Commit

Permalink
추가: Celery 비동기 처리
Browse files Browse the repository at this point in the history
- send_email_verification -> tasks.py 로 이동
- celery 설치 및 사용  broker: redis, result: redis
- docker-compose 변경
  • Loading branch information
Sahayana committed Sep 30, 2023
1 parent e8a0353 commit 84dff8c
Show file tree
Hide file tree
Showing 83 changed files with 179 additions and 4,709 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ python-dotenv = "*"
django-extensions = "*"
factory-boy = "*"
pytest-mock = "*"
celery = {extras = ["redis"], version = "*"}

[dev-packages]

Expand Down
89 changes: 88 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions alaltalk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .celery import app as celert_app

__all__ = ("celery_app",)
11 changes: 11 additions & 0 deletions alaltalk/celery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os

from celery import Celery
from django.conf import settings

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alaltalk.settings.dev")

app = Celery("alaltalk")

app.config_from_object(settings, namespace="CELERY")
app.autodiscover_tasks()
4 changes: 4 additions & 0 deletions alaltalk/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,7 @@
"SLIDING_TOKEN_OBTAIN_SERIALIZER": "rest_framework_simplejwt.serializers.TokenObtainSlidingSerializer",
"SLIDING_TOKEN_REFRESH_SERIALIZER": "rest_framework_simplejwt.serializers.TokenRefreshSlidingSerializer",
}

# Celery settings
CELERY_BROKER_URL = "redis://redis:6379"
CELERY_RESULT_BACKEND = "redis://redis:6379"
6 changes: 4 additions & 2 deletions alaltalk/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

get_secret(env="dev")

DEBUG = bool(os.environ["DEBUG"])

SECRET_KEY = os.environ["SECRET_KEY"]

SIMPLE_JWT.update({"SIGNING_KEY": SECRET_KEY})
Expand All @@ -29,8 +31,8 @@
EMAIL_PORT = os.environ["EMAIL_PORT"]
EMAIL_HOST_USER = os.environ["EMAIL_HOST_USER"]
EMAIL_HOST_PASSWORD = os.environ["EMAIL_HOST_PASSWORD"]
EMAIL_USE_TLS = os.environ["EMAIL_USE_TLS"]
EMAIL_USE_SSL = os.environ["EMAIL_USE_SSL"]
EMAIL_USE_TLS = bool(os.environ["EMAIL_USE_TLS"])
EMAIL_USE_SSL = bool(os.environ["EMAIL_USE_SSL"])


# 현재 AWS S3 storage는 서버가 닫은 관계로 사용하지 않습니다.
Expand Down
2 changes: 2 additions & 0 deletions alaltalk/settings/prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

get_secret(env="prod")

DEBUG = bool(os.environ["DEBUG"])

SECRET_KEY = os.environ["SECRET_KEY"]

SIMPLE_JWT.update({"SIGNING_KEY": SECRET_KEY})
Expand Down
Empty file removed app/__init__.py
Empty file.
Empty file removed app/accounts/__init__.py
Empty file.
44 changes: 0 additions & 44 deletions app/accounts/admin.py

This file was deleted.

12 changes: 0 additions & 12 deletions app/accounts/apps.py

This file was deleted.

15 changes: 0 additions & 15 deletions app/accounts/backends.py

This file was deleted.

15 changes: 0 additions & 15 deletions app/accounts/forms.py

This file was deleted.

Binary file removed app/accounts/model/kor_word2vec.model
Binary file not shown.
Loading

0 comments on commit 84dff8c

Please sign in to comment.