upstream django {
# server unix:/run/uwsgi/devAppReporting.sock;
}
server {
listen 8090;
server_name foo.bar.com;
charset utf-8;
location /static {
alias /var/dev-app-reporting/static;
}
location / {
uwsgi_pass django;
include /var/dev-app-reporting/uwsgi_params;
uwsgi_read_timeout 3600;
client_max_body_size 50m;
}
}
Now I changed it to this:
upstream django {
server unix:/run/daphne/devAppReporting.sock;
}
server {
listen 8090;
server_name foo.bar.com;
charset utf-8;
location /static {
alias /var/dev-app-reporting/static;
}
location / {
proxy_pass http://0.0.0.0:8090;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
Started daphne like this:
daphne -u /run/daphne/devAppReporting.sock app.dse.asgi:application
I get a 502 bad gateway error and this in the log:
2020/02/24 22:17:26 [alert] 29169#29169: 768 worker_connections are not enough
2020/02/24 22:17:26 [error] 29169#29169: *131545 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: dse-portfolio-dev-assessments.md.virtualclarity.com, request: "GET / HTTP/1.1", upstream: "http://0.0.0.0:8090/", host: "xx.xx.xx.xx"
Any ideas on what I should have in my config file for this to work?
Thanks Andrew. Upgrading to py 3.7 did the trick. Now struggling to
get daphne working with nginx and TLS. Can't seem to get a nginx
config file that works for me.
On Fri, Feb 21, 2020 at 10:50 PM Andrew Godwin <andrew@aeracode.org> wrote:
>
> Hi Larry,
>
> Your problem is the Python version - 3.5 is somewhat old (but most importantly, was still a very rough release for asyncio) and isn't supported by any current release of asgiref/channels for that reason. If you are able to upgrade that, I very much recommend it.
>
> Andrew
>
> On Sat, Feb 22, 2020 at 2:52 AM Aldian Fazrihady <mobile@aldian.net> wrote:
>>
>> I have these working module combinations, but my Python is 3.6.9:
>> asgiref==2.2.0
>> channels==2.0.2
>> channels_redis==2.3.0
>> daphne==2.1.0
>> Django==2.2.4
>> django-redis==4.10.0
>> redis==3.3.6
>> Twisted[tls,http2]
>> uwsgi==2.0.18
>> websockets==6.0
>>
>> On Sat, Feb 22, 2020 at 3:25 AM Larry Martell <larry.martell@gmail.com> wrote:
>>>
>>> I am in a bit of version hell. Not fun on a Friday afternoon.
>>>
>>> Django 2.0.4, python 3.5.2
>>>
>>> Trying to get channels, websockets, daphne, and asgiref working.
>>>
>>> When I installed the latest channels it did not work with my version
>>> of mysqlclient and some googling led me to install 2.0 of channels.
>>> That worked fine with the dev server, and then I wanted to deploy my
>>> app in prod. In prod we use nginx/uwsgi so I was going to replace
>>> uwsgi with daphne. When I tried to run daphne I got:
>>>
>>> ImportError: No module named 'asgiref.compatibility'
>>>
>>> Googling that I was led to upgrade asgiref to the latest version.
>>> After I did that I got:
>>>
>>> AttributeError: module 'asyncio.coroutines' has no attribute '_is_coroutine'
>>>
>>> Have not been able to get past this one.
>>>
>>> Anyone have any thoughts? Would upgrading django and python fix these
>>> issues? I am planning on doing that soon, but I was not planning on
>>> doing that now. Don't want to upgrade now and then find I still have
>>> issues. Can I get all this to work with my current versions and
>>> upgrade later?
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY43bVM0QEbniN3nzdRppM0ABo%3DOWFS5O5v0XX0YUh5Wcg%40mail.gmail.com.
No comments:
Post a Comment