how to restart we2py running as fastcgi process under Apache?

20 views
Skip to first unread message

Jim Gregory

unread,
Jun 16, 2019, 7:13:42 PM6/16/19
to web...@googlegroups.com
I just launched an app into production that uses the Python Imaging Library (PIL).  PIL was installed on my local development environment, but not on my production server, and the app started throwing errors.

I installed PIL on the server.  If I launch the app in web2py's interactive command line shell in a console on the server, I can import it without error, so I know it's installed and web2py can pick it up.  But the app is still throwing errors when viewed in a browser. 

I'm assuming that's because the server needs to be restarted.  I'm running it as a fastcgi process under Apache.  I respond to each request using this file I call web2py.fcgi:

#!/home/myaccount/.env/bin/python2.7
# python running in virtual environment named '.env'

import sys, os

# add web2py to the front of the system's executable path
sys
.path.insert(0, "/home/myaccount/web2py")

# this assumes flup is already installed on the server
from flup.server.fcgi_fork import WSGIServer

# Switch to the web2py directory so gluon can be imported
os
.chdir("/home/myaccount/web2py")

# import the web2py's fcgi gateway
import gluon.main
import gluon.contrib.gateways.fcgi as fcgi

application
=gluon.main.wsgibase
# or
# application=gluon.main.wsgibase_with_logging
WSGIServer(application).run()


I have attempted to restart using:

sudo pkill web2py.fcgi
sudo service apache2 restart

That seems to clear out the web2py.fcgi processes and restarting the server, but, I'm still getting 'No module named PIL' errors.

Any suggestions you could provide would be greatly appreciated!

Jim Gregory

unread,
Jun 16, 2019, 9:56:56 PM6/16/19
to web2py-users
Turned out I had an old incompatible version of PIL on my production server.  I removed it and now all seems to be OK.
Reply all
Reply to author
Forward
0 new messages