本文基于root用户下进行部署,django项目名称为BDFS

1、  安装依赖包,终端输入命令

1)         环境依赖包

apt-get update

apt-get install python-pip

apt-get install python2.7-dev

python2.7 -m pip install uwsgi

2)         项目依赖包

pip install Django==1.9.2

剩下的pymongo包等,

2、  将项目拷贝至/home文件夹下,打开/home/BDFS文件夹,创建BDFS_uwsgi.ini文件,输入以下文字:

# BDFS_uwsgi.ini file

[uwsgi]

# Django-related settings

socket = :8000

# the base directory (full path)

chdir           = /home/BDFS

# Django s wsgi file

module          = BDFS.wsgi

# process-related settings

# master

master          = true

# maximum number of worker processes

processes       = 4

# ... with appropriate permissions - may be needed

# chmod-socket    = 664

# clear environment on exit

vacuum          = true

3、  启动uwsgi, ,终端输入命令

cd /home/BDFS

uwsgi --ini BDFS_uwsgi.ini

页面启动成功,显示如下信息,启动成功不要关闭终端

4、  安装nginx环境依赖包,新打开终端输入命令

apt-get install zlib1g-dev

apt-get install libpcre3 libpcre3-dev

apt-get install openssl libssl-dev

5、  安装nginx,终端输入命令

wget http://nginx.org/download/nginx-1.4.7.tar.gz

tar zxvf nginx-1.4.7.tar.gz

cd nginx-1.4.7

./configure --with-openssl=/usr/include/openssl

gedit objs/Makefile把第3行的-Werror-删除,保存,关闭

make

make install

6、  修改nginx配置,终端输入命令

gedit /usr/local/nginx/conf/nginx.conf

拷贝以下文本,全覆盖

user  root;

worker_processes  1;

#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {

worker_connections  1024;

}

http {

include       mime.types;

default_type  application/octet-stream;

sendfile        on;

keepalive_timeout  65;

server {

listen       8001;

server_name  localhost;

charset     utf-8;

#access_log  logs/host.access.log  main;

location / {

include uwsgi_params;

uwsgi_pass 127.0.0.1:8000;

uwsgi_read_timeout 2;

}

location /static {

root  /home/BDFS;

}

}

}

7、  启动nginx ,终端输入命令

cd

sudo /usr/local/nginx/sbin/nginx           #启动

/usr/local/nginx/sbin/nginx -s reload   #重启nginx

8、  浏览器输入http://127.0.0.1:8001/既访问成功

注意事项:

启动nginx前,保证uwsgi服务正常启动,如果修改了项目源文件,需要关闭uwsgi服务,再重启才能刷新关闭命令killall  -9 uwsgi,没修改一次nginx配置文件也需要重启nginx服务,命令上面有

nginx1.4.7+uwsgi+django1.9.2项目部署,liunx系统为ubuntu14.0.4。的更多相关文章

  1. 基于腾讯云CentOS7.4+MySQL5.7+Python3+uwsgi+nginx的Django项目部署

    准备知识 1.django一个基于python的开源web框架,请确保自己熟悉它的框架目录结构. 2.uWSGI一个基于自有的uwsgi协议.wsgi协议和http服务协议的web网关 3.nginx ...

  2. nginx1.4.7+uwsgi+django1.9.2+gridfs 在ubuntu14.0.4上部署

    本文基于root用户安装配置,实现django项目名为trcode sudo apt-get updatesudo apt-get install python-pipsudo apt-get ins ...

  3. Django+uwsgi+nginx+angular.js项目部署

    这次部署的前后端分离的项目: 前端采用angular.js,后端采用Django(restframework),他俩之间主要以json数据作为交互 Django+uwsgi的配置可以参考我之前的博客: ...

  4. 项目部署篇之三——安装tomcat7.0

    1.下载tomcat 百度云下载 链接:https://pan.baidu.com/s/1UGPYHmR-1ehQRvdKGhSlyQ 提取码:3c0g 直接通过指令下载 wget http://mi ...

  5. 基于python的种子搜索网站-项目部署

    本讲会对种子搜索网站的部署过程进行详细的讲解. 网站演示: https://bt.mypython.me 源码地址: https://github.com/geeeeeeeek/bt 项目部署过程 系 ...

  6. Django项目在linux系统中虚拟环境部署

    1.在linux系统下,安装virtualenv 命令:pip install virtualenv 2.项目部署前的准备 1. Django web project deployment 1.1.  ...

  7. 基于python的种子搜索网站(三)项目部署

    项目部署过程 系统要求:ubuntu 16.04(或以上) 环境搭建和配置,必须严格按照以下步骤来安装部署!如有问题可以咨询(weixin:java2048) 安装部分 安装nginx sudo ap ...

  8. python-django框架-电商项目-项目部署_20191127

    python-django框架-电商项目-项目部署: uwsgi作为web服务器: 在pycharm中启动项目:使用python manage.py runserver 这个runserver是dja ...

  9. .NET Core跨平台:.NET Core项目部署到linux(Centos7)

    1.开篇说明 a 上篇博客简单的说明了一下 使用.NET Core开发的一个总结,地址是:(http://www.cnblogs.com/hanyinglong/p/6442148.html),那么这 ...

随机推荐

  1. C语言字符串操作总结大全(超具体)

    1)字符串操作 strcpy(p, p1) 复制字符串 strncpy(p, p1, n) 复制指定长度字符串 strcat(p, p1) 附加字符串 strncat(p, p1, n) 附加指定长度 ...

  2. js实现select跳转

    js简单实现select跳转功能:代码例如以下 <!DOCTYPE html> <html> <head> <title></title> ...

  3. Eclipse安装Properties Editore插件

    Properties Editor for Eclipse3[1].0-3.2安装使用-http://jzgl-javaeye.iteye.com/blog/386010 PropertiesEdit ...

  4. 常用sql语句记录

    1.表 --建表 if OBJECT_ID('Student') is not null create table Student( ID ,) not null, Name ), Code ), f ...

  5. 转FTP协议详解

    转自:http://www.cnblogs.com/li0803/archive/2010/11/16/1878833.html FTP 是File Transfer Protocol(文件传输协议) ...

  6. PyCharm 环境配置

    1.去掉“自动保存功能” pycharm默认是自动保存的,习惯自己按 ctrl + s 的可以进行如下设置: 菜单File -> Settings... -> Appearance &am ...

  7. gsub函数

    gsub(r, s [, t])    For each substring matching the regular expression r in the string t, substitute ...

  8. 使用GraphicsMagick/ImageMagick批量对图片瘦身

    GrahpicsMagick: find . -iname "*.jpg" -exec gm convert -strip +profile "*" -qual ...

  9. java-ApiDemo

    "飞机大战"玩了一段时间,稍后补上飞机大战完全代码. 赶紧继续后续课程 API String相关方法: 注意:涉及截取/删除/插入字符串位置时,指的是下标x的位置:如果是范围,则带 ...

  10. spring boot中 使用http请求

    因为项目需求,需要两个系统之间进行通信,经过一番调研,决定使用http请求. 服务端没有什么好说的,本来就是使用web 页面进行访问的,所以spring boot启动后,controller层的接口就 ...