I am trying to deploy django chat application on apache the same way. Can someone please help me with setting up the daphne server? I am totally new to deploying django channels. I have a linux virtual machine (ubuntu). The site is running but the websocket connection is not established. the error I see in the console is:
(index):16 WebSocket connection to 'ws://chat.bagdigital.in/ws/chat/lobby/' failed:
(anonymous) @ (index):16
(index):30 Chat socket closed unexpectedly
chatSocket.onclose @ (index):30
here is my apache conf file.
<VirtualHost *:80>
ServerName chat.bagdigital.in
#ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error_chat_bagwebsite.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/pksingh/chat-app/chat-api/static
Alias /media /home/pksingh/chat-app/chat-api/media
<Directory /home/pksingh/chat-app/chat-api/static>
Require all granted
</Directory>
<Directory /home/pksingh/chat-app/chat-api/media>
Require all granted
</Directory>
<Directory /home/pksingh/chat-app/chat-api/chatapi>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/pksingh/chat-app/chat-api/chatapi/wsgi.py
WSGIDaemonProcess bag_chat_app python-path=/home/pksingh/chat-app/chat-api python-home=/home/pksingh/chat-app/chat-api/venv
WSGIProcessGroup bag_chat_app
I have installed the redis server. And the socket connection is running fine if I run the django server at port 8000 normally without using apache.
python3 manage.py runserver 0.0.0.0:8000 &
Can someone help me with setting up daphne server here??