在 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. 牛客寒假算法基础集训营4 C Applese 走迷宫

    链接:https://ac.nowcoder.com/acm/contest/330/C来源:牛客网 精通程序设计的 Applese 双写了一个游戏. 在这个游戏中,它被困在了一个 n×m迷宫 在迷宫 ...

  2. springboot整合redis存放session

    y进入maven依赖: <!--spring boot 与redis应用基本环境配置 --> <dependency> <groupId>org.springfra ...

  3. 如何从GAC中复制DLL文件

    运行执行:c:\Windows\assembly\gac_msil

  4. hdu1698 线段树(区间更新~将区间[x,y]的值替换为z)

    Just a Hook Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  5. html样式

    <!doctype html> <html> <head> <style id="mceDefaultStyles" type=" ...

  6. 问题:eclipse中线程编程编译报错,undefined reference to 'pthread_create'的解决方法(已解决)

    问题描述: 在Ubuntu系统中,使用eclipse CDT集成开发环境编写pthread程序,编译时,pthread_create不通过,报错信息是: undefined reference to ...

  7. 技巧:开启ubuntu系统的ssh服务

    执行下述命令,安装 openssh 服务器. $ sudo apt-get install openssh-server 执行下面命令,启动 openssh $ sudo service ssh st ...

  8. js中this指向

    JavaScript由于在运行期进行绑定的特性,JavaScript中的this可以是全局对象,当前对象或者任意对象,这完全取决于函数的调用方式 1.全局作用域或者普通函数中this指向全局对象win ...

  9. 6-----Scrapy框架中Item Pipeline用法

    当Item 在Spider中被收集之后,就会被传递到Item Pipeline中进行处理 每个item pipeline组件是实现了简单的方法的python类,负责接收到item并通过它执行一些行为, ...

  10. Vue.js-----轻量高效的MVVM框架(七、表单控件绑定)

    话不多说,先上完整代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> ...