Question

Just tell me if you ran the site and that was what you used

I just want to know, if in this community, there are some users who have been able to configure their site for django - gunicorn - nginx following the tutorial steps

Https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04

Or Https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

Has managed to run its application and that is also visible in production by the number of ip and / or the domain name “www.xxxxxx.xx” and does not appear BAD 502. only that ??? If it works please report that you had success, to clear if there is something in my procedure or is some bug, suddenly if some I achieved using another system for example as dbain, please report please.

I have my doubts, since practically in all the forums my problem is in the air without RESOlVER.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Well every time I get more clear this matter, but I still can not run my application.

I commented that the application is at zero only has the minimum parameters in “settings.py” so that I launch “its work” from django.

I did everything carefully, according to the guide that you sent me and although it really helped me a lot I did not deploy the site, I only get the welcome to “nginx” and accessing the domain launches the welcome page of nginx, but accessing by ip Throw me bad 502.

Important thing I noticed, is that I do not see anywhere a “myproject.sock” file or I do not know where it is and checking the error log gives me the following.

Can you see that can be happening please ??

root@max:/home/max/myproject/myproject# sudo systemctl status gunicorn● gunicorn.service - gunicorn daemon Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2017-04-12 22:09:50 UTC; 12min ago Main PID: 24464 (code=exited, status=1/FAILURE)

Apr 12 22:09:45 max gunicorn[24464]: [2017-04-12 22:09:45 +0000] [24464] [INFO] Starting gunicor Apr 12 22:09:45 max gunicorn[24464]: [2017-04-12 22:09:45 +0000] [24464] [ERROR] Retrying in 1 s Apr 12 22:09:46 max gunicorn[24464]: [2017-04-12 22:09:46 +0000] [24464] [ERROR] Retrying in 1 s Apr 12 22:09:47 max gunicorn[24464]: [2017-04-12 22:09:47 +0000] [24464] [ERROR] Retrying in 1 s Apr 12 22:09:48 max gunicorn[24464]: [2017-04-12 22:09:48 +0000] [24464] [ERROR] Retrying in 1 s Apr 12 22:09:49 max gunicorn[24464]: [2017-04-12 22:09:49 +0000] [24464] [ERROR] Retrying in 1 s Apr 12 22:09:50 max gunicorn[24464]: [2017-04-12 22:09:50 +0000] [24464] [ERROR] Can’t connect t Apr 12 22:09:50 max systemd[1]: gunicorn.service: Main process exited, code=exited, status=1/FAI Apr 12 22:09:50 max systemd[1]: gunicorn.service: Unit entered failed state. Apr 12 22:09:50 max systemd[1]: gunicorn.service: Failed with result ‘exit-code’.

and log error:

2017/04/12 22:16:26 [crit] 24587#24587: *1 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:16:41 [crit] 24587#24587: *1 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:22:58 [crit] 24587#24587: *6 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:23:04 [crit] 24587#24587: *6 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:23:40 [crit] 24587#24587: *6 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:30:29 [crit] 24587#24587: *11 connect() to unix:/home/max/myproject/myproject.soc$ 2017/04/12 22:30:29 [crit] 24587#24587: *13 connect() to unix:/home/max/myproject/myproject.soc$

$t.sock failed (2: No such file or directory) while connecting to upstream, client: 181.163.181$ 2017/04/12 22:16:41 [crit] 24587#24587: *1 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:22:58 [crit] 24587#24587: *6 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:23:04 [crit] 24587#24587: *6 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:23:40 [crit] 24587#24587: *6 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:30:29 [crit] 24587#24587: *11 connect() to unix:/home/max/myproject/myproject.soc$ 2017/04/12 22:30:29 [crit] 24587#24587: *13 connect() to unix:/home/max/myproject/myproject.soc$

$63.181.193, server: 67.207.84.106, request: “GET / HTTP/1.1”, upstream: "http://unix:/home/max$ 2017/04/12 22:16:41 [crit] 24587#24587: *1 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:22:58 [crit] 24587#24587: *6 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:23:04 [crit] 24587#24587: *6 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:23:40 [crit] 24587#24587: *6 connect() to unix:/home/max/myproject/myproject.sock$ 2017/04/12 22:30:29 [crit] 24587#24587: *11 connect() to unix:/home/max/myproject/myproject.soc$ 2017/04/12 22:30:29 [crit] 24587#24587: *13 connect() to unix:/home/max/myproject/myproject.soc$

its so importan for me, that you givme a direction to do

@maxgonpe if you still have this issue it is because of the files stored in pycache folder. delete the ones you are replacing and restart gunicorn. They will be replaced with the new ones back into pycache folder.

@jtittle

Why the changes of my development server, are not reflected in the production server (views and urls)?

Hi, I am writing to see if you can help me with this: I happen is that I make changes in the development server and they work me well, but when I want to see them in production, I do not recognize them and I throw the error:

Page not found (404) Request Method: GET Request URL: http://www.maxsistemas.cl/casas/mipagina

I have tried all sorts of views, and called in urls, (all of them work in development, but nothing works for me in production) last clone a class definition that makes the same call and uses the same template but only change the name of the Definition to see if it works, and it happens to me the same everything works well in development, but when I want to see it in production, I throw the error mentioned at the beginning (404).

I have also tried, reloading nginx with several commands for me to take the changes, but the negative result even, these are the commands I tried:

Sudo systemctl daemon-reload Sudo systemctl start gunicorn Sudo systemctl restart nginx Sudo systemctl start nginx Sudo ufw allow ‘Nginx Full’

Thank you for the help, I do not know what else to try.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel