I've made good progress towards getting my flask wsgi application running.
My application requires that I run as the user "ubuntu" (user 1000). So I
modified my virtualhost as follows:
<VirtualHost *:80>
ServerName localhost
WSGIDaemonProcess localhost user=ubuntu group=ubuntu threads=15
WSGIScriptAlias / /var/www/cwpmash/wsgi-scripts/cwpmash.wsgi
DocumentRoot /var/www/cwpmash/public-html
<Directory /var/www/cwpmash/public-html>
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/cwpmash/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Furthermore, The process requires that the DISPLAY environment variable is
set to :0.0. For this reason I attempted to set the environment in my wsgi
file:
import sys
import os
os.environ["DISPLAY"] = ":0.0"
sys.path.insert(0, '/var/www/cwpmash')
activate_this = '/var/www/cwpmash/flask/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
from app import app as application
root@sensis-8930:/var/www/cwpmash/wsgi-scripts# cat cwpmash.wsgi
import sys
import os
os.environ["DISPLAY"] = ":0.0"
sys.path.insert(0, '/var/www/cwpmash')
activate_this = '/var/www/cwpmash/flask/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
from app import app as application
This however does not seem to be achieving the required result as can be
seen by the socket connect failure:
[Thu Sep 25 19:07:53.361998 2014] [:error] [pid 11958:tid 140421956523776]
[client
10.93.105.41:50344] ConnectionError: Could not connect to socket at ''
Is setting the environment as I've done above a reasonable (and correct)
way of passing a critical environment variable into my application? Can you
see something else that might be wrong in the way that I am attempting to
configure this WSGI module? If I'd like to send diagnostics to error.log
(just as mod_wsgi does), how can I do this? Should a simple "python print"
be directed to the apache error log?
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.