gpt4 book ai didi

python - 更改 uwsgi 感兴趣的应用程序文件?

转载 作者:行者123 更新时间:2023-12-01 04:25:34 24 4
gpt4 key购买 nike

我正在使用 uWSGI for Python 设置一个 Web 服务。作为其中的一部分,我创建了 uwsgi.ini,其中包含以下内容:

[uwsgi]
wsgi-file=app.py

这有效:它执行位于 src/app.py 的 Flask 应用程序 app.py。不过,我现在希望 Web 服务进一步查看一个文件夹,即 src/signpoSTLab/app.py。但是,以下内容:

[uwsgi]
wsgi-file=../signpostlab/app.py

没用。事实上,the page似乎仍然指向旧文件!

我是否错误地填写了此信息?有没有办法改变这种行为?

编辑:uwsgi.log 说:

Python version: 2.7.6 (default, Jun 22 2015, 18:01:27)  [GCC 4.8.2]
Set PythonHome to /data/project/signpostlab/www/python/venv
*** Python threads support is disabled. You can enable it with --enable-threads$
Python main interpreter initialized at 0x9ae860
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 363960 bytes (355 KB) for 4 cores
*** Operational MODE: preforking ***
failed to open python file app.py
unable to load app 0 (mountpoint='') (callable not found or import error)
mounting /data/project/signpostlab/www/python/src/app.py on /signpostlab
WSGI app 0 (mountpoint='/signpostlab') ready in 17 seconds on interpreter 0x9ae$
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 12292)
spawned uWSGI worker 1 (pid: 12300, cores: 1)
spawned uWSGI worker 2 (pid: 12301, cores: 1)
spawned uWSGI worker 3 (pid: 12302, cores: 1)
spawned uWSGI worker 4 (pid: 12303, cores: 1)
[pid: 12303|app: 0|req: 1/1] 10.68.21.81 () {34 vars in 574 bytes} [Mon Oct 19 $
[pid: 12302|app: 0|req: 1/2] 10.68.21.81 () {32 vars in 543 bytes} [Mon Oct 19

最佳答案

您的项目的基本路径应该是配置文件中的绝对路径。我猜你的项目目录看起来像这样:

$ tree -L 1 /data/project/signpostlab
├── app.py
├── uwsgi.ini
└── venv

在这种情况下,您可以使用以下uwsgi.ini配置文件:

[uwsgi]
chdir = /data/project/signpostlab
wsgi-file = app.py
venv = venv
http = :9090

它将 chdir 到项目的目录中,其中存在 app.py 和 virtualenv 的目录。 http 行意味着应用程序将位于 localhost:9090

关于python - 更改 uwsgi 感兴趣的应用程序文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33205274/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com