uwsgi no app loaded. going in full dynamic mode ubuntu

【iceberg数据一致性】iceberg如何保证高并发数据一致性 那么在高并发的时候,同时操作某张表时是如何运作的呢?其实这里iceberg引用了乐观锁的方法。其实在写入数据的时候是有一个验证的操作的,即在准备写入时会检查原文件和带写入文件的差异,如果存在本次写入数据以外的数据,则代表有其他操作已经更新了原文件,那么本次写入会取消,并重试写入的步骤,知道验证完成,写入完成,如此就保证了数据的一致性,并且也解决了HMS锁的问题。在使用iceberg写数据时,一直弄不清楚为什么iceberg写入快,并且能够保证数据的一致性。今天决定搞清楚这个问题,经过查询和理解,写下来。 阅读详情

 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.
【ComfyUI专栏】安装Triton组件 Triton是一款支持大模型推理的深度学习加速组件,最初仅支持Linux平台,现已通过开源社区适配Windows系统。针对SageAttention的安装,建议使用3.2.0Post10版本(该版本提供封装好的安装包,更高版本仅有源码)。用户可通过GitHub获取安装资源,或直接使用pip命令"pip install triton-windows"进行安装。安装时需注意:1)在虚拟环境中操作;2)使用管理员权限。相关资源链接已在文中提供。 阅读详情

相关推荐

树莓派4B学习笔记(5)—— 来个GPIO操作吧

一. GPIO库介绍 对于树莓派,现在有wiringPi,BCM2835,python三种库可以使用。 python 开发语言:python 简单介绍:树莓派官方资料中推荐且容易上手,毫无疑问的说python非常适合树莓派,树莓派也非常适合python。 wiring PI 开发语言:C、C++ 简单介绍:功能很强大,适合那些具有C语言基础,在接触树莓派之前已经接触过单片机或者嵌入式开发的人群。wiring Pi的API函数和arduino非常相似,且作者也给出了很多示例代码,这也使得它广受欢迎。

weixin_44415639的博客 8753

如何解决部署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

海鸥派OpenEuler开发板实战:从烧写到SSH连接的完整指南

本文提供海鸥派OpenEuler开发板从开箱到SSH远程连接的完整实战指南。详细介绍了基于海思SD3403/SS928芯片的算力开发板系统烧写、存储扩容、网络配置等关键步骤,帮助开发者快速上手这款AI边缘计算设备,并实现高效的远程开发与管理。

ruby5的博客 1121

部署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

多传感器标定全栈系统学习教程

无论是激光雷达(Lidar)、毫米波雷达(Radar)、相机(Camera)还是惯导(IMU),传感器之间的精确标定直接决定了系统的可靠性与性能。本文将以系统化的视角,梳理多传感器标定的核心知识体系,并分享一套覆盖全栈技术的学习路径。Calibration)是实现点云与图像融合的前提,而雷达与车辆的标定(Radar2Car)则是精准速度估计的关键。:Lidar2Car、Camera2Car的快速标定流程,标定板布置规范。:从单传感器标定入手(如相机内参),逐步过渡到多传感器联合标定。

weixin_41792788的博客 904

Allegro16.6详细教程(二)

3-D Viewer,可以直接在allegro中看到board file的3-D顯示效果。3-D Viewer對於PCB Editor Products,只有環境變數中的OpenGL顯示功能開啟後才有效,而對於APD/SiP是無效的。2.3-D viewer是在一個獨立的視窗中打開的。3-D environment環境支援多種顯示內容的過濾,取景視角和顯示效果的選項,透過遊標可以直接控制放大,移動,翻轉等操作。

axingxiansen的博客 1917

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

31、双相不锈钢直齿轮加工与性能研究及人工神经网络在焊接中的应用

本文研究了双相不锈钢直齿轮在不同加工方法(WEDM与滚齿加工)下的磨损行为,分析了表面粗糙度、齿厚变化、磨损率及润滑性能随转速的变化规律,并对比了两种工艺的优劣。同时,探讨了人工神经网络(ANN)在AA7050铝合金搅拌摩擦焊中的应用,通过建立工艺参数与焊接质量之间的预测模型,实现了对焊缝硬度和峰值温度的准确预测。研究为高性能齿轮制造和铝合金焊接提供了理论支持和技术参考,并提出了未来在润滑优化、加工工艺改进及智能控制方面的研究方向。

ggg99的专栏 150

虚拟机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

Allan方差这个工具,怎么把它用的更顺手?(附Allan方差、动态Allan方差代码)

本文详细说明了Allan方差和动态Allan方差的计算过程,并通过递归运算和时间序列选择两种算法提高动态Allan方差的计算效率。文末提供了快速动态Allan方差计算代码。

victoryqian528的博客 372

Open3D 点到面的ICP配准算法【2025最新版】

点到面的ICP(python版本)博客长期更新,本文最近一次更新时间为:2025年2月2日,代码已更新至Open3D 0.18.0版本。

点云侠的博客 38万+

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

从 SM30 到 Fiori:在 SAP BTP ABAP Environment 里创建 Business Configuration 配置维护对象的完整路径

摘要 在SAP BTP的ABAP环境中,传统SAP GUI和SM30配置方式被Business Configuration (BC)替代。BC通过Fiori应用维护配置,支持传输和权限控制。配置表需满足可维护性条件,如允许数据维护、包含技术字段等。通过ADT生成Maintenance Object和Transport Object,实现配置发布与治理。权限管理需创建IAM App和Business Catalog,确保配置可维护。BC在云端延续了可控、可追溯、可发布的治理原则。 (字数:150)

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 240

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万+

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

阿里云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

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

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

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

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

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

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、付费专栏及课程。

余额充值