J'ai trouvé le problème.
Mon socket [runserver] (app.sock) doit être pointé sous upstream django
et mon socket [wsserver] (django.sock) doit être pointé sous location /ws/
comme ça :
upstream django {
server unix:/opt/django/app.sock;
}
server {
listen 80 default_server;
charset utf-8;
client_max_body_size 20M;
sendfile on;
keepalive_timeout 0;
large_client_header_buffers 8 32k;
location /media {
alias /opt/django/app/media/media;
}
location /static {
alias /opt/django/app/static;
}
location / {
include /opt/django/uwsgi_params;
}
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://unix:/opt/django/django.sock;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
}
}