使用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 ...
随机推荐
- innodb的读写参数优化
(1) 读取参数,global buffer pool以及 local buffer Innodb_buffer_pool_size,理论上越大越好,建议服务器50%~80%,实际为数据大小80 ...
- 百度地图 js 调用
百度地图key 的获取 进入 http://lbsyun.baidu.com/i 登录你的账号 点击进入控制台,复制 ak 的值 <!doctype html> <html> ...
- Kibana6.x.x源码开发——执行 yarn start --no-base-path 启动命令后报错
错误信息如下: Unhandled rejection Error: Request Timeout after 30000ms at /home/kibana_git/kibana6.2.2/nod ...
- Educational Codeforces Round 3 C
C. Load Balancing time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- sqoop数据校验
sqoop数据校验 # check data oracle_cnt=$(sqoop eval \ -Dmapred.job.queue.name=${queue} \ --connect ${conn ...
- js input复选框选中父级同时子级也选中
js实现复选框选中父级元素子级元素也选中,没有子级元素选中父级也不选中的效果 HTML <tr> <td> <label> <input name=" ...
- mapreduce统计总数
现有某电商网站用户对商品的收藏数据,记录了用户收藏的商品id以及收藏日期,名为buyer_favorite1. buyer_favorite1包含:买家id,商品id,收藏日期这三个字段,数据以“\t ...
- java——io、字节流缓冲区拷贝文件、字节缓冲流
使用try catch finally关闭文件流: 写入文件: import java.io.*; public class exp{ public static void main(String[] ...
- Selenium + Python操作IE 速度很慢的解决办法
IEDriverServer 64位换成32位 https://docs.seleniumhq.org/download/
- SQL Server 硬件和软件要求
1. 2.