I wanna deploy my django project to heroku. My project uses channels so I need to set up ASGI based environment.
I have two installed add-ons in heroku app. One is Heroku-postgresql and the other is Heroku-redis.
And I have two dynos please refer to below picture.
addons, dyno:
I succeeded push django project on heroku git. $ git push heroku master
build, deployed:
So, I got url address. URL : demo-multichat.herokuapp.com
If you access that url, you will face Application error.
I got log msg using $ heroku logs. Below is log messages.
2017-09-08T11:54:50.421663+00:00 app[web.1]: 2017-09-08 20:54:50,421 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:54:55.424117+00:00 app[web.1]: 2017-09-08 20:54:55,423 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:00.426387+00:00 app[web.1]: 2017-09-08 20:55:00,426 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:05.428815+00:00 app[web.1]: 2017-09-08 20:55:05,428 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:10.430511+00:00 app[web.1]: 2017-09-08 20:55:10,430 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:15.432112+00:00 app[web.1]: 2017-09-08 20:55:15,431 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:18.486722+00:00 heroku[worker.1]: State changed from crashed to starting
2017-09-08T11:55:20.434001+00:00 app[web.1]: 2017-09-08 20:55:20,433 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:22.996928+00:00 heroku[worker.1]: Starting process with command `python manage.py runworker`
2017-09-08T11:55:23.685971+00:00 heroku[worker.1]: State changed from starting to up
2017-09-08T11:55:25.435766+00:00 app[web.1]: 2017-09-08 20:55:25,435 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:27.264386+00:00 app[worker.1]: 2017-09-08 20:55:27,264 - INFO - runworker - Using single-threaded worker.
2017-09-08T11:55:27.264803+00:00 app[worker.1]: 2017-09-08 20:55:27,264 - INFO - runworker - Running worker against channel layer default (asgi_redis.core.RedisChannelLayer)
2017-09-08T11:55:27.265237+00:00 app[worker.1]: 2017-09-08 20:55:27,264 - INFO - worker - Listening on channels chat.receive, http.request, websocket.connect, websocket.disconnect, websocket.receive
2017-09-08T11:55:27.276810+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 484, in connect
2017-09-08T11:55:27.277217+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 541, in _connect
2017-09-08T11:55:27.277631+00:00 app[worker.1]: raise err
2017-09-08T11:55:27.276796+00:00 app[worker.1]: Traceback (most recent call last):
2017-09-08T11:55:27.277635+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 529, in _connect
2017-09-08T11:55:27.277992+00:00 app[worker.1]: sock.connect(socket_address)
2017-09-08T11:55:27.278042+00:00 app[worker.1]: ConnectionRefusedError: [Errno 111] Connection refused
2017-09-08T11:55:27.277199+00:00 app[worker.1]: sock = self._connect()
2017-09-08T11:55:27.278044+00:00 app[worker.1]:
2017-09-08T11:55:27.278045+00:00 app[worker.1]: During handling of the above exception, another exception occurred:
2017-09-08T11:55:27.278045+00:00 app[worker.1]:
2017-09-08T11:55:27.278049+00:00 app[worker.1]: Traceback (most recent call last):
2017-09-08T11:55:27.278050+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/client.py", line 667, in execute_command
2017-09-08T11:55:27.278455+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 610, in send_command
2017-09-08T11:55:27.278453+00:00 app[worker.1]: connection.send_command(*args)
2017-09-08T11:55:27.278858+00:00 app[worker.1]: self.send_packed_command(self.pack_command(*args))
2017-09-08T11:55:27.278862+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 585, in send_packed_command
2017-09-08T11:55:27.279107+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 489, in connect
2017-09-08T11:55:27.279104+00:00 app[worker.1]: self.connect()
2017-09-08T11:55:27.279337+00:00 app[worker.1]: redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
2017-09-08T11:55:27.279322+00:00 app[worker.1]: raise ConnectionError(self._error_message(e))
2017-09-08T11:55:27.279338+00:00 app[worker.1]:
2017-09-08T11:55:27.279339+00:00 app[worker.1]: During handling of the above exception, another exception occurred:
2017-09-08T11:55:27.279339+00:00 app[worker.1]:
2017-09-08T11:55:27.279340+00:00 app[worker.1]: Traceback (most recent call last):
2017-09-08T11:55:27.279340+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 484, in connect
2017-09-08T11:55:27.279538+00:00 app[worker.1]: sock = self._connect()
2017-09-08T11:55:27.279541+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 541, in _connect
2017-09-08T11:55:27.279757+00:00 app[worker.1]: raise err
2017-09-08T11:55:27.279760+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 529, in _connect
2017-09-08T11:55:27.279971+00:00 app[worker.1]: sock.connect(socket_address)
2017-09-08T11:55:27.279974+00:00 app[worker.1]: ConnectionRefusedError: [Errno 111] Connection refused
2017-09-08T11:55:27.279976+00:00 app[worker.1]:
2017-09-08T11:55:27.279977+00:00 app[worker.1]: During handling of the above exception, another exception occurred:
2017-09-08T11:55:27.279978+00:00 app[worker.1]:
2017-09-08T11:55:27.279991+00:00 app[worker.1]: Traceback (most recent call last):
2017-09-08T11:55:27.279993+00:00 app[worker.1]: File "manage.py", line 10, in <module>
2017-09-08T11:55:27.280072+00:00 app[worker.1]: execute_from_command_line(sys.argv)
2017-09-08T11:55:27.280083+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
2017-09-08T11:55:27.280251+00:00 app[worker.1]: utility.execute()
2017-09-08T11:55:27.280254+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute
2017-09-08T11:55:27.280421+00:00 app[worker.1]: self.fetch_command(subcommand).run_from_argv(self.argv)
2017-09-08T11:55:27.280424+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
2017-09-08T11:55:27.280590+00:00 app[worker.1]: self.execute(*args, **cmd_options)
2017-09-08T11:55:27.280591+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
2017-09-08T11:55:27.280762+00:00 app[worker.1]: output = self.handle(*args, **options)
2017-09-08T11:55:27.280763+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/channels/management/commands/runworker.py", line 83, in handle
2017-09-08T11:55:27.280878+00:00 app[worker.1]: worker.run()
2017-09-08T11:55:27.280879+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/channels/worker.py", line 87, in run
2017-09-08T11:55:27.280972+00:00 app[worker.1]: channel, content = self.channel_layer.receive_many(channels, block=True)
2017-09-08T11:55:27.280973+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/asgiref/base_layer.py", line 43, in receive_many
2017-09-08T11:55:27.282189+00:00 app[worker.1]: return self.receive(channels, block)
2017-09-08T11:55:27.282191+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/asgi_redis/core.py", line 215, in receive
2017-09-08T11:55:27.282191+00:00 app[worker.1]: result = connection.blpop(list_names, timeout=self.blpop_timeout)
2017-09-08T11:55:27.282192+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/client.py", line 1269, in blpop
2017-09-08T11:55:27.282193+00:00 app[worker.1]: return self.execute_command('BLPOP', *keys)
2017-09-08T11:55:27.282193+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/client.py", line 673, in execute_command
2017-09-08T11:55:27.282194+00:00 app[worker.1]: connection.send_command(*args)
2017-09-08T11:55:27.282195+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 610, in send_command
2017-09-08T11:55:27.282196+00:00 app[worker.1]: self.send_packed_command(self.pack_command(*args))
2017-09-08T11:55:27.282196+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 585, in send_packed_command
2017-09-08T11:55:27.282453+00:00 app[worker.1]: self.connect()
2017-09-08T11:55:27.282454+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 489, in connect
2017-09-08T11:55:27.282744+00:00 app[worker.1]: raise ConnectionError(self._error_message(e))
2017-09-08T11:55:27.282772+00:00 app[worker.1]: redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
2017-09-08T11:55:27.459143+00:00 heroku[worker.1]: State changed from up to crashed
2017-09-08T11:55:27.446333+00:00 heroku[worker.1]: Process exited with status 1
2017-09-08T11:55:10+00:00 app[heroku-redis]: source=REDIS sample#active-connections=2 sample#load-avg-1m=0.315 sample#load-avg-5m=0.21 sample#load-avg-15m=0.16 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15664264kB sample#memory-free=11905356kB sample#memory-cached=961068kB sample#memory-redis=299032bytes sample#hit-rate=1 sample#evicted-keys=0
2017-09-08T11:55:30.437885+00:00 app[web.1]: 2017-09-08 20:55:30,437 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:35.439587+00:00 app[web.1]: 2017-09-08 20:55:35,439 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:40.441760+00:00 app[web.1]: 2017-09-08 20:55:40,441 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:45.443072+00:00 app[web.1]: 2017-09-08 20:55:45,442 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:50.444948+00:00 app[web.1]: 2017-09-08 20:55:50,444 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:55.446645+00:00 app[web.1]: 2017-09-08 20:55:55,446 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:00.449178+00:00 app[web.1]: 2017-09-08 20:56:00,448 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:05.450944+00:00 app[web.1]: 2017-09-08 20:56:05,450 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:10.452898+00:00 app[web.1]: 2017-09-08 20:56:10,452 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:15.456223+00:00 app[web.1]: 2017-09-08 20:56:15,456 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:20.457782+00:00 app[web.1]: 2017-09-08 20:56:20,457 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:25.459987+00:00 app[web.1]: 2017-09-08 20:56:25,459 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:30.461919+00:00 app[web.1]: 2017-09-08 20:56:30,461 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:08+00:00 app[heroku-redis]: source=REDIS sample#active-connections=2 sample#load-avg-1m=0.305 sample#load-avg-5m=0.24 sample#load-avg-15m=0.17 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15664264kB sample#memory-free=11911660kB sample#memory-cached=961060kB sample#memory-redis=299032bytes sample#hit-rate=1 sample#evicted-keys=0
2017-09-08T11:56:35.463998+00:00 app[web.1]: 2017-09-08 20:56:35,463 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:40.466396+00:00 app[web.1]: 2017-09-08 20:56:40,466 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:45.467830+00:00 app[web.1]: 2017-09-08 20:56:45,467 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:50.469777+00:00 app[web.1]: 2017-09-08 20:56:50,469 ERROR Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:55.471533+00:00 app[web.1]: 2017-09-08 20:56:55,471 ERROR Error trying to receive messages: NOAUTH Authentication required.
Among the various errors, NOAUTH Authentication required stand out.
What's wrong with me?? I wonder I correctly set up significant files(asgi.py, wsgi.py, settings.py, manage.py, Procfile
).
Could you look into those files? I leave my project github repository.
URL : github.com/juhyun16/multichat
multichat/asgi.py, wsgi.py
settings/dev.py, prod.py, settings.py
manage.py, Procfile
If settings are no problem, then what's wrong?? I appreciate your help. p.s.)My reputation is less than 10. So I can't post more than 2 links. Sorry for inconvenience.