簡體   English   中英

Uwsgi在作為服務運行時不會加載應用程序

[英]Uwsgi wont load app when run as service

我在Centos 6中設置了一個基本的燒瓶應用程序,一切都包含在一個文件(app.py)中。 我可以使用命令uwsgi --ini myuwsgi.ini從文件夾目錄中使用uwsgi --ini myuwsgi.ini運行該文件,一切都很好。 ini文件的內容是:

[uwsgi]
http-socket    = :9090
plugin    = python
wsgi-file = /project/app.py
process   = 3
callable = app

但是我希望每次服務器關閉或者它自己出現的任何東西都要設置它。 當我嘗試運行命令service uwsgi start日志顯示沒有找到應用程序。 該服務使用的ini文件是/etc/uwsgi.ini ,我將其替換為我的ini文件。

如果有幫助,則日志轉儲如下:

*** Starting uWSGI 2.0.13.1 (64bit) on [Fri Sep  2 07:49:37 2016] ***
compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-17) on 02 August 2016 21:07:31
os: Linux-2.6.32-042stab113.21 #1 SMP Wed Mar 23 11:05:25 MSK 2016
nodename: uwsgiHost
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /
detected binary path: /usr/sbin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 14605
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :9090 fd 3
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 1315, cores: 1)
-- unavailable modifier requested: 0 --

如果有人能告訴我為什么當我指定位置並且可以在ini中調用時它無法找到應用程序?

嘗試以下配置,讓我知道它是否適合您:

[uwsgi]
callable = app
chdir = /path/to/your/project/
http-socket = :9090
plugins = python
processes = 4
virtualenv = /path/to/your/project/venv
wsgi-file = /path/to/your/project/app.py

您可能還需要添加uidgid參數。

確保已安裝包uwsgi-plugin-python

apt-get install uwsgi-plugin-python

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM