在 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. Palindromes _easy version(reverse)

    Problem Description “回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串.请写一个程序判断读入的字符串是否是“回文”.   Input 输入包 ...

  2. 统计元音(stringstream的-应用)

    Problem Description 统计每个元音字母在字符串中出现的次数.   Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串.   Output ...

  3. 远程私有库的创建 pod 组件化

    参考:   http://www.cnblogs.com/hs-funky/p/6780203.html http://www.jianshu.com/p/4b63dfbd8be7 http://ww ...

  4. springcloud系列五 feign远程调用服务

    一:Feign简介 Feign 是一种声明式.模板化的 HTTP 客户端,在 Spring Cloud 中使用 Feign,可以做到使用 HTTP请求远程服务时能与调用本地方法一样的编码体验,开发者完 ...

  5. BZOJ 2836 魔法树 链剖裸题~~

    正好练练熟练度..(刷水题谋财害命QAQ) #include<cstdio> #include<iostream> #define ll long long #define R ...

  6. 利用Shell脚本实现远程MySQL自动查询

    下面这个脚本是一个简单用来执行远程数据库查询的命令,相信大家都能看得懂,这对于有些需要每天自动检查数据库或是执行某些语句的兄弟,是很有帮助的,只要稍加修改就可以 #!/bin/shHOST=192.1 ...

  7. k2安装LEDE

    固件下载时请用Breed Web 恢复控制台恢复固件,步骤如下:1.到LEDE官方网站下载最新开发版固件2.Web Breed台刷写固件3.将一台能上网的路由器LAN口接至K2 WAN口,等待K2连上 ...

  8. eclipse 离线安装STS插件

    1.下载 eclipse Version: 2018-12 (4.10.0) 下载sts相应版本:https://spring.io/tools3/sts/all 2.安装 Help->Inst ...

  9. U盘中病毒了

    往U盘里拷东西的时候突然发现一个后缀名为exe图标却是文件夹的图标的文件.大概二三百K 按类型排序之后发现好几个这样的文件,大小都是一模一样的,名字分别跟我U盘里原先的文件夹对应,原本的文件夹都被设置 ...

  10. redis的三种启动方式,个人常用第二种

    redis的启动方式1.直接启动  进入redis根目录,执行命令:  #加上‘&’号使redis以后台程序方式运行 1 ./redis-server & 2.通过指定配置文件启动  ...