Score:0

Switching from SQLite to Mysql in production causes error

de flag

I am using a digital ocean server. After switching to mysql database from sqlite, I got 502 Bad Gateway nginx/1.18.0 (Ubuntu)

This is running fine when I run the project from the terminal using python manage.py runserver ip:8000 . I think there are faults in the gunicorn .

How to solve this any idea?

After checking the logs,

sudo tail -F /var/log/nginx/error.log


2021/12/06 10:32:06 [error] 230230#230230: *15355 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:37:21 [error] 230230#230230: *15358 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:37:24 [error] 230230#230230: *15358 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:44:06 [error] 230230#230230: *15365 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:48:35 [error] 230230#230230: *15368 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:49:10 [notice] 1347821#1347821: signal process started
2021/12/06 10:49:15 [error] 1347822#1347822: *15371 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:51:10 [error] 1347822#1347822: *15374 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:56:54 [error] 1347822#1347822: *15377 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 11:00:09 [error] 1347822#1347822: *15381 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
LeRouteur avatar
de flag
Can you please provide some logs? It's difficult to help you with so little information
Atom Store avatar
de flag
nginx logs are added.
ua flag
Even if you get past the connection problems, have you verified that the SQL syntax is the same?
Atom Store avatar
de flag
Yes it's working on local as well as I run from terminal in production
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.