首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改uwsgi感兴趣的应用程序文件?

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

Stack Overflow用户
提问于 2015-10-19 01:31:25
回答 1查看 2.4K关注 0票数 2

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

代码语言:javascript
复制
[uwsgi]
wsgi-file=app.py

这是可行的:它执行位于src/app.py的Flask应用程序src/app.py。但是,我现在想让webservice进一步查看一个文件夹,即src/signpostlab/app.py。然而,下列各点:

代码语言:javascript
复制
[uwsgi]
wsgi-file=../signpostlab/app.py

不起作用。实际上,似乎仍然指向旧文件!

我填错这个信息了吗?有办法改变这种行为吗?

编辑:uwsgi.log说:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-19 20:13:08

项目的基本路径应该是配置文件中的绝对路径。我想您的项目目录如下所示:

代码语言:javascript
复制
$ tree -L 1 /data/project/signpostlab
├── app.py
├── uwsgi.ini
└── venv

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

代码语言:javascript
复制
[uwsgi]
chdir     = /data/project/signpostlab
wsgi-file = app.py
venv      = venv
http      = :9090

它将chdir放入项目的dir中,其中存在app.py和virtualenv目录。http行表示该应用程序将位于localhost:9090。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33205274

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档