Prerequisite:
Nginx (>0.8); Uwsgi;django;
Flup Download Address:
wget http://www.saddi.com/software/flup/dist/flup-1.0.2.tar.gz
Installation:
sudo apt-get libxml2-dev Python-dev
Flup and Django are all using Python setup.py install
Tar zxvf uwsgi-0.9.9.2.tar.gz
cd uwsgi-0.9.9.2
make-f makefile.py27 #和你安装PYTHON版本一致
CP uwsgi/usr/sbin/ Uwsgi
Configuration:
To establish the Project home directory:
django-admin.py Startproject My_django
Creating django_wsgi.py in the Django home directory
Import os,sys
import django.core.handlers.wsgi
os.environ[' django_settings_module ']= ' My_ Django.settings ' #这里的my_django. Settings represents the "project name. Settings"
application= Django.core.handlers.wsgi.WSGIHandler ()
To create a uwsgi.xml file under the home directory:
<uwsgi>
<socket>0.0.0.0:3001</socket>
<listen>20</listen>
<master >true</master>
<pidfile>/usr/local/nginx/uwsgi.pid</pidfile>
<processes>2 </processes>
<module>django_wsgi</module>
<pythonpath>/data/my_django</ pythonpath> #刚才建立项目的路径
<profiler>true</profiler>
<memory-report>true</ memory-report>
<enable-threads>true</enable-threads>
<logdate>true</logdate >
<limit-as>6048</limit-as>
</uwsgi>
Add Nginx configuration:
server {
listen ;
server_name django.sigh.com.cn;
Location/{
Root/data/my_django;
Uwsgi_pass 127.0.0.1:3001;
Include uwsgi_params;
}
}