Django+Nginx+uWsgi+Ubuntu部署备忘录

/ 0评 / 0

安装Nginx
add-apt-repository ppa:nginx/stable
apt-get update
apt-get install nginx

安装uWsgi
apt-get install libxml2-dev python-dev python-pip
pip install uwsgi

安装mysql
apt-get install mysql-server
apt-get install libmysqlclient-dev

下载应用
apt-get install git-core
git clone app.git

安装依赖

easy_install -U distribute
pip install -r requirements.txt

配置Nginx
vi /etc/nginx/sites-available/site.conf

server {
    listen 80;
    server_name 127.0.0.1;
    root /usr/share/nginx/html/app;
    location / {
        uwsgi_pass 127.0.0.1:9090;
        include uwsgi_params;
    }
    location /static {
        alias /usr/share/nginx/html/app/static;
    }
}

ln -s /etc/nginx/sites-available/site.conf /etc/nginx/sites-enabled
/etc/init.d/nginx start

配置uWsgi

QQ20140107-1

启动应用
uwsgi -x uwsgi.xml
/etc/init.d/nginx restart

 

 

apt-get update

Try to install the packages providing the command:

for <= 12.04

sudo apt-get install python-software-properties

for >= 12.10

sudo apt-get install software-properties-common

创建数据库

mysql -uroot -p
create database `name` default character set utf8 collate utf8_general_ci;

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注