virtualvenv+django+uWSGI+nginx 部署 踩坑记录
原创博文 转载请注明出处!
uwsgi: unrecognized option '--http:8089'
uwsgi: unrecognized option '--http'
uwsgi trkMngm_uwsgi.ini -> invalid request block size: 21573 (max 4096)...skip
ModuleNotFoundError: No module named 'TrackManagement/TrackManagement/wsgi'
runserver运行django error : Bad Request
manage.py语法错误
uwsgi: unrecognized option '--http:8089'
(venv) [root@localhost TrackManagement]# uwsgi --http:8089 --module TrackManagement.wsgi
uwsgi: unrecognized option '--http:8089'
getopt_long() error
原因:
参数格式不对 :8089前面要加空格 uwsgi还在开启
↑
uwsgi: unrecognized option '--http'
(venv) [root@localhost TrackManagement]# uwsgi --http:8089 --module TrackManagement.wsgi
uwsgi: unrecognized option '--http'
getopt_long() error
原因:
uwsgi还在开启 先杀了进程再重启
uwsgi trkMngm_uwsgi.ini -> invalid request block size: 21573 (max 4096)...skip
启动了之后每次访问
*** Stats server enabled on 127.0.0.1:9295 fd: 12 ***
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
invalid request block size: 21573 (max 4096)...skip
原因:
trkMngm_uwsgi.ini 文件中有设置nginx的socket
如果这时候nginx没有对应的配置或者配置了但是nginx没有重启
就会产生这个错误
ModuleNotFoundError: No module named 'TrackManagement/TrackManagement/wsgi'
(venv) [root@localhost TrackManagement]# uwsgi --http :8089 --module TrackManagement/TrackManagement/wsgi.py
*** Starting uWSGI 2.0.18 (64bit) on [Tue Feb 19 11:33:20 2019] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-36) on 18 February 2019 05:28:03
os: Linux-3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 29 14:49:43 UTC 2018
nodename: localhost.localdomain
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /root/Odin/TrackManagement
detected binary path: /root/Odin/TrackManagement/venv/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 63229
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8089 fd 4
spawned uWSGI http 1 (pid: 33181)
uwsgi socket 0 bound to TCP address 127.0.0.1:33454 (port auto-assigned) fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.6.4 (default, Mar 6 2018, 13:19:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x12acbf0
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72920 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
ModuleNotFoundError: No module named 'TrackManagement/TrackManagement/wsgi'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 33180, cores: 1)
原因:
应该在TrackManagement项目里面运行 即这个目录下面
(venv) [root@localhost TrackManagement]# ls
db.sqlite3 manage.py testUwsgi.py TrackManagement
runserver运行django error : Bad Request
(venv) [root@localhost TrackManagement]# python manage.py runserver 0.0.0.0:8080
Performing system checks...
System check identified no issues (0 silenced).
You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
February 18, 2019 - 07:47:25
Django version 2.1.7, using settings 'TrackManagement.settings'
Starting development server at http://0.0.0.0:8080/
Quit the server with CONTROL-C.
Invalid HTTP_HOST header: '10.41.95.85:8080'. You may need to add '10.41.95.85' to ALLOWED_HOSTS.
Bad Request: /
[18/Feb/2019 07:47:51] "GET / HTTP/1.1" 400 60826
Invalid HTTP_HOST header: '10.41.95.85:8080'. You may need to add '10.41.95.85' to ALLOWED_HOSTS.
Bad Request: /favicon.ico
[18/Feb/2019 07:47:54] "GET /favicon.ico HTTP/1.1" 400 60906
solution :
django setting.py
ALLOWED_HOSTS = ['*'] -> ALLOWED_HOSTS = ['*']
manage.py语法错误
SyntaxError: invalid syntax
[root@localhost TrackManagement]# python manage.py runserver 0.0.0.0:8080
File "manage.py", line 14
) from exc
solution
没有运行虚拟环境 外面的环境是python 虚拟环境才是python3 所以会有语法错误
virtualvenv+django+uWSGI+nginx 部署 踩坑记录的更多相关文章
- virtualvenv+django+uWSGI+nginx 部署
原创博文 转载请注明出处! 1. virtualvenv 2. django 3. uWSGI 4. nginx 5. 踩坑记录 1. virtualvenv virtualvenv install ...
- django+uwsgi+nginx部署(非常详细)
django+uwsgi+nginx部署 1.介绍: 在网上看了很多教程,但自己部署了很久都没有成功,这篇博文记录自己所踩过得坑. 2.环境: Ubuntu 16.04.1 LTS (GNU/Linu ...
- Linux 集群概念 , wsgi , Nginx负载均衡实验 , 部署CRM(Django+uwsgi+nginx), 部署学城项目(vue+uwsgi+nginx)
Linux 集群概念 , wsgi , Nginx负载均衡实验 , 部署CRM(Django+uwsgi+nginx), 部署学城项目(vue+uwsgi+nginx) 一丶集群和Nginx反向代理 ...
- Django+uWSGI+Nginx 部署网站
Django 1.11设置 保证Django在本地调试没有问题: 当然这是前提^_^ 收集静态文件至指定文件夹 Django静态文件设置具体参考:https://docs.djangoproject. ...
- Ubuntu下Django+uWSGI+nginx部署
本文采用uwsgi+nginx来部署django 这种方式是将nginx作为服务端前端,将接受web所有的请求,统一管理,Nginx把所有的静态请求自己处理,然后把所有非静态请求通过uwsgi传递给D ...
- Django+Uwsgi+Nginx部署
一 uwsgi介绍 uWSGI是一个Web服务器,它实现了WSGI协议,uwsgi, http等协议. Nginx中HttpUwsgiMoule的作用是与uWSGI服务器进行交换 1 WSGI是一种W ...
- Mac系统STF自动化环境搭建及部署踩坑记录
因为公司需要寻找一个免root的自动化测试方案,所以以前做的老方案需要被替代.一阵搜寻找到了这个框架,但是部署起来很是折腾,搞了一下午终于搞定,顺便记录一下过程,有需要的自取. 转载请注明出处:htt ...
- Exceptionless 本地部署踩坑记录
仅已此文记录 Exceptionless 本地部署所遇到的问题 1.安装ElasticSearch文本 执行elasticsearch目录中的elasticsearch.bat 没有执行成功. 使用命 ...
- django+uwsgi+nginx 部署生产环境
一.Uwsgi安装 python3 -m pip install uwsgi cp /usr/local/python3/bin/uwsgi /usr/bin/ 测试 在django项目主目录下cre ...
随机推荐
- IT兄弟连 JavaWeb教程 jQuery对AJAX的支持
jQuery对AJAX的支持 jQuery对Ajax请求的创建.发送.响应.注册数据处理函数.JSON的解析和缓存以及传参等都进行了相应的封装,同时也考虑了浏览器的兼容性问题. jQuery中对AJA ...
- 浅谈JAVA GUI中,AWT与Swing的区别、联系及优缺点
浅谈JAVA GUI中,AWT与Swing的区别.联系及优缺点 A.区别 1.发布的时间 AWT是在JDK 1.0版本时提出的 Swing是在AWT之后提出的(JAVA 2) 2. ”重量” AWT是 ...
- java基础第九篇之final和内部类等
final关键字:final:最终,终极 final:作用:修饰类,变量,方法.成员变量的访问 1.final修饰变量: final修饰局部变量: 把这个局部变量 变成一个厂里,这个厂里只能被赋值一次 ...
- Java流程控制和数组
流程控制 Java中三种基本的流程控制结构:顺序结构,分支结构和循环结构. 顺序结构,任何编程语言中都会有的程序结构. 分支结构:Java语言中常见的两种, if语句和switch语句. if语句,使 ...
- 【VueJS】VueJS开发请求本地json数据的配置
VueJS开发请求本地json数据的配置,旧版本是build/dev-server.js,新版本是build/webpack.dev.conf.js. VueJS开发请求本地json数据的配置,早期的 ...
- 【bzoj4567】[Scoi2016]背单词
4567: [Scoi2016]背单词 Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 1123 Solved: 476[Submit][Status][ ...
- NET Core项目
在IIS上部署你的ASP.NET Core项目 概述 与ASP.NET时代不同,ASP.NET Core不再是由IIS工作进程(w3wp.exe)托管,而是使用自托管Web服务器(Kestrel) ...
- xxx cannot be resolved to a type
1.jdk不匹配(或不存在) 项目指定的jdk为“jdk1.6.0_18”,而当前eclipse使用的是“jdk1.6.0_22”.需要在BuildPath | Libraries,中做简单调 ...
- .net 中 Json 与List 相互转
var duanxin1 = new DuanXin(); duanxin1.RECEIVE_LOGIN_NAME = "dd"; duanxin1.RECEIVE_Number ...
- Java中的Validated验证
注意点:在使用@NotBlank时,必须与@Valid配着使用,不然不起作用(出现了很奇怪的现象,我第一次试的时候确实有这情况,但是第二次的时候这情况没了,所以这个说不准) @NotBlank 用在S ...