使用uwsgi启动django项目
在 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项目的更多相关文章
- nginx+uwsgi启动Django项目
1.安装项目环境 系统环境:ubuntu16.04 python环境:python3.5.2 Django版本:django1.11.7 nginx环境:nginx_1.10.3 虚拟环境:virtu ...
- 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 ...
- 使用uWSGI部署django项目
先说说什么是uWSGI吧,他是实现了WSGI协议.uwsgi.http等协议的一个web服务器,那什么是WSGI呢? WSGI是一种Web服务器网关接口.它是一个Web服务器(如nginx)与应用服务 ...
- 使用Nginx+uWSGI部署Django项目
1.linux安装python3环境 参考链接:https://www.cnblogs.com/zzqit/p/10087680.html 2.安装uwsgi pip3 install uwsgi l ...
- uwsgi启动Django应用
uwsgi启动Django应用 uWSGI是一个Web服务器,它实现了WSGI协议.uwsgi.http等协议. WSGI / uwsgi / uWSGI 三者区别: WSGI是一种通信协议,Fl ...
- 学习VirtualEnv和Nginx+uwsgi用于django项目部署
以下叙述中用到的操作系统:Linux CentOS 6.X. 最近几天了解一下VirtualEnv,Apache+Daemon mode,Nginx+uwsgi的概念,并且在项目中实验性部署了一下(目 ...
- nginx+uwsgi部署django项目
1.django项目部署前需要生成admin的静态资源文件 (1)生成admin的静态资源文件 # 关闭debug模型 DEBUG = False # 允许所有域名访问 ALLOWED_HOSTS = ...
- Nginx+uWSGI启动Django
在之前的几篇博客中对Django的功能做了初步实践,这里链接贴一下: Django的安装和启动 Django之--网页展示Hello World! Django之--通过MVC架构的html模板展示H ...
- Nginx + uWSGI 部署Django 项目,并实现负载均衡
一.uWSGI服务器 uWSGI是一个Web服务器,它实现了WSGI协议.uwsgi.http等协议.Nginx中HttpUwsgiModule的作用是与uWSGI服务器进行交换. 要注意 WSGI ...
随机推荐
- [国家集训队]happiness 最小割 BZOJ 2127
题目描述 高一一班的座位表是个n*m的矩阵,经过一个学期的相处,每个同学和前后左右相邻的同学互相成为了好朋友.这学期要分文理科了,每个同学对于选择文科与理科有着自己的喜悦值,而一对好朋友如果能同时选文 ...
- linux防火墙添加端口
防火墙配置文件: /etc/sysconfig/iptables 1.使用命令查看端口开启情况(下图为安装时未选择开启防火墙) [root@fullstack ~]# iptables -L -n ...
- Applese 的毒气炸弹(最小生成树)
链接:https://ac.nowcoder.com/acm/contest/330/G 来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言5242 ...
- Codeforces Round #305 (Div. 2) B
Description Mike and some bears are playing a game just for fun. Mike is the judge. All bears except ...
- Python的Profilers性能分析器
关于Python Profilers性能分析器 关于性能分析,python有专门的文档,可查看:http://docs.python.org/library/profile.html?highligh ...
- 「linux」后台启动nohup经常跟的>/dev/null 2>&1是什么意思
https://www.cnblogs.com/wangsongbai/p/10215155.html 我们在写启动脚本的时候,会用nohup &,这个大家都知道,但是经常会有 >/de ...
- my04_Mysql复制数据一致性校验
1. 搭建一套双节点的Mysql主从复制数据库 2. 主库初始化测试数据 drop table if exists test; ),test_id int NOT NULL AUTO_INCREMEN ...
- 导入AppiumLibrary报错: ImportError: cannot import name 'InvalidArgumentException
导入AppiumLibrary报错: ImportError: cannot import name 'InvalidArgumentException报错原因 selenium.common.exc ...
- Dev Express Report 学习总结(四)Dev Express 动态生成XRTable使用总结
1. XRTableCell常见属性 XRTableCell xrTableCell = new XRTableCell(); A. 字体及字体大小 xrTableCell.Font = new S ...
- 01-消息中间件概述和ActiveMq入门
1.mq解决的问题 系统异步处理 应用解耦 流量削峰 日志处理 消息通信 2.消息中间件的2中模型 2.1 Point-to-Point(P2P) / 点对点 / 类比:送快递 特点: + 一个消费生 ...