ubuntu-nginx-uwsgi-django

Posted on Posted in django
Tips: 本文创建于2014年11月2日,已超过 2 年,内容或图片可能已经失效!

环境
Distributor ID: Ubuntu
Description: Ubuntu 14.10
Release: 14.10
Codename: utopic

nginx安装

sudo apt-get install -y nginx

uwsgi安装

sudo apt-get install libxml2-dev python-dev python-pip uwsgi-plugin-python
sudo pip install uwsgi

django安装

sudo pip install django

简单配置

sudo vim /etc/nginx/sites-enable/default
server {
	listen 80;
	server_name	localhost;

	location / {
		uwsgi_pass 127.0.0.1:9000;
		include uwsgi_params;
	}
}
sudo service nginx reload

cd
django-admin.py startproject mysite
cd mysite
python manage.py startapp myapp

vim ~/mysite/uwsgi.xml

<uwsgi>
 <master>true</master>
 <socket>127.0.0.1:9000</socket>
 <pythonpath>..</pythonpath>
 <module>mysite.wsgi</module>
</uwsgi>

启动应用

uwsgi -x ~/mysite/uwsgi.xml

访问

django-raw

» 转载请注明来源:若我若鱼 » ubuntu-nginx-uwsgi-django

Leave a Reply

Your email address will not be published. Required fields are marked *

12 − four =