2012-05-29 4 views
0

uWSGI 인 것을 알기 위해 Django (버전 1.3.1)을 사용하는 작은 더미 웹 응용 프로그램을 작성했으며 최근에 실행 중입니다. 안정 버전 nginx. 모든 것이 예상대로 작동합니다. 하지만, 내보기 중 하나에서, 나는 다음과 같은 오류 얻을의 uWSGI 컨테이너에 스풀 메시지를 보내고 오전 : 내 testapp를에서uwsgi가 스풀러 기능을 찾을 수 없음

[spooler /private/tmp/receiver pid: 4115] managing request uwsgi_spoolfile_on_ozgurv.local_4165_1_0_1338280641_366596 ... 
unable to find the spooler function, have you loaded it into the spooler process ? 

을/views.py 파일 :

from django.http import HttpResponse 
from testapp.spool import three_seconds 

def call(request): 
    three_seconds.spool(a=1, b=2) 
    return HttpResponse('spooled') 

에서 내 testapp를/spool.py 파일 :

:

나는 함수 URL/호출을 요청하여 '전화'를 실행 한
from uwsgidecorators import * 

@spool 
def three_seconds(*args, **kwargs): 
    f = open('/tmp/args.data', 'a') 
    f.write(repr(kwargs) + '\n') 
    f.close() 

은/브라우저에서, 나는 다음과 같은 오류가 발생했습니다

[spooler /private/tmp/receiver pid: 4115] managing request uwsgi_spoolfile_on_ozgurv.local_4165_1_0_1338280641_366596 ... 
unable to find the spooler function, have you loaded it into the spooler process ? 
uWSGI 다음 매개 변수와 함께 실행

:

[uwsgi] 
socket = 127.0.0.1:8081 
listen = 4096 
master = true 
processes = 4 
pidfile = /var/run/uwsgi.pid 
enable-threads = true 
uid=root 
gid=admin 
single-interpreter = true 
disable-logging = true 
buffer-size= 32768 
reload-on-as = 10240 
reload-on-rss = 512i0 
max-requests = 50000 
pythonpath = /Users/ozgurv/Developer/warehouse 
module = wsgi_handler 

plugins = python27,spooler 
spooler-processes = 1 
spooler = /tmp/receiver 

나는 그것이 대해 불평 왜 단서가 없다 : 다음과 같은

sudo uwsgi --ini ~/uwsgi.ini -b 20000 

그리고 내 uwsgi.ini 파일의 내용이 보인다 스풀러 기능 및 이유 uwsgi 찾을 수 없습니다. 그리고 "스풀러 프로세스에로드했습니다"는 의미는 무엇입니까? 스풀러 프로세스의 컨텍스트에서 어떻게 스풀러 함수를로드 할 수 있습니까?

답변

2

사용 스풀러 수입 = testapp를/스풀러 프로세스

과 그 프로세스 주소 공간

다른 용액 uwsgi 모든 프로세스에서 모듈을 반입된다에 해당 모듈을 가져올 것이다 spool.py

import = testapp/spool.py