2012-07-31 3 views
1

나는 uwsgi 및 python으로 내 nginx 서버를 구성했으며 브라우저에서 URL을 입력하여 Python 응용 프로그램을 실행하려고하면 브라우저가 uwsgi 오류 파이썬 응용 프로그램을 찾을 수 없다는 메시지를 반환합니다. 이처럼 내 uwsgi 로그가 모습입니다uwsgi 오류 파이썬 응용 프로그램을 찾을 수 없습니다.

:

*** Starting uWSGI 1.0.4 (32bit) on [Tue Jul 31 15:25:04 2012] *** 
compiled with version: 4.6.3 on 27 July 2012 17:02:36 
current working directory: /home/paul/Desktop/x/studio 
detected binary path: /home/paul/Desktop/x/studio/bin/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 memory page size is 4096 bytes 
probably another instance of uWSGI is running on the same address. 
bind(): Address already in use [socket.c line 598] 
[pid: 3868|app: -1|req: -1/11] 127.0.0.1() {38 vars in 911 bytes} [Tue Jul 31 15:25:22  2012] GET /ai?api=%3CIron%3E%3CAction%3E%3CService%3EUserAuth%3C/Service%3E%3CUsername%3Eadmin%3C/Username%3E%3CPassword%3Eadmin%3C/Password%3E%3C/Action%3E%3C/Iron%3E => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0) 
[pid: 3864|app: -1|req: -1/12] 127.0.0.1() {38 vars in 655 bytes} [Tue Jul 31 15:25:34 2012] GET /ai?api=%3CIron%3E%3C/Iron%3E => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0) 
[pid: 3864|app: -1|req: -1/13] 127.0.0.1() {38 vars in 655 bytes} [Tue Jul 31 15:25:38 2012] GET /ai?api=%3CIron%3E%3C/Iron%3E => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0) 
[pid: 3864|app: -1|req: -1/14] 127.0.0.1() {38 vars in 655 bytes} [Tue Jul 31 15:25:48 2012] GET /ai?api=%3CIron%3E%3C/Iron%3E => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0) 
[pid: 3868|app: -1|req: -1/15] 127.0.0.1() {38 vars in 655 bytes} [Tue Jul 31 15:26:11 2012] GET /ai?api=%3CIron%3E%3C/Iron%3E => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0) 

uwsgi와의 nginx를 사용하여 내 VIRTUALENV 루트에서 호출

bin/uwsgi -p 2 --socket 127.0.0.1:8807 --module index --pythonpath ironjob/ai -d log/uwsgi_ai.log 
bin/nginx -p ./ -c ironjob/etcs/production/nginx.conf 

~

이 내 nginx.conf 파일

입니다
server { 
    listen  8090; 
    server_name example.com; 
    charset  utf-8; 

    # Django admin media. 
    location /media/admin/ { 
     alias lib/python2.6/site-packages/django/contrib/admin/media/; 
    } 
    # Your project's static media. 
    location /media/ { 
     alias PROJECT_ROOT/media/; 
    } 

    # Finally, send all non-media requests to the Django server. 
    location /ai { 
     uwsgi_pass 127.0.0.1:8807; 
     include  uwsgi_params; 
    } 
    } 

하고 호출 응용 프로그램을 포함하는 $ VIRTUVAL_ENV/ironjob/인공 지능/index.py 파일 : 당신이 오래된 uWSGi 인스턴스가 이미 실행이 같은

import os 
import sys 
from webob import Response 
from cgi import parse_qs, escape 
import urllib 

from ironMainManager import MainManager 

os.environ['PYTHONJ_EGG_CACHE'] = '$VIRTUAL_ENV/bin/.python-egg' 

def application(environ , start_response): 
    mManager = MainManager() 
    parameters = parse_qs(environ.get('QUERY_STRING', '')) 
    returnval ="<Root></Root>" 

    if 'api' in parameters: 
     api = parameters['api'][0] 
     if 'platform' in parameters: 
       platform = parameters['platform'][0] 
       if platform == 'browser': 
         api = urllib.unquote(str(parameters['api'][0])) 
     print api 
     returnval = mManager.process(api) 
     output = 'success' 
    else: 
     output = 'error' 

    res = Response() 
    res.content_type = 'text/plain' 
    res.body=str(returnval) 
    return res(environ, start_response) 

답변

3

것 같습니다. 남아있는 모든 인스턴스를 종료하고 uWSGI를 재시작하십시오. 이 외에도 항상 최신 안정을 사용하려고합니다 (1.0은 꽤 오래되었습니다)

+0

나를 도와 줬어! –

관련 문제