i have a Django project/website that hold 3 chatting application two of them is using HTTp request as a chatbot the uses views.py to retrieve the replay from the DataBase , and the third on is using Django channels and websockets as a normal basic one-to0one chatting app, connecting and echoing the messages worked perfectly but the problem is that when i try to send a message using Group() function in consumer.py it doesn't work.

So, i found out that the reason is that my websocket app doesn't seem to route correctly when running alongside my mod_wsgi app. So, the only solution is stopping my Apache,and then serving the whole app from your websockets port via the runserver command. When i did this the Group () worked, but the problem is i developed the whole website using Apache which it serves 2 of 3 apps in my Django website, the 3th one is using web sockets(and it took me a long time). I need both Apache and websockets in my Django project.

this is my Apache config:

ServerRoot "/home/mansard/webapps/gadgetron/apache2"

LoadModule authz_core_module modules/mod_authz_core.so
LoadModule dir_module        modules/mod_dir.so
LoadModule env_module        modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module       modules/mod_mime.so
LoadModule rewrite_module    modules/mod_rewrite.so
LoadModule setenvif_module   modules/mod_setenvif.so
LoadModule wsgi_module       modules/mod_wsgi.so
LoadModule unixd_module      modules/mod_unixd.so
LoadModule expires_module    modules/mod_expires.so

LoadModule headers_module modules/mod_headers.so

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /home/mansard/logs/user/access_gadgetron.log combined
ErrorLog /home/mansard/logs/user/error_gadgetron.log

Listen 16709
KeepAlive Off
SetEnvIf X-Forwarded-SSL on HTTPS=1
ServerLimit 1
StartServers 1
MaxRequestWorkers 5
MinSpareThreads 1
MaxSpareThreads 3
ThreadsPerChild 5

Header set Access-Control-Allow-Origin: *

Header set Access-Control-Allow-Headers: content-type

Header set Access-Control-Allow-Methods: *

WSGIDaemonProcess gadgetron processes=2 threads=12 python-path=/home/mansard/webapps/gadgetron:/home/mansard/webapps/gadgetron/src:/home/mansard/webapps/gadgetron/lib/python3.5
WSGIProcessGroup gadgetron
WSGIRestrictEmbedded On
WSGILazyInitialization On
WSGIScriptAlias  / /home/mansard/webapps/gadgetron/src/chatbot/wsgi.py process-group=gadgetron application-group=%{GLOBAL}

Any ideas how to address this issue?

PS: someone told me that i need to switch to Nginx as my website configuration (How i can accomplish that?)

  • What port is the websockets app on? you might want to change it if its port 80 because trying to do too many operations on the same port at the same time and from the same IP address can be a nightmare. – Mike Sep 14 '17 at 2:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.