當前位置: 首頁>>技術教程>>正文


ubuntu + nginx + uwsgi + django未找到Python應用程序

, , ,

問題描述

我正在嘗試使用nginx到uwsgi到django堆棧的服務器設置服務器,但是我在uwsgi部分遇到了問題。

當我運行uwsgi並在命令行中傳遞所有參數時,它可以正常工作。我的uwsgi呼叫看起來像這樣:

uwsgi --socket /tmp/uwsgi.sock --chdir ~/web/test.com --wsgi-file ~/web/test.com/store/wsgi.py --virtualenv ~/web/test.com/testenv --chmod-socket=666 --enable-threads

然後,我將這些參數複製到一個如下所示的ini文件中:

# django.ini file
[uwsgi]
master          = true 
socket          = /tmp/uwsgi.sock
chmod-socket    = 666
chdir           = /home/ubuntu/web/test.com
wsgi_file       = /home/ubuntu/web/test.com/store/wsgi.py
virtualenv      = /home/ubuntu/web/test.com/causumptionenv
vacuum          = true
enable-threads  = true

但是,當我使用django.ini文件運行uwsgi時,將得到此輸出。

[uWSGI] getting INI configuration from django.ini
*** Starting uWSGI 1.9.11 (64bit) on [Fri May 31 14:52:44 2013] ***
compiled with version: 4.6.3 on 30 May 2013 15:40:11
os: Linux-3.2.0-40-virtual #64-Ubuntu SMP Mon Mar 25 21:42:18 UTC 2013
nodename: ip-10-245-64-211
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /home/ubuntu/web/test.com
detected binary path: /usr/local/bin/uwsgi
your processes number limit is 4594
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 3
Python version: 2.7.3 (default, Aug  1 2012, 05:25:23)  [GCC 4.6.3]
Set PythonHome to /home/ubuntu/web/test.com/testenv
Python main interpreter initialized at 0xcb4dd0
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145440 bytes (142 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 master process (pid: 15976)
spawned uWSGI worker 1 (pid: 15977, cores: 1)
--- no python application found, check your startup logs for errors ---

最值得注意的是“未加載應用程序。以完全動態模式運行且未找到python應用程序的行,請檢查啟動日誌中是否有錯誤

所以我的問題是,在命令行上傳遞參數與通過ini文件傳遞參數之間有什麽區別?

最佳思路

它是wsgi-file而不是wsgi_file,命令行選項和文件選項始終相同

參考資料

本文由Ubuntu問答整理, 博文地址: https://ubuntuqa.com/zh-tw/article/10850.html,未經允許,請勿轉載。