安装uwsgi pip install uwsgi apt-get install libxml2-dev
nginx 配置文件 server { listen 80; server_name xxx.admin.com location /static/ { #/static不加的话,会乱了样式 root /var/www/admin; } location / { root /var/www/admin; include uwsgi_params; uwsgi_pass 127.0.0.1:9090; } access_log logs/admin.log; }
django.xml配置于app下与settings.py同目录 <uwsgi> <socket>127.0.0.1:9090</socket> <chdir>/var/www/admin/website</chdir> <pythonpath>..</pythonpath> <module>wsgi</module> <processes>4</processes> <daemonize>/var/www/admin/uwsgi/uwsgi.log</daemonize> </uwsgi>
或者uwsgi.ini文件 [uwsgi] chdir=/var/www/admin #project 目录 module=website.wsgi:application #website目录下的wsgi.py模块 master=True max-requests=5000 daemonize=/var/www/admin/uwsgi.log socket=127.0.0.1:9090 vacuum=True processes=4
cat /var/www/admin/website/wsgi.py import os,sys os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
参考文章:https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/uwsgi/
http://www.jianshu.com/p/e6ff4a28ab5a
时间: 2024-11-06 03:53:06