deployment:
-
install nginx yum install pcre-devel zlib-devel tar zxvf nginx-1.7.12.tar.gz ./configure make make install
-
install uwsgi yum install uwsgi uwsgi-plugin-python libxml2-devel
-
configure nginx server { listen 80; server_name localhost; location / { include uwsgi_params; uwsgi_pass 127.0.0.1:9090; uwsgi_param UWSGI_CHDIR /root/django-demo/blog; uwsgi_param UWSGI_SCRIPT django_wsgi; access_log /usr/local/nginx/logs/access.log; } location /static { root /root/django-demo/blog; }
-
configure uwsgi in the dir where manager.py lies, create two files:
- django_wsgi.py #!/usr/bin/env python import os import sys reload(sys) sys.setdefaultencoding('utf8') os.environ["DJANGO_SETTINGS_MODULE"] = "blog.settings" from django.core.handlers.wsgi import WSGIHandler application = WSGIHandler()
- uwsgi_socket.xml 127.0.0.1:9090 /root/django-demo/blog django_wsgi python 4 uwsgi.log
REPLACE /root/django-demo/blog with actual path.
-
start uwsgi in the dir where manager.py lies, uwsgi -x uwsgi_socket.xml
-
start nginx nginx