我正在尝试将Django应用程序部署到Heroku,但我不断收到以下错误:
2020-04-13T08:45:00.134349+00:00 app[web.1]: Traceback (most recent call last):
2020-04-13T08:45:00.134389+00:00 app[web.1]: File "/app/.heroku/python/bin/daphne", line 8, in <module>
2020-04-13T08:45:00.134519+00:00 app[web.1]: sys.exit(CommandLineInterface.entrypoint())
2020-04-13T08:45:00.134524+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/daphne/cli.py", line 191, in entrypoint
2020-04-13T08:45:00.134697+00:00 app[web.1]: cls().run(sys.argv[1:])
2020-04-13T08:45:00.134699+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/daphne/cli.py", line 252, in run
2020-04-13T08:45:00.134891+00:00 app[web.1]: application = import_by_path(args.application)
2020-04-13T08:45:00.134913+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/daphne/utils.py", line 14, in import_by_path
2020-04-13T08:45:00.135028+00:00 app[web.1]: target = getattr(target, bit)
2020-04-13T08:45:00.135056+00:00 app[web.1]: AttributeError: module 'mysite.asgi' has no attribute 'channel_layer
这是我的Procfile:
web: daphne WR.asgi:channel_layer --port $PORT --bind 0.0.0.0 -v2
这就是我在settings.py上定义Redis的方式:
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
"hosts": [('https://mytestapp1.herokuapp.com/', 6379)],
'capacity': 1500,
'expiry': 2,
},
},
}
谁能帮我找到我做错了什么?难道我必须将Redis heroku插件添加到我的应用程序中?
看到asgi.py会很好,但是我想这可能会有所帮助。
网址:daphne WR.asgi:application --port $ PORT --bind 0.0.0.0 -v2
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句