How to run django on localhost with nginx and uwsgi?

Posted by user2426362 on Server Fault See other posts from Server Fault or by user2426362
Published on 2013-06-27T10:16:49Z Indexed on 2013/06/27 10:22 UTC
Read the original article Hit count: 197

Filed under:
|
|
|

How to run django on localhost with nginx and uwsgi?

This im my config but not works.

nginx:

server {
    listen  80;
    server_name localhost;
    access_log /var/log/nginx/localhost_access.log;
    error_log /var/log/nginx/localhost_error.log;

    location / {
        uwsgi_pass  unix:///tmp/localhost.sock;
        include     uwsgi_params;
    }

    location /media/  {
        alias /home/user/projects/zt/myproject/myproject/media/;
    }

    location  /static/ {
        alias  /home/user/projects/zt/myproject/myproject/static/;
    }
}

uwsgi:

[uwsgi]
vhost = true
plugins = python
socket = /tmp/localhost.sock
master = true
enable-threads = true
processes = 2
wsgi-file = /home/user/projects/zt/myproject/myproject/wsgi.py
virtualenv = /home/user/projects/zt
chdir = /home/user/projects/zt/myproject
touch-reload = /home/user/projects/zt/myproject/reload

This config work on my ubuntu server with normal domain (not localhost) but on localhost not working. If I run localhost in web browser I have

Welcome to nginx!

© Server Fault or respective owner

Related posts about nginx

Related posts about django