2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Django Channels のデプロイ時に注意すべきこと

Posted at

はじめに

今回はDjango Channelsを用いて作成した、websocketを用いてチャット等ができるDjangoアプリのデプロイ時に注意すべきことを紹介します。

asgi.py

asgi.pyは以下のように変更しましょう。おそらく、チュートリアルの際に記述したコードと若干違うと思います。(django.setup()get_default_application()など)

asgi.py
import os
import django
from channels.routing import get_default_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
django.setup()
application = get_default_application()

サーバ

こちらを参考にして、好きな構成にしましょう。

おわりに

デプロイ作業中に上記以外の気づきがあったらその都度追記していく予定です。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?