PIP install uWSgi

Create test.py def application(env, start_response) in the project root directory: start_response(‘200 OK’, [(‘Content-Type’,’text/html’)]) return [b”Hello World”]

Test command used: uwsgi — HTTP :8000 –wsgi-file test.py Access IP:8000 on the browser

Wsgi # test the wsgi browser project by typing IP :8000

Ini [uwsgi] socket = server IP:8000 chdir = /home/foobar/myproject/ wsgi-file = myProject /wsgi.py processes = 4 threads = 2 Stats = Server IP:9191

Conf upstream django {server 192.168.100.12:8000; /etc/nginx/conf. # uwsgi.ini socket}

configuration of the server

server { listen 80; Server_name 192.168.100.12; charset utf-8;

access_log  /var/log/nginx/blog_access.log;

client_max_body_size 8M;   # adjust to taste

location /media  {
    alias /usr/local/site/demo/project-blog/media;
}

location /static {
    alias /usr/local/site/demo/project-blog/static;
}

location / {
    uwsgi_pass  django;
    include     /etc/nginx/uwsgi_params;
}
Copy the code

}