Django Channels, Nginx, Daphne - Not working?

2017-05-02 Thread Alex Elson
I am using Google Cloud to host my Django project, and I'm trying to run it 
with Nginx. I open two instances of the terminal, one with the command 
"python manage.py runworker" and the other with "daphne 
firstproject.asgi:channel_layer". I am able to connect to my public ip, and 
the page loads the clientside Javascript, but all the 'Channels' parts do 
not seem to work despite all this. What could be wrong? What am I 
forgetting? Thanks for any help. 

Here is my response to these commands, as well as my CHANNELS_LAYER in my 
settings file.

$ daphne firstproject.asgi:channel_
layer
2017-05-02 07:01:04,853 INFO Starting server 
attcp:port=8000:interface=127.0.0.1, channel layer 
firstproject.asgi:channel_layer.
2017-05-02 07:01:04,853 INFO HTTP/2 support enabled
2017-05-02 07:01:04,853 INFO Using busy-loop synchronous mode on 
channel layer
2017-05-02 07:01:04,854 INFO Listening on endpoint 
tcp:port=8000:interface=127.0.0.1
127.0.0.1:47296 - - [02/May/2017:07:01:17] "GET /" 200 5801

$ python manage.py runworker
2017-05-02 07:06:12,589 - INFO - runworker - Using single-threaded worker.
2017-05-02 07:06:12,589 - INFO - runworker - Running worker against channel 
layer default (asgi_redis.core.RedisChannelLayer)
2017-05-02 07:06:12,590 - INFO - worker - Listening on channels 
http.request, websocket.connect, websocket.disconnect, websocket.receive

CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6379)],
},
"ROUTING": "firstproject.routing.channel_routing",
},
}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/166ef732-aa07-478e-8b7d-dcd03d7924f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels, Nginx, Daphne - Not working?

2017-05-02 Thread Alex Elson
Andrew, it doesn't seem to have fixed my problem. I type the following 
command, and am able to connect to my public ip, and although my page 
loads, only the frontend does anything. Channels does not work.

$ daphne -b 0.0.0.0 firstproject.asgi:channel_layer
2017-05-03 06:11:51,196 INFO Starting server at 
tcp:port=8000:interface=0.0.0.0, channel layer 
firstproject.asgi:channel_layer.
2017-05-03 06:11:51,197 INFO HTTP/2 support enabled
2017-05-03 06:11:51,197 INFO Using busy-loop synchronous mode on 
channel layer
2017-05-03 06:11:51,197 INFO Listening on endpoint 
tcp:port=8000:interface=0.0.0.0
127.0.0.1:51076 - - [03/May/2017:06:11:57] "GET /" 200 5801

Is there anything else I may be doing wrong? Is it because I have 
"localhost" in my CHANNEL_LAYERS in CONFIG?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d7cc02b-8ab5-4463-9082-31c89cbf6fe1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels, Nginx, Daphne - Not working?

2017-05-02 Thread Alex Elson
I have  "socket = new Websocket("ws:// ...", "socket.onopen," and 
"socket.send" commands in my Javascript code, and although the Javascript 
works, it seems to not be able to run these commands, or it is unable to 
access my functions in consumer.py, althought it works flawlessly if I run 
my project locally.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f9bc1728-d281-4245-8960-42c1770f8281%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels, Nginx, Daphne - Not working?

2017-05-03 Thread Alex Elson
I am trying to only use Daphne for websockets  I believe, following the 
deployment tutorial in the Channel documentation. And yes I am running both 
processes on the same machine. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75ecc3b4-1564-47a3-bcf9-e7926e05a290%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels, Nginx, Daphne - Not working?

2017-05-03 Thread Alex Elson
Here is my nginx default configuration if that could be it.

server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;
charset utf-8;

index index.html index.htm index.nginx-debian.html;

server_name _;

location / {

proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
try_files $uri $uri/ =404;
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75667dd1-2d00-494c-997c-e6754b46b633%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels, Nginx, Daphne - Not working?

2017-05-04 Thread Alex Elson
I was able to get it working with the development server, python manage.py 
runserver, with an addition to the firewall on Google Cloud.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/78173b95-e0a3-4930-8cec-581d36784671%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.