我使用的是Django 3.2.3,Apache和Daphne。达芙妮动作很慢。
我像代理一样使用Apache向Daphne发送请求:
<VirtualHost *:443>
AllowEncodedSlashes On
ServerName mysite.com
ServerAdmin admin@gmail.com
ProxyPass "/" "http://127.0.0.1:8001/"
ProxyPassReverse "/" "http://127.0.0.1:8001/"
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET" env=CORS
Header set Access-Control-Allow-Credentials "false" env=CORS
SSLCertificateFile /etc/letsencrypt/live/****/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/***/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>我使用以下命令启动Daphne:
daphne -p 8001 asgi:application当我访问我的网站时,Daphne的日志是:
2021-06-04 21:17:17,821 INFO Adding job tentatively -- it will be properly scheduled when the scheduler starts
2021-06-04 21:17:17,865 INFO Added job "my_job" to job store "default"
2021-06-04 21:17:17,866 INFO Scheduler started
2021-06-04 21:17:17,909 INFO Starting server at tcp:port=8001:interface=127.0.0.1
2021-06-04 21:17:17,912 INFO HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2021-06-04 21:17:17,913 INFO Configuring endpoint tcp:port=8001:interface=127.0.0.1
2021-06-04 21:17:17,919 INFO Listening on TCP address 127.0.0.1:8001
127.0.0.1:34650 - - [04/Jun/2021:21:18:07] "GET /fr/" 200 234920209
127.0.0.1:34698 - - [04/Jun/2021:21:18:56] "GET /fr/jsi18n/" 304 -它在工作,我可以显示网页,但它非常非常慢,30秒以上
我不知道该搜索什么,在哪里搜索...
编辑-也许问题来自Apache代理,但我使用的是127.0.0.1,我不明白为什么它会很慢。ping 127.0.0.1速度很快。
编辑2-在127.0.0.1 / localhost / SERVER地址上使用dig和nslookup很快。
你能帮我出点主意吗?或者解决方案:)
谢谢
发布于 2021-06-05 20:34:03
我终于找到了。
问题不是来自apche,而是来自我的django代码。我不知道确切的,因为我做了很多测试,但我想这是因为redis服务器没有启动。
谢谢
https://stackoverflow.com/questions/67843093
复制相似问题