I'm trying to deploy one of my Flask apps to mod_wsgi on apache, but I'm having trouble because apache tries to solve SOME of the routes on the filesystem:
apache's 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
I'm saying "SOME of the routes" because the authentication (on "/") and redirection to "/chat" works.
The route "_publish_message" is accessed via AJAX like this (using jQuery):
function publish_message(e){
e.preventDefault();
$.post('/_publish_message', {'message': "user's message taken from a text field"})
.fail(Handler.publish_error);
}
The route "_sse_stream" is used as the URL for an EventSource.
These two aren't working!
The virtual host configuration:
<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>
The webchat.wsgi
file:
import sys
sys.path.insert(0, '/srv/http/webchat/src')
from index import app as application
A basic "hello world" app deployed to mod_wsgi
runs OK.
My flask app, when run using the development server integrated into flask, behaves well.
Use this link to follow the correct process. You have to use the $SCRIPT_ROOT variable.
flask.pocoo.org/docs/patterns/jquery
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With