首页 > 解决方案 > uwsgi的应用词典中mountpoint是什么意思?

问题描述

我写了一个名为 hello.py 的 python 文件

import uwsgi



def firstapp(env, start_response):
    start_response('200 OK', [('Content-TYpe', 'text/html')])
    yield "hello application \n"


def secondapp(environ, start_response):
    start_response('200 OK', [('Content-TYpe', 'text/html')])
    yield "second application \n"


uwsgi.applications = {
    '': firstapp,
    '/first': firstapp,
    '/second': secondapp,
}

然后从命令行执行命令:

uwsgi --http :9090 --wsgi hello

日志有以下内容:

WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0xf10400 pid: 31023 (default app)
WSGI app 1 (mountpoint='/second') ready in 0 seconds on interpreter 0xf10400 pid: 31023
WSGI app 2 (mountpoint='/first') ready in 0 seconds on interpreter 0xf10400 pid: 31023

我认为这是成功的。

我使用 curl 分别请求“http://127.0.0.1:9090/first”和“http://127.0.0.1:9090/second”。但是响应总是“hello application”,没有“second application”。

我认为 mountpoint 意味着不同的路径,但它看起来不像,那么 mountpoint 是什么?

参考文档:https ://uwsgi-docs.readthedocs.io/en/latest/Python.html#application-dictionary

标签: pythonuwsgi

解决方案


推荐阅读