편의상 대부분의 html 출력을 생성하는 Python 스크립트가 너무 많아서 자연스럽게 현재 테스트 환경에서 스크립트를 호스트하는 간단한 설정을 사용하고 싶습니다. 장고, 플라스크, web2py 또는 뭐든간에 프로젝트를 설정하는 것은 내가 필요로하는 모든 어리석은 일에 너무 많은 번거 로움이 있습니다. 단지 .py를 작성하고 PHP와 마찬가지로 다른 것을 구성하지 않고 찾아보기를 원합니다.간단한 nginx + uWSGI 설정 문제
내가 정확히 어떤 문제가 확실하지 않다 때문에 며칠이 함께 고전을 면치 못하고, 그래서 난 그냥 설정 파일 내 현재 시도 게시합니다 :
의 nginx :
를location ~ \.py$ {
uwsgi_pass unix:///path/to/socket;
uwsgi_param SCRIPT_NAME $uri;
include uwsgi_params;
}
uWSGI
[uwsgi]
plugins = python3
py-auto-reload = 1 #So I dont have to reload the service every time
test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return b"Hello World"
나는의 nginx와 uwsgi 설정에 많은 많은 많은 변화를 가지고 있지만 난 항상 얻을 :
uWSGI 오류
발견되지 파이썬 응용 프로그램
그리고 로그 항상 다음과 같은 내용을 보여줍니다.
[pid: 10423|app: -1|req: -1/10] 10.0.20.101() {42 vars in 675 bytes} [Sun Oct 6 08:25:51 2013] GET /test.py => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
-
Sun Oct 6 08:26:44 2013 - unable to load app 0 (mountpoint='/var/www/test.py') (callable not found or import error)
[pid: 10423|app: -1|req: -1/12] 10.0.20.101() {44 vars in 707 bytes} [Sun Oct 6 08:26:44 2013] GET /test.py => generated 48 bytes in 0 msecs (H
TTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
-
Sun Oct 6 07:22:36 2013 - unable to load app 0 (mountpoint='/test.py') (callable not found or import error)
[pid: 10423|app: -1|req: -1/12] 10.0.20.101() {44 vars in 707 bytes} [Sun Oct 6 08:26:44 2013] GET /test.py => generated 48 bytes in 0 msecs (H
TTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)