M
M
mikemoix2016-02-25 20:10:28
Django
mikemoix, 2016-02-25 20:10:28

Fix error when configuring uWSGI?

I deploy a django project on a production server, set up nginx (winwin.sock is a file created by hand and chmod 666)

upstream django {
    server unix:///tmp/winwin.sock; 
}

server {

  
  listen        80;
  listen        443;
  client_max_body_size 75M;
  charset     utf-8;

  access_log    /home/winwin/logs/accsess.log;
  error_log     /home/winwin/logs/error.log;


  location /site_media/media/ {
    alias /home/winwin/winwin-back/site_media/media/;
  }

  location /
    {
       uwsgi_pass django;
      include /home/winwin/winwin-back/deploy/uwsgi_params;
      uwsgi_buffers 8 2048k;
    }
}

Then in the /etc/uwsgi/winwin/ folder I made the uwsgi.ini file
[uwsgi]
  socket = /tmp/winwin.sock
  chmod-socket = 666
  chdir = /home/winwin/winwin-back/
  module  = winwin.wsgi
  master = true
  processes = 4
  threads = 2
  daemonize = /home/winwin/winwin-back/deploy/logs/uwsgi.log

At the same time, when I open the site, I get an Internal Server Error , and in the logs
no python application found, check your startup logs for errors
I ran sudo uwsgi --ini /etc/uwsgi/winwin/uwsgi.ini accordingly
What can I do?
******************************************************* **********
I decided, in general, I'm sorry, I didn't give full details
, my settings file is not called settings.py, but live.py and wsgi.py could not run

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Evtifiev, 2016-02-25
@evtifiev

Good evening, what does uwsgi write in the logs? I had the same trouble, I had to not use sock I
redid the settings exactly like this, I throw off from one working project
Settings uwsgi, installed as a virtual environment module via pip

[uwsgi]
plugins = /home/web/bin/python3.3
pythonpath = /home/web/lib/python3.3/site-packages/
virtualenv = /home/web/
chdir = /home/web/app/
master = true
env = DJANGO_SETTINGS_MODULE=app.settings
module = django.core.handlers.wsgi:WSGIHandler()
max-requests=1000
socket = 127.0.0.1:8080
enable-threads=true

nginx settings
server{
      listen 80;

      server_name domen.ru

      access_log /home/web/logs/access.log;
      error_log  /home/web/logs/error.log;

      location /static/ {
        alias   /home/web/static/;
      }


      location /favicon.ico {
        alias /home/web/static/favicon.ico;
      }

      location / {
        #uwsgi_pass   unix:///home/web/socket.sock;
        uwsgi_pass   127.0.0.1:8080;
        include      uwsgi_params;
      }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question