我正在使用uWSGI为Python设置一个for服务。作为其中的一部分,我创建了uwsgi.ini,其内容如下:
[uwsgi]
wsgi-file=app.py这是可行的:它执行位于src/app.py的Flask应用程序src/app.py。但是,我现在想让webservice进一步查看一个文件夹,即src/signpostlab/app.py。然而,下列各点:
[uwsgi]
wsgi-file=../signpostlab/app.py不起作用。实际上,页似乎仍然指向旧文件!
我填错这个信息了吗?有办法改变这种行为吗?
编辑: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发布于 2015-10-19 20:13:08
项目的基本路径应该是配置文件中的绝对路径。我想您的项目目录如下所示:
$ 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放入项目的dir中,其中存在app.py和virtualenv目录。http行表示该应用程序将位于localhost:9090。
https://stackoverflow.com/questions/33205274
复制相似问题