心路历程

毫无疑问,又是能让我跳楼的BUG,但是结果都一样,很小的细节,卡我两天时间。

BUG过程:

在ubuntu上部署django项目时,需要安装uwsgi服务器。根据教程安装完之后,然后会有一个小测试,就是写一个test.py文件运行一下看uwsgi是否安装成功。具体的test.py文件我就不贴了,网上一堆。
然后重要的是在运行命令:uwsgi –http :8001 –wsgi-file test.py时,报错了。详细错误信息如下:

dh@ubuntu:~$ uwsgi –http :8001 –wsgi-file test.py
Starting uWSGI 2.0.17 (64bit) on [Mon Jun 11 12:37:29 2018]
compiled with version: 7.3.0 on 07 June 2018 06:45:48
os: Linux-4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018
nodename: ubuntu
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /home/dh
detected binary path: /home/dh/.local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
WARNING: you are running uWSGI without its master process manager
your processes number limit is 15072
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 :8001 fd 4
spawned uWSGI http 1 (pid: 18207)
uwsgi socket 0 bound to TCP address 127.0.0.1:36073 (port auto-assigned) fd 3
Python version: 3.6.5 (default, Apr 1 2018, 05:46:30) [GCC 7.3.0]
Python threads support is disabled. You can enable it with –enable-threads
Python main interpreter initialized at 0x55e5bf3e29c0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
Operational MODE: single process
failed to open python file test.py
unable to load app 0 (mountpoint=”) (callable not found or import error)
no app loaded. going in full dynamic mode
uWSGI is running in multiple interpreter mode
spawned uWSGI worker 1 (and the only) (pid: 18206, cores: 1)

报错的就是最后那三句:

failed to open python file test.py
unable to load app 0 (mountpoint=”) (callable not found or import error)
no app loaded. going in full dynamic mode

报错原因:找不到test.py文件

解决方法:

在根据教程安装uwsgi时,我的理解是,安装完 ,直接在django项目里写一个test.py文件,再用命令运行就可以。
实际的步骤是:安装完uwsgi后,在任何位置都可以写这个test.py文件,然后打开终端运行命令时的位置必须和这个test.py文件位置相同,例如:test.py文件的路径是/home/etc/test.py,那你终端的位置也应该是/home/etc/test.py,就不会报这个错了。

最后再列一下安装uwsgi的正确步骤:

1.sudo apt-get install libpcre3 libpcre3-dev ,第一步必须先安装这个库文件,不然不报错:no internal routing support, rebuild with pcre support

2.sudo pip3 install uwsgi ,这里和上一篇注意的BUG一样,如果你是python3,就一定要用pip3安装

3.任何位置写一个test.py,内容如下
def application(env, start_response):
   start_response(‘200 OK‘, [(‘Content-Type‘,‘text/html‘)])
   return [b”Hello World”]

4.然后启动终端,和之前说的一样,终端的位置要和test的文件位置相同,运行命令:uwsgi –http :8001 –wsgi-file test.py

5.浏览器里输入:127.0.0.1:8001就可以看到输出效果:Hello World

OK了

BUG之路2--ubuntu安装uwsgi测试报错:failed to open python file test.py相关推荐

  1. ubuntu安装xinetd服务报错 invoke-rc.d: policy-rc.d denied execution of restart解决

    ubuntu安装telnet服务报错 invoke-rc.d: policy-rc.d denied execution of restart解决 1.下载xinetd安装包 wget http:// ...

  2. E: Sub-process /usr/bin/dpkg returned an error code (1) Ubuntu安装apt-get命令报错

    Ubuntu apt-get命令报错 上次更新Ubuntu(14.04到16.04)时,我走开了一会儿等回来之后电脑就黑屏了,咋整都没反应没办法我就强制关机然后重启.结果...好不容易把系统整好了,然 ...

  3. Ubuntu安装vmware-tools出现报错unable to copy the source file./installer/service.sh to the destination file

    一. Ubuntu安装vmware-tool失败,出现unable to copy the source file./installer/service.sh to the destination f ...

  4. 【昇腾310】【mindspore 安装后测试报错】ImportError: libacl_tdt_channel.so

    [功能模块] 按照[官网链接](MindSpore官网) 安装 MindSpore 完毕后运行 import mindspore 报错,提示缺少依赖库文件 libacl_tdt_channel.so ...

  5. 【Rust】Ubuntu编译Rust程序报错 failed to run custom build command for openssl-sys v0.9.39 的解决方法

    Ubuntu环境下编译Rust程序报错: failed to run custom build command for openssl-sys v0.9.39 Ubuntu版本:20.04 参考Git ...

  6. Ubuntu安装apt出现报错如何操作(简单记录)

    sudo apt-get install python-pip 出现如下情况: 需要进行更新系统包 sudo apt-get update sudo apt-get upgrade 然后进行:sudo ...

  7. FATE框架安装后测试报错:ModuleNotFoundError: No module named ‘arch‘

    这里不能:pip install arch,因为fate框架使用的不是pypi里的arch,而是根目录 standalone-fate-master-1.4.5/ 下的 arch文件夹 所以: 在命令 ...

  8. Virtualbox中Ubuntu安装增强功能报错:未能加载虚拟光驱 VBoxsGuestAdditions.iso到虚拟电脑

    解决方法如下: https://blog.csdn.net/zhangmeimei_pku/article/details/79597620 https://blog.csdn.net/binbinx ...

  9. ubuntu中打开终端报错Failed to execute default Terminal Emulator

    问题描述 在ubuntu中无法打开终端,提示未能执行默认终端,如下所示 可能原因 错误已经给出了提示,未能执行默认终端,更改默认项就可以了 问题解决 在settings中找到Preferred App ...

最新文章

  1. linux服务器之LVS、Nginx和HAProxy负载均衡器的对比
  2. 数据库的设计经验(经典)
  3. WEB--一个不错的想法
  4. backdrop-filter 和filter 写出高斯模糊效果 以及两者区别
  5. vi 编辑器基本使用
  6. 货拉拉携手神策数据,数据赋能企业,实现多元颠覆式创新
  7. Boost:同步化的测试程序
  8. Android Databinding学习
  9. C#_自动化测试 (四) 自动卸载软件
  10. [转帖]mysql ERROR 1130 解决办法
  11. Linux浏览器libgtk-3,终于把WebKit(基于GTK)移植到ARM上
  12. 外星网络大肆入侵,地球人能安好吗?
  13. 使用expect实现shell的交互
  14. 软件测试达内视频笔记(二)
  15. 基于Java开发的五子棋游戏APP设计与实现
  16. 进制转换(二进制、八进制、十进制、十六进制)涵盖整数与小数部分,超详细
  17. c语言的二维数组的指针访问,用指针访问二维数组
  18. 通过有限差分和matlab矩阵运算直接求解一维薛定谔方程,通过有限差分和MATLAB矩阵运算直接求解一维薛定谔方程...
  19. 4k纸是几厘米乘几厘米_4K纸是多少尺寸
  20. 玩客云:更好的迅雷从“共享计算”开始

热门文章

  1. spike sorting
  2. 嘉士达擦玻璃机器人_擦窗机器人哪个牌子好?最好用的三个擦玻璃机器人品牌推荐...
  3. Centos7+nginx+uwsgi来部署我的Django项目
  4. IOS内购经常遇到的一些问题,和一些容易混淆的点。
  5. FATAL:gpu_data_manager_impl_private.cc(439)] GPU process isn‘t usable. Goodbye
  6. 统计学术语及解释(一)
  7. STO解析:从STO概念到STO生态圈
  8. 获取安卓app的package和activity比较好用的方式
  9. 2020-2021 ACM-ICPC, Asia Nanjing Regional Contes F-Fireworks
  10. Argo Workflow简单样例——dag-阿里云开发者社区