나는 아파치에 mod_wsgi에 내 플라스크 애플 리케이션 중 하나를 배포하는 것을 시도하고있는 플라스크에 응용 프로그램을 배포하지만, 아파치가 파일 시스템의 루트의 일부 해결하려고하기 때문에 나는 데 문제 :은 mod_wsgi에
아파치의를 의 error_log :
[Mon Aug 06 19:18:38 2012] [error] [client ::1] File does not exist:
/srv/http/webchat/src/_publish_message, referer: http://localhost:88/webchat/chat
말인지 및 리디렉션 ("/")에 인증 때문에 "경로의 일부"가 "/ 채팅"하기 위해 노력하고 있습니다.
경로 "_publish_message"
이렇게 AJAX 통해 액세스 (jQuery를 사용)function publish_message(e){
e.preventDefault();
$.post('/_publish_message', {'message': "user's message taken from a text field"})
.fail(Handler.publish_error);
}
경로 "_sse_stream"는 EventSource 대한 URL로서 사용된다.
이 두 가지가 작동하지 않습니다!
가상 호스트 구성 :
<VirtualHost *:88>
ServerName webchat.dev
WSGIDaemonProcess webchat user=http group=http threads=5
WSGIScriptAlias /webchat /srv/http/webchat/src/webchat.wsgi
WSGIScriptReloading On
DocumentRoot /srv/http/webchat/src
<Directory /srv/http/webchat/src>
WSGIProcessGroup webchat
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
webchat.wsgi
파일 :
import sys
sys.path.insert(0, '/srv/http/webchat/src')
from index import app as application
OK mod_wsgi
실행에 배포 기본에 "Hello World"응용 프로그램. 플라스크에 통합 된 개발 서버를 사용하여 실행하면 내 플라스크 앱이 제대로 작동합니다.
은 "경로"_publish_message는 "AJAX를 통해 액세스 할 수 있습니다." 자세한 내용을 알려 주실 수 있습니까? – codegeek
AJAX 요청을 수행하는 코드를 추가했습니다. – Paul
잘 모르겠지만 도움이 될 수 있습니다. http://flask.pocoo.org/docs/patterns/jquery/ – codegeek