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