[uWSGI] selenium/phanthomjs call is not working using nginx/apache2 and uwsgi

Raphael Lechner raphael.lechner at gmail.com
Wed Apr 15 10:55:45 CEST 2015


Hi,

I’m trying to migrate my web2py application from apache2/wsgihandler.py to nginx/uwsgi and I found a strange issue,
that seems related to uwsgi.

I have a function that is calling phantomjs:

from selenium import webdriver
driver = webdriver.PhantomJS('phantomjs')
driver.get('http://%s/servlet?p=login&q=login&jumpto=features-forward' % phoneip)

from the command line and via apache2/wsgihandler.py the call is working fine. But calling the same function using nginx/uwsgi or apache2/uwsgi I always got
that error:
<class 'selenium.common.exceptions.WebDriverException'> Message: Can not connect to GhostDriver

count = 0
        while not utils.is_connectable(self.port):
            count += 1
            time.sleep(1)
            if count == 30:
                 raise WebDriverException("Can not connect to GhostDriver")

Have I something wrong with the uwsgi configuration?
Or is that problem not related to uwsgi and maybe a web2py/selenium/phantomjs issue?

I tried calling the function from a dedicated file but I always the same error.

My uwsgi configuration:
Ubuntu 14.04
/etc/uwsgi/web2py.ini 
[uwsgi]

socket = /tmp/web2py.socket
pythonpath = /home/www-data/web2py/
mount = /=wsgihandler:application
processes = 4
master = true
harakiri = 60
reload-mercy = 8
cpu-affinity = 1
stats = /tmp/stats.socket
max-requests = 2000
limit-as = 512
reload-on-as = 256
reload-on-rss = 192
uid = www-data
gid = www-data
cron = 0 0 -1 -1 -1 python /home/www-data/web2py/web2py.py -Q -S welcome -M -R scripts/sessions2trash.py -A -o
no-orphans = true
buffer-size=32768
enable-threads = true

uwsgi --version
2.0.10

nginx:
location / {
            uwsgi_pass      unix:///tmp/web2py.socket;
            include         uwsgi_params;
            uwsgi_param     UWSGI_SCHEME $scheme;
            uwsgi_param     SERVER_SOFTWARE    nginx/$nginx_version;
        }

Thank you for any response!
Raphael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unbit.it/pipermail/uwsgi/attachments/20150415/ccd4ed78/attachment.html>


More information about the uWSGI mailing list