NGINX+DJANGO+UWSGI Deployment Configuration

Source: Internet
Author: User

The main talk about using UWSGI to manage Django application configuration, summarize, then use:

Managing Django Apps with Uwsgi INI files

1, first, the new module under the Python project, the file name is: uwsgi.py #名称可以自己任意写

django1.8 or later:

#!/usr/bin/env python

# Coding:utf-8

Import OS

os.environ[' django_settings_module ' = ' logmgmt.settings ' logmgmt for the project name

From Django.core.wsgi import get_wsgi_application

application = Get_wsgi_application ()


django1.8 The following versions are:


#!/usr/bin/env python

# Coding:utf-8

Import OS

os.environ[' django_settings_module '] = ' logmgmt.settings '

Import Django.core.handlers.wsgi

application = Django.core.handlers.wsgi.WSGIHandler ()


Once saved, continue, we use the INI file to manage the Django app and create a new INI file in the uwsgi.py current directory with the following content:

[Uwsgi]

CHDIR=/OPT/LOGVIEW/SRC/LOGMGMT #这个为django项目所在目录

Module=uwsgi #uwsgi是我们刚新建的module文件uwsgi. py

Master=true

Vacuum=true

max-requests=5000

socket=127.0.0.1:9090

#protocol =http

processes=2

threads=2

Enable-threads=true


Start a Django app with Uwsgi

Uwsgi--ini/opt/logview/src/uwsgi.ini


Nginx Configuration


server {


Listen 80;

server_name localhost;


Location/{

Include Uwsgi_params;

Uwsgi_pass 127.0.0.1:9090;

}

location/static/{

alias/opt/logview/src/logsmgmt/static/; #static文件位置

}

}


This article from the "TT's it big Miscellaneous, Welcome to join ~" blog, please be sure to keep this source http://520tom.blog.51cto.com/530608/1785245

NGINX+DJANGO+UWSGI Deployment Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.