I've checked to see that there is actually a process running as ubuntu
there is:
ps -aef | grep apache
root 13687 1 0 19:46 ? 00:00:00 /usr/sbin/apache2 -k start
ubuntu 13689 13687 0 19:46 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 13691 13687 1 19:46 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 13692 13687 0 19:46 ? 00:00:00 /usr/sbin/apache2 -k start
However at the point where I am making the socket connection (inside the
app) I execute "whoami" and I see that it is www-data that is trying to
connect (rather than ubuntu). I can see the same just be dropping the
"whoami" into the top-level wsgi:
cat cwpmash.wsgi
import sys
import os
import subprocess
print 'cwpmash wsgi running'
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))
#a=subprocess.check_output("DISPLAY=:0.0 i3 --get-socketpath", shell=True)
a=subprocess.check_output("whoami", shell=True)
gool = open('/tmp/goolio', 'w+')
gool.write('hello\n')
gool.write(a)
from app import app as application
cat /tmp/goolio
hello
www-data
So for some reason the ubunut daemon process specified by WSGIDaemonProcess
does not seem to be used.
On Thursday, September 25, 2014 3:15:23 PM UTC-4, David Sargrad wrote:
>
> 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.