uwsgi

Django上线部署之uWSGI

匿名 (未验证) 提交于 2019-12-02 23:56:01
环境:    1 .CentOS 7.2 64λ    2 .SQL Server 2016 Enterprise 64λ    3 .Python 3.6.5 64λ    4 .root用户 要求:    按照顺序部署 1 .Windows Server 2016 Datacenter 64位 操作系统下安装数据库 2 Python环境搭建 3 .安装ODBC for SQL Server 1 curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo 2 yum remove unixODBC-utf16 unixODBC-utf16-devel 3 ACCEPT_EULA=Y yum install msodbcsql 4 yum install unixODBC-devel 5 6 # 以下这三行是安装连接数据库的工具,一般项目上用不到 7 ACCEPT_EULA=Y yum install mssql-tools 8 ln -s /opt/mssql-tools/bin/bcp /usr/bin/bcp 9 ln -s /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd 10 11 #

centos6.5安装uwsgi

匿名 (未验证) 提交于 2019-12-02 23:56:01
从python官网下载最新版本安装包Python-3.7.4.tgz 放在目录/usr/local/python3下 解压 tar -zxvf Python-3.7.4.tgz 进入解压目录 cd /usr/local/python3/Python-3.7.4 去掉 /usr/local/python3/Python-3.7.4/Modules/Setup.dist中 #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz 这行前面的注释# (注意:如果是configure之后去掉这个注释,那么需要修改Setup文件中的这行注释了) 安装c编译器 yum install gcc 配置 ./configure --prefix=/usr/local/python3 编译 make 安装 make install 错误:zipimport.ZipImportError: can't decompress data; zlib not available 安装zlib-devel,zlib yum install zlib-devel yum install zlib 错误 : ModuleNotFoundError: No module named '_ctypes' 安装libffi-devel包 yum

Centos7部署Django项目

匿名 (未验证) 提交于 2019-12-02 23:42:01
uwsgi Python环境搭建【略】 uwsgi模块的安装: pip3 install uwsgi uwsgi配置文件编写: uwsgi配置文件格式可以是xml也可以是ini文件,这里使用ini文件 在django项目的根目录新建一个uwsgi.ini文件,写入以下内容 [uwsgi] http = :8000 # 绑定端口 chdir = /home/trunk/ # 项目主目录 module = SpiderServer.wsgi #项目主目录下的SpiderServer.wsgi.py文件,省略后缀 master = true processes = 4 #线程 vacuum = true daemonize=uwsgi.log #日志文件 测试uwsgi是否正常启动 uwsgi --ini uwsgi.ini 使用命令行浏览器浏览127.0.0.1:8000。如果能够正常访问,说明uwsgi工作正常 links 127.0.0.1:8000 下载nginx压缩包 wget http://nginx.org/download/nginx-1.15.12.tar.gz 解压 tar -zxvf nginx-1.15.12.tar.gz 编译安装 cd nginx-1.15.12 ./configure make&make install nginx默认安装在/usr

centos7上部署flask项目 ngnix+uwsgi

匿名 (未验证) 提交于 2019-12-02 22:56:40
项目根目录:/home/lora/test/test1 ---|test1 ------|test1.py ------|uwsgi.ini 一、安装uwsgi pip install uwsgi 二、添加uwsgi配置文件 在根目录下添加uwsgi.ini,内容如下: [uwsgi] socket = 127.0.0.1:8001 pythonpath = /home/lora/test/test1 module = test1 callable = app processes = 4 threads = 2 各参数介绍: socket :通讯端口,外界可以通过127.0.0.1:8001访问,相当于我们在本地运行flask,并通过127.0.0.1:5000访问;并负责与nginx通信。 pythonpath :项目目录。 module :启动文件的文件名,我们可以在本地用python run.py启动flask项目。 callable :程序内启用的application变量名。 processes :处理器个数。 threads :线程数。 三、启动uwsgi uwsgi uwsgi.ini 四、安装nginx yum install nginx 五、修改nginx配置文件 配置文件的路径不尽相同,我的在/etc/nginx/nginx.conf。 修改如下

centos服务器上线第二个django项目方法。

匿名 (未验证) 提交于 2019-12-02 22:51:30
阿里云服务器开启端口8001,9001 创建一个虚拟环境 virtualenv - p python3 web2 使虚拟环境生效 source web2 / bin / activate 虚拟环境中安装django和uwsgi pip install django pip install uwsgi 创建一个django项目 django - admin . py startproject myweb2 修改项目中的settins.py文件 ALLOWED_HOSTS = [ 'www.terroristhouse.com' , 'terroristhouse.com' , '119.23.204.209' ] 指定端口,启动django项目看是否正常。 python3 manage . py runserver 0.0 . 0.0 : 8001 创建uwsgi配置文件, vi / etc / uwsgi / uwsgi9001 . ini 写入以下内容 [ uwsgi ] uid = root gid = root socket = 127.0 . 0.1 : 9001 master = true vhost = true no - site = true workers = 2 reload - mercy = 10 vacuum = true max - requests =

Django站点部署(Nginx+uWSGI)

匿名 (未验证) 提交于 2019-12-02 22:10:10
wsgi是一种实现python解析的通用接口标准/协议,是一种通用的接口标准或者接口协议,实现了python web程序与服务器之间交互的通用性。 uwsgi是uWSGI项目自有的协议。uWSGI是一种python web server或称为Server/Gateway,实现了uwsgi和WSGI两种协议的Web服务器,负责响应python 的web请求。 apache、nginx等都没有解析动态语言的功能,而是分派给其他模块来做。Nginx中HttpUwsgiModule的作用是与uWSGI服务器进行交换。 客户端(如浏览器)向服务器发送请求 nginx作为直接对外的服务接口,会解析接收到的来自客户端的HTTP请求 如果是静态文件请求就根据nginx配置的静态文件目录,返回请求的资源;如果是动态的请求,nginx就通过配置文件,将请求传递给uWSGI uWSGI 将接收到的包进行处理,并转发给wsgi wsgi根据请求调用django工程的某个文件或函数,处理完后django将返回值交给wsgi, wsgi将返回值进行打包,转发给uWSGI uWSGI接收后转发给nginx,nginx最终将返回值返回给客户端。 正向代理,例如FQ用的代理服务器就是正向代理,浏览器主动请求代理服务器,代理服 务器转发请求到对应的目标服务器 反向代理,部署在Web服务器上

Are a WSGI server and HTTP server required to serve a Flask app?

雨燕双飞 提交于 2019-12-02 22:07:06
问题 Setting up Flask with uWSGI and Nginx is quite difficult, and even with buildout scripts it takes quite some time, and has to be recorded to instructions to be reproduced later. If I don't plan a big load on server (it's hidden from public), does it make sense to run it without uWSGI? (Flask can listen to a port. Can Nginx just forward requests?) Does it make sense to not use even Nginx, just running bare flask app on a port? 回答1: When you "run Flask" you are actually running Werkzeug's

在阿里云ECS上部署 Django+MySQL+uWSGI+Nginx 项目的基本流程

匿名 (未验证) 提交于 2019-12-02 22:06:11
django==1.10.6 python==3.5.2 Mysql==5.6 uWSGI==2.0.15 Nginx==我也不知道是啥版本的 阿里云ECS服务器好像是自带 SSH 的,否则的话要安装 SSH 才能用 Xshell 进行连接: apt-get install ssh 使用 xshell 连接 阿里云服务器: 使用 xftp 向 服务器传送文件: 在使用 xshell 成功连接 服务器后,更新一下系统软件: sudo apt-get update sudo apt-get upgrade 接下来安装 MySQL-Server: Ubuntu16.04 下安装 MySQL 及配置 配置好 MySQL ,使其能够被远程连接: 在windows10环境下远程连接阿里云Ubunutu下MySQL的方法 配置 python 虚拟环境 在Ubuntu16.04下创建只有python3的虚拟环境 在激活虚拟环境的状态下 ,使用 pip 安装 requirements.txt 使用 pip 安装 uswgi: 测试 uwsgi : (mxonline)~/Documents/MxOnline# uwsgi --http :8000 --module MxOnline.wsgi 在Django 项目的目录下创建 一个 名为 conf 的目录,和一个 uc_nginx.conf 的文件:

服务器重启后 django无法连接mysql数据库的解决方法

匿名 (未验证) 提交于 2019-12-02 22:06:11
问题描述: 远程linux服务器,centOS7系统 采用uwsgi+django+pymysql的方式连接mysql数据库. 在服务器重启之后, 启用uwsgi之后(直接运行django运行命令也是一样python manage.py runserver), 无法连接到数据库. 报错: cryptography is required for sha256_password or caching_sha2_password 解决方法: 1. 手动连接数据库一次 mysql -u root -p 之后重启uwsgi服务即可. 2. ``` pip3 install cryptography ``` 来源:博客园 作者: 冰糖雪梨橙 链接:https://www.cnblogs.com/btxlc/p/11670637.html

[linux]centos7.4部署django+Uwsgi+Nginx

匿名 (未验证) 提交于 2019-12-02 21:59:42
前言:我已经写了几个接口用来部署在服务器上的,首先选择django+Uwsgi+Nginx因为配置简单,比较符合python的简单操作功能强大的特点 我的django项目大概结构: TestWebApi ----TestWebApi ----Apiso(创建的应用) ----manage.py 1.关闭debug 这时候算是部署正式环境,首先得把debug给关掉,参考之前写的一篇:https://www.cnblogs.com/Jack-cx/p/9348326.html,设置下debug,包含了域名、外网的访问, 另外数据库配置自己根据实际情况修改~ 2.尝试启动下, cd /项目下 python manage.py runserver ip:port 这里有个坑,可能会报错 没有ssl库 查看结果-这个是正常有的 [root@s011805161450 ~]# rpm -aq|grep openssl openssl-1.0.1e-48.el6_8.1.x86_64 openssl-devel-1.0.1e-48.el6_8.1.x86_64 没有则安装 # yum install openssl-devel -y # yum install openssl vi /usr/local/python36/Modules/Setup #修改Setup文件 #修改结果如下: #