繁体   English   中英

使用mod_wsgi部署烧瓶应用程序

[英]Deploying a flask application with mod_wsgi

我正在尝试将我的一个Flask应用程序部署到apache上的mod_wsgi,但是我遇到了麻烦,因为apache试图解决文件系统上的一些路由:

apache的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

我说的是“一些路由”,因为身份验证(在“/”上)和重定向到“/ 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

部署到mod_wsgi基本“hello world”应用运行正常。 我的烧瓶应用程序,当使用集成到烧瓶中的开发服务器运行时,表现良好。

使用此链接可以遵循正确的过程。 您必须使用$ SCRIPT_ROOT变量。

flask.pocoo.org/docs/patterns/jquery

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM