I have an application built on CherryPy. I've been using the CherryPy built-in HTTP server but now want to move to uWSGI (and nginx).
On my workstation this works fine and the change was simple enough to make.
However on my test server I get the following error.
File "./validator/dbtools.py", line 3, in <module>
import psycopg2
File "/home/apiuser/API25/env/lib64/python3.5/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: /home/apiuser/API25/env/lib64/python3.5/site-packages/psycopg2/_psycopg.cpython-35m-x86_64-linux-gnu.so: undefined symbol: lo_truncate64
unable to load app 0 (mountpoint='') (callable not found or import error)
The test server is different (CentOS 7 vs an Ubuntu based distribution on my workstation). When I google the error I see reports from similar errors but in different libraries. The psycopg library didn't change, in fact the two versions of the app (CherryPy / uWSGI version) runs from the same VirtualEnv. Running it as a CherryPy service works still fine.
I'm new to all of this so any help will be appreciated!
EDIT -- In response to the Question by Piotr: I star the app with a small bash script like this:
#!/bin/bash
. env/bin/activate
uwsgi --socket 127.0.0.1:8030 --protocol=http --wsgi-file wsgi.py --callable wsgiapp
Two other things I have picked up:
1. I set up a new test server running CentOs. On this new server the uwsgi app starts without the undefined symbol error. I would still like to know what causes it as a matter of learning about this.
2. Some of the API endpoints include some functions launched into background threads. Those work fine when running the app behind CherryPy's default server. When running the app using uWSGI the background threads doesn't execute but appears to get queued up. When I terminate the app (Control-C on the console) those threads suddenly run and those tasks (particularly push notifications) will go through.