uwsgi no app loaded. going in full dynamic mode ubuntu

Nvivo12新手避坑指南:从安装到编码的完整流程(附实战案例) 本文为Nvivo12新手提供了从软件安装、初始设置到数据导入和编码分析的完整避坑指南。通过一个“校园欺凌现象的学生访谈研究”实战案例,详细拆解了处理中文文本、创建项目结构、执行手动编码及高级查询等关键步骤,帮助研究者避开常见错误,快速上手并高效完成质性数据分析。 阅读详情

 http://jawher.me/2012/03/16/multiple-python-apps-with-nginx-uwsgi-emperor-upstart/


==============================================================

ERROR --> uwsgi  no app loaded. going in full dynamic mode

1、安装

uwsgi-plugin-python 插件

2、xml中加入

<plugins>python</plugins>

==============================================================

This is a recipe on how to easily run multiple Python web applications using uwsgi server (in emperor mode) and behind nginx.Most existing docs and blogs would show how to manually start uwsgi to run a single app. In this post, I'll show how to configure uwsgi as a system service (with upstart) capable of serving multiple python WSGI compliant web applications by simply placing them in a standard location and adding an standard xml file.

It took me many many hours and sleepless nights to get this setup to work. I was on the verge of giving up on uwsgi/nginx and falling back to apache/mod python. I'm not proud of it, but when it worked, I had (and still don't have) no idea why it did. So I would advice the readers not to change too much at a time, and rather work incrementally, with small changes at a time and immediate testing afterwards.

I'm using this setup on a couple EC2 machines running Ubuntu 11.10, nginx 1.0.5-1, Python 2.7.2, uwsgi 0.9.8.1-1 and using the bottle web framework, but the sameshould work for any other WSGI compliant framework.

1. Installing the required software

  • We'll (of course) need Python. It comes pre-installed on Ubuntu and other linuxes. Nothing to do here.
  • uwsgi: sudo aptitude install uwsgi uwsgi-plugin-python
  • bottle (optional): Since I'll be using Bottle framework for the test applications, we'll need to have it installed for this recipe to work, but if you're using another framework, you could skip this step. Just run this command:sudo easy_install bottle. If easy_install isn't already installed, runsudo aptitude install python-setuptools.
  • nginx: sudo aptitude install nginx-full

2. Configuration

uwsgi

We'll run uwsgi using upstart so that it is automatically started on startup.

We'll create a uwsgi.conf file in /etc/init:

sudo emacs /etc/init/uwsgi.conf:

With this content:

# uWSGI - manage uWSGI application server                                                                                                                                                                
#                                                                                                                                                                                                    

description     "uWSGI Emperor"

start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]

respawn

env LOGTO=/var/log/uwsgi.log
env BINPATH=/usr/bin/uwsgi

exec $BINPATH --emperor /home/ubuntu/apps/vassals/ --logto $LOGTO

Notice the path telling uwsgi emperor mode where to look for applications' configuration files (We'll be using the xml syntax here).You'll need to modify this to match your setup.

Then run this command to refresh the services configuration:

sudo initctl reload-configuration

We also want to make sure that uwsgi is using the system installed python (2.7 in this case) and not another version (2.6), so we need to run this:

sudo update-alternatives --set uwsgi /usr/bin/uwsgi_python27

And start the uwsgi service:

sudo service uwsgi start

nginx

We'll create a apps.conf file in the /etc/nginx/sites-enabled directory to tell nginx to pass through requests to uwsgi:

sudo emacs /etc/nginx/sites-enabled/apps.conf

server {
  listen 80;
  server_name jawher.me;
  index index.html;

  location /app1/ {
    include uwsgi_params;
    uwsgi_param SCRIPT_NAME /app1;
    uwsgi_modifier1 30;
    uwsgi_pass unix://tmp/app1.sock;
  }

  location /app2/ {
    include uwsgi_params;
    uwsgi_param SCRIPT_NAME /app2;
    uwsgi_modifier1 30;
    uwsgi_pass unix://tmp/app2.sock;
  }
}

You'll need to customize this file to match your setup (server name, apps locations, socket names, etc.)

Also, there's a bit of magic here, the uwsgi_param SCRIPT_NAME /app? anduwsgi_modifier1 30 thingies. Without them, requestingjawher.me/app1/index would end up callingapp1/index on the bottle web application (i.e. the nginx location gets passed to the wsgi application, which is not what we want most of the time). With this modifier and script param thingies, the nginx location is stripped before invoking the python application.

Start the nginx server if it is not already running:

sudo service nginx start

Also, whenever you change the nginx config files, remember to run the following command:

sudo service nginx reload

3. The test applications

We'll create to test web applications to test our setup:

An app in this case is a python file that defines a bottle app:

emacs /home/ubuntu/apps/app1/app1.py

import bottle
import os

@bottle.get('/index')
def index():
    return "App 1 live and kicking"

if __name__ == '__main__':
    bottle.debug(True)
    bottle.run(reloader=True, port=8080)
else:
    os.chdir(os.path.dirname(__file__))
    application = bottle.default_app()

This file can be executed with python, in which case the main bloc will launch the application in debug mode, or with uwsgi without a change to the file. Don't change the variable nameapplication, as that's what uwsgi will be looking for (unless you tell it otherwise).

We'll also need an xml file to tell uwsgi emperor mode how to handle our app:

emacs /home/ubuntu/apps/vassals/app1.xml

<uwsgi>
    <plugins>python</plugins>
    <master>true</master>
    <processes>1</processes>
    <vaccum>true</vaccum>
    <chmod-socket>666</chmod-socket>
    <socket>/tmp/%n.sock</socket>
    <uid>www-data</uid>
    <gid>www-data</gid>
    <pythonpath>%d../%n</pythonpath>
    <module>%n</module>
</uwsgi>

This config file is completely generic, and we could reuse the exact same content for any other app. In order to do this, it has to heavily rely on these conventions:

  • the xml config file has to have the same name as the python module that exports the wsgi application (app1.xml andapp1.py)
  • the python module file name has to match its directory name (app1.py in anapp1 dir)

If this is not acceptable for your setup, you'll need to change the values of the<pythonpath> and<module> tags to match your setup.

The second application is exactly the same, except for 'app 1' which gets replaced by 'app 2':

emacs /home/ubuntu/apps/app2/app2.py

import bottle
import os

@bottle.get('/index')
def index():
    return "App 2 live and kicking"

if __name__ == '__main__':
    bottle.debug(True)
    bottle.run(reloader=True, port=8080)
else:
    os.chdir(os.path.dirname(__file__))
    application = bottle.default_app()

emacs /home/ubuntu/apps/vassals/app2.xml

<uwsgi>
    <plugins>python</plugins>
    <master>true</master>
    <processes>1</processes>
    <vaccum>true</vaccum>
    <chmod-socket>666</chmod-socket>
    <socket>/tmp/%n.sock</socket>
    <uid>www-data</uid>
    <gid>www-data</gid>
    <pythonpath>%d../%n</pythonpath>
    <module>%n</module>
</uwsgi>

4. Troubleshooting

When it doesn't work, you'll usually end up with an unhelpful 502 error. To diagnose the problem:

  • Check that the sockets were created: ls /tmp and that nginx's process can read, write and execute them. This shouldn't happen though as we specifiedchmod 666 in the applications config file.
  • Check that the apps were correctly loaded in /var/log/uwsgi.log: if you find this message\*\*\* no app loaded. going in full dynamic mode \*\*\*, then go back and double check the module name and path in the app xml file, or try to run the app with python, as inpython app1.py to see if there aren't any missing imports or other errors. You may also run into this if the user under which uwsgi is running doesn't have read permissions on the app python files.
  • Make sure that your app runs with the same version of python that uwsgi uses. Usually, you'll just want to configure uwsgi to use the system-wide python install.
  • /var/log/nginx/error.log might turn out some useful info too.
《大数据: Hive 交互命令和常用配置》 一、Hive 交互命令 1. 首先解决一个可能发生的问题 (log4 jar包冲突) 我这里解决方法就是删除一个,我删的是hive下的包 yexiang@hadoop1:<hive>$ hive SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/soft/apache-hive-2.3.7-bin/lib/log4j-slf4j-impl-2.6.2.ja. 阅读详情

相关推荐

VMware Converter 6.2.0保姆级教程:从物理机到ESXi主机的完整迁移指南(含常见错误排查)

本文提供VMware Converter 6.2.0从物理机迁移至ESXi主机的完整保姆级教程。详细解析了迁移前的环境规划、核心转换过程步骤、版本差异对比,并重点针对代理安装失败、任务卡顿、虚拟机无法启动等常见错误提供了实战排查与解决方案,确保P2V迁移顺利进行。

sam99的博客 380

如何解决部署flask+uwsgi出现uwsgi no app loaded. going in full dynamic mode的问题

服务器版本:Linux服务器CentOS版本 项目概述:python3 + Flask + uwsgi 服务器上python版本混乱,有2.7和3.7俩个版本,因为有多人在用,环境安装的也颇为混乱。在部署flask项目的时候,就碰到了一系列的问题。废了一下午时间解决,现在总结一下。脑壳疼 -。- 就是这个问题:uwsgi no app loaded. going in full dynam...

牛巨侠的博客 7245

浏览器Cookie迁移实战:从Chrome导出导入登录态全攻略

Cookie是浏览器保存的会话凭证,服务端通过Set-Cookie将登录态种在本地。迁移Cookie本质上是把服务端认可的会话标识搬到新环境,从而免去重复输入账号密码和二次验证的麻烦。在换电脑、切浏览器或重装系统时,掌握Cookie的导出导入技术能显著提升效率。Chrome与Edge同属Chromium内核,存储结构相似,但字段差异(如Domain、SameSite、Secure)常导致迁移失败。通过浏览器扩展或CDP脚本可实现跨浏览器登录态迁移,适用于内网后台、开发环境等场景。本文从原理到实践,梳理Coo

weixin_42533120的博客 339

部署uWSGI报错:no app loaded. going in full dynamic mode

 运行uWSGI服务是报错   下载安装uwsgi-plugin-python,安装失败, 卸载uwsgi, sudo apt-get remove uwsgi sudo apt-get update 重新安装uwsgi sudo apt-get install uwsgi sudo apt-get install uwsgi-plugin-python  sudo pi...

qq_34172340的博客 3069

PyCharm配置WSL开发环境保姆级教程:从安装Conda到项目依赖一键搞定

本文提供PyCharm配置WSL开发环境的完整教程,涵盖从安装Conda到项目依赖管理的全流程。详细介绍了WSL2环境准备、Conda环境配置、PyCharm远程解释器设置等关键步骤,并包含实用技巧和常见问题解决方案,帮助开发者高效搭建Python开发环境。

weixin_42620202的博客 308

AI for Science:GNN预测分子性质全流程详解与工业实践

从分子表示到工业落地,一文掌握图神经网络在药物研发与材料设计中的核心实战近年来,的浪潮正深刻变革着传统科研范式。在药物研发与材料设计领域,作为核心环节,已从传统的实验试错转向基于图神经网络(GNN)的智能计算。本文将深入解析GNN预测分子性质的,涵盖数据准备、模型设计、训练优化到工业部署,并揭秘前沿技术与实战案例。

datacanvas2426的博客 1674

uwsgi使用ini配置文件启动报错 no app loaded

使用ini配置文件启动报错 no app loaded * no app loaded. going in full dynamic mode * uwsgi -s :8000 -w chatgo.wsgi uwsgi --socket :8000 --plugin python --module HelloWorld.wsgi 以上命令是可以,可见需要python p...

weixin_34113237的博客 697

在unity urp项目中 通过图片创建材质(透明光晕)

unity中通过图片创造材质(urp管道)

m0_49721415的博客 1537

虚拟机python pip安装不了_Python已经pip安装某模块后仍然报错ImportError: No module named ***...

[uwsgi] no request plugin is loaded, you will not be able to manage requests.Problem:*** Operational MODE: preforking+threadedno app loaded. going in full dynamic modeuWSGI is running in multiple inte...

weixin_39996096的博客 786

实战教程:用DETR+超分辨率搞定红外小目标检测(附完整代码)

本文提供了一套完整的红外小目标检测实战方案,通过融合EDSR超分辨率技术与改进型DETR深度学习算法,有效解决了红外图像中小目标检测的难题。文章详细介绍了从环境搭建、数据预处理、模型定制(如引入EMA注意力与S2特征层)到训练调优的全流程,并附有完整代码,旨在帮助开发者将前沿算法高效落地于安防、自动驾驶等实际场景。

weixin_29057163的博客 532

Unity 面试篇⚠️ | Unity性能优化好,山寨机都能跑~

Unity 面试篇⚠️ | Unity性能优化好,山寨机都能跑~

m0_58523831的博客 1万+

uwsgi no app loaded. going in full dynamic mode

os.path.abspath(path) 返回path规范化的绝对路径。 参考:http://www.redicecn.com/html/Python/20110507/273.html

liushaochan123的专栏 6533

复旦微FMSH_Procise安装流程

双击FMSH_Procise_2021.1_full_win64_202103151947.exe 选择好安装目录后点击“Next” 一路next 点install 找技术支持代为申请 License,将电脑MAC地址发过去,将获得的 license 拷贝到 procise 安装目录“data”文件夹,即可使用 procise。点license manager和copy license 将licence,.lic文件放到这个目录 要是报下面错误要...

wangjie36的博客 1万+

Python已经pip安装某模块后仍然报错ImportError: No module named ***

[uwsgi] no request plugin is loaded, you will not be able to manage requests. Problem: *** Operational MODE: preforking+threaded no app loaded. going in full dynamic mode uWSGI is running in multi...

暗焰之珩的博客 2万+

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

阿里云centOS安装uwsgi之后测试失败的原因

问题一: 「报错: open("./python_plugin.so"): No such file or directory [core/utils.c line 3724] !!! UNABLE to load uWSGI plugin: ./python_plugin.so: cannot open shared object file: Permission denied!!! 」 [...

Test architect 2647

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

总结uwsgi+anaconda+django启动遇到的问题

用conda安装uwsgi就可以了。这个应该和conda的环境有关系。这个不行的,安装成功,但是anaconda环境下使用就会出这个问题。不管怎么改配置都报这个错,网上很多解答,但是没有成功的。

采菊东篱下,Python满乾坤! 765

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

linux uwsgi 非root,把项目复制到linux 用manage运行没问题。用uwsgi运行报错

File "/usr/local/lib/python3.5/site-packages/django/apps/registry.py", line 249, in get_containing_app_configself.check_apps_ready()File "/usr/local/lib/python3.5/site-packages/django/apps/registry.py...

weixin_35840316的博客 394

flask用uwsgi启动部署后报500

针对uwsgi代理部署flask遇到的服务500问题

杨佳佳的博客 2353

部署中遇到的问题-UWSGI(一)

如果uwsgi错误中提示 *** no app loaded. going in full dynamic mode *** 执行 [plain] view plaincopy aptitude install uwsgi-plugin-python   之后重启uwsgi

公众号 2840

debian下面nginx + uwsgi + Django1.5.1 配置环境

之前一直都是Django测试环境manager.py runserver。 项目准备的差不多准备上线。在大牛的推荐下,使用virtualbox 安装 debian wheezy版本。 思路。 1:安装系统 2:远程SSH模拟登录vps 3:安装python与Django开发环境 4:nginx + uwsgi 安装与测试 5:整体测试 1:安装1个干净的debian以后启动

watsy 7761

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

心路历程 毫无疑问,又是能让我跳楼的BUG,但是结果都一样,很小的细节,卡我两天时间。 BUG过程: 在ubuntu上部署django项目时,需要安装uwsgi服务器。根据教程安装完之后,然后会有一个小测试,就是写一个test.py文件运行一下看uwsgi是否安装成功。具体的test.py文件我就不贴了,网上一堆。 然后重要的是在运行命令:uwsgi –http :8001 –wsgi...

一个Python菜鸟的博客 5986

关于dwebsocket部署 uwsgi、nginx的那些报错

所有操作均在ubuntu下测试进行!!! uwsgi no app loaded. going in full dynamic mode #Solution sudo apt-get remove uwsgi sudo apt-get update #创建并进入虚拟环境 sudo pip install uwsgi 这里是引用 #Solution http-websockets = ...

Hayley-L 1230

部署中遇到的问题-UWSGI(二)

pip-installed uWSGI ./python_plugin.so error 使用xml格式的uwsgi配置 uwsgi -x /home/zoueswebsite/zoueswebsite.xml的命令显示如下error: open("./python_plugin.so"): No such file or directory [core/utils.c l

公众号 1万+

centos Nginx Django uwsgi踩坑之ModuleNotFoundError: No module named 'django'

在阿里云部署Django程序后,使用uwsgi –ini启动时,发现启动报错,日志如下:Traceback (most recent call last): File "/data/wwwroot/django_xadmin/django_xadmin/wsgi.py", line 12, in <module> from django.core.wsgi import get_wsgi

小洋人最happy的专栏 1万+

Python--Nginx+uWSGI+Flask (三)日志找错误

经验总结日志寻找错误源 设置uWSGI.ini的运行日志 设置Nginx的运行日志 错误一:   先开uWSGI.ini 然后开 Nginx,504错误,日了狗了! 打开uWSGI的运行日志,有如下错误!Traceback (most recent call last): File "/home/two/main.py", line 1, in <module> from flas

似水流年 2990
上一篇: route添加删除备忘
下一篇: 2012/3/22 我所理解的生活
kumu_Linux
博客等级 码龄14年 68粉丝 94原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值