在 manage.py 同级目录 创建 uwsgi.ini 文件 ,内容如下:

[uwsgi]
# 对外提供 http 服务的端口
http = :18123 #the local unix socket file than commnuincate to Nginx 用于和 nginx 进行数据交互的端口
socket = 127.0.0.1:8001 # the base directory (full path) django 程序的主目录
#chdir = /data/python_workspace/plant/cmdb_v1.1
chdir = /data/python_workspace/plant/Needforspeed/cmdb_v1.2
# Django's wsgi file
wsgi-file = AutoCmdb/wsgi.py # maximum number of worker processes
processes = 4 #thread numbers startched in each worker process
threads = 2 #monitor uwsgi status 通过该端口可以监控 uwsgi 的负载情况
stats = 0.0.0.0:9191 # clear environment on exit
vacuum = true # 后台运行,并输出日志
daemonize = /var/log/uwsgi.log

  nginx vhost 中创建 django.conf 文件

# the upstream component nginx needs to connect to
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8001; # for a web port socket (we'll use this first)
} # configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name ittl.dev.aixuexi.com; # substitute your machine's IP address or FQDN
charset utf-8; # max upload size
client_max_body_size 75M; # adjust to taste # if ($uri ~ a){
# rewrite ^/(.*)$ gerrit.dev.aixuexi.com/$1 permanent;
# } # Django media
location /media {
alias /path/to/your/mysite/media; # your Django project's media files - amend as required
}
rewrite /a/.* http://gerrit.dev.aixuexi.com$uri permanent; location /static {
alias /data/python_workspace/plant/cmdb_v1.1/web/static; # your Django project's static files - amend as required
} # Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /usr/local/nginx/conf/uwsgi_params; # the uwsgi_params file you installed
uwsgi_connect_timeout 300s;
uwsgi_read_timeout 300s;
uwsgi_send_timeout 300s;
}
access_log /data/logs/django_access.log access;
error_log /data/logs/django_error.log error; }

  安装 uwsgi 模块 /usr/local/python3/bin/pip3  install uwsgi

启动项目  /usr/local/python3/bin/uwsgi  --ini  test-uwsgi.ini

使用uwsgi启动django项目的更多相关文章

  1. nginx+uwsgi启动Django项目

    1.安装项目环境 系统环境:ubuntu16.04 python环境:python3.5.2 Django版本:django1.11.7 nginx环境:nginx_1.10.3 虚拟环境:virtu ...

  2. uwsgi启动Django项目时:unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode ***

    说起来有点坑 用命令都能正常启动,但是用配置文件就是不行 提示 unable to load app (mountpoint='') (callable not found or import err ...

  3. 使用uWSGI部署django项目

    先说说什么是uWSGI吧,他是实现了WSGI协议.uwsgi.http等协议的一个web服务器,那什么是WSGI呢? WSGI是一种Web服务器网关接口.它是一个Web服务器(如nginx)与应用服务 ...

  4. 使用Nginx+uWSGI部署Django项目

    1.linux安装python3环境 参考链接:https://www.cnblogs.com/zzqit/p/10087680.html 2.安装uwsgi pip3 install uwsgi l ...

  5. uwsgi启动Django应用

    uwsgi启动Django应用   uWSGI是一个Web服务器,它实现了WSGI协议.uwsgi.http等协议. WSGI / uwsgi / uWSGI 三者区别: WSGI是一种通信协议,Fl ...

  6. 学习VirtualEnv和Nginx+uwsgi用于django项目部署

    以下叙述中用到的操作系统:Linux CentOS 6.X. 最近几天了解一下VirtualEnv,Apache+Daemon mode,Nginx+uwsgi的概念,并且在项目中实验性部署了一下(目 ...

  7. nginx+uwsgi部署django项目

    1.django项目部署前需要生成admin的静态资源文件 (1)生成admin的静态资源文件 # 关闭debug模型 DEBUG = False # 允许所有域名访问 ALLOWED_HOSTS = ...

  8. Nginx+uWSGI启动Django

    在之前的几篇博客中对Django的功能做了初步实践,这里链接贴一下: Django的安装和启动 Django之--网页展示Hello World! Django之--通过MVC架构的html模板展示H ...

  9. Nginx + uWSGI 部署Django 项目,并实现负载均衡

    一.uWSGI服务器 uWSGI是一个Web服务器,它实现了WSGI协议.uwsgi.http等协议.Nginx中HttpUwsgiModule的作用是与uWSGI服务器进行交换. 要注意 WSGI ...

随机推荐

  1. CF351A Jeff and Rounding 思维

    Jeff got 2n real numbers a1, a2, ..., a2n as a birthday present. The boy hates non-integer numbers, ...

  2. Js 向json对象中添加新元素

    即:var json={a:1,b:2} json.c=3  添加新元素直接使用赋值就行了

  3. python自动化day1

    一.变量 变量定义的规则: 变量名只能是 字母.数字或下划线的任意组合 变量名的第一个字符不能是数字 以下关键字不能声明为变量名['and', 'as', 'assert', 'break', 'cl ...

  4. Java的Protected

    没想到接触Java这么多年,今天竟然才发现一直有一个误解 Proteced只能被同一个包内的或者子类的class访问 那么在另一个包的如下代码有问题吗? Sub sub = new Sub(); su ...

  5. WEB视频播放器插件,总结

    WEB视频播放器插件,总结 2018年07月29日 20:42:11 流光忆莲 阅读数:572更多 个人分类: 推荐文章收藏   以下是关于网页中嵌入视频播放插件的各种资料的总结 基于H5的Vedio ...

  6. js 数字处理Number()

    //js将数字转换保留2位小数 function toDecimal(x) { var val = Number(x) if (!isNaN(parseFloat(val))) { //toFixed ...

  7. Launch iCar Scan Android Scanner Support Bluetooth X431 iDiag Update Version

    Autonumen.com release new Launch iCar Scan for Android,Launch iCarScan Bluetooth Scanner is update v ...

  8. ssh两台主机建立信任关系

    A主机(10.104.11.107)   B主机(10.104.11.128) A: ssh-keygen -t rsa [root@H0f .ssh]# ssh-keygen -t rsa Gene ...

  9. 17-----BBS论坛

    BBS论坛(十七) 17.首页导航条实现和代码抽离 (1)temlates/common/_head.html <meta name="csrf-token" content ...

  10. 《mac的git安装手册-1》

    <mac的git安装手册-1> 下载地址 https://git-scm.com/downloads 如果遇到上面这个问题打开系统偏好设置: OK,这样就能安装了