nginx + uswgi +django
Posted MKY-技术驿站
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx + uswgi +django相关的知识,希望对你有一定的参考价值。
适合ubuntu 系统,不只是树莓派
安装必要软件
pt-get install build-essential psmisc apt-get install python-dev libxml2 libxml2-dev apt-get install python-setuptools cd /opt/ wget http://projects.unbit.it/downloads/uwsgi-latest.tar.gz tar -zxvf uwsgi-latest.tar.gz mv uwsgi-latest/ uwsgi/ cd uwsgi/ python setup.py install
apt-get install mysql-server apt-get install nginx
安装uwsgi,阿里源带了uwsgi这里直接安装
apt-get install uwsgi uwsgi-core uwsgi-plugin-python
安装django
apt-get install python-django python-mysqldb
配置
cat /etc/uwsgi/apps-enabled/www.ini
[uwsgi] socket = 192.168.0.14:9000 #这里可以改成socket,/var/run/uwsgi/app/www/socket chmod-socket = 667 limit-as = 256 processes = 4 master = true daemonize = /var/log/uwsgi.log enable-threads = true vacuun = true chdir = /var/www/html/testp/mysite #django 项目目录 module = mysite.wsgi #创建完项目后会在mysite侠自动生成wsgi.py
####说明module 配置######
tree /var/www/html/testp/mysite/
/var/www/html/testp/mysite/
├── manage.py
└── mysite
├── __init__.py
├── __init__.pyc
├── settings.py
├── settings.pyc
├── urls.py
├── wsgi.py
└── wsgi.pyc
以上是关于nginx + uswgi +django的主要内容,如果未能解决你的问题,请参考以下文章
python3 + Django + uwsgi + nginx 配置部署笔记
Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段
更改代码时出现 Django、Nginx、FastCGI 缓存问题