gpt4 book ai didi

python - 在 Daphne - SSL 上使用 channel 部署 django 应用程序

转载 作者:太空狗 更新时间:2023-10-30 01:36:31 29 4
gpt4 key购买 nike

我正在尝试部署一个简单的 django 应用程序来接收 websocket 消息 (wss)。

我正在使用以下命令:

daphne -e ssl:443:privateKey=key.pem:certKey=cert.cer bms_project.asgi:channel_layer

settings.py 文件中包含以下内容:

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECRET_KEY = os.environ["SECRET_KEY_BMS"]

和以下 asgi.py 文件:

import os
from channels.asgi import get_channel_layer

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bms_project.settings")

# secret key
os.environ["SECRET_KEY_BMS"] = "some random self-signing key off the internet"

channel_layer = get_channel_layer()

出现以下错误:

 File "c:\program files\python36\lib\site-packages\django\conf\__init__.py", line 129, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

我觉得我对 key 的处理不正确,不知道正确的方法是什么。

最佳答案

关于python - 在 Daphne - SSL 上使用 channel 部署 django 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47762507/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com