更改 uwsgi 感兴趣的应用程序文件?
Changing the application file of interest for uwsgi?
我正在为 Python 使用 uWSGI 设置一个网络服务。作为其中的一部分,我创建了 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 设置一个网络服务。作为其中的一部分,我创建了 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